function Mover(src) {
    src.style.border = '1px solid #3068dd';
    src.style.background = '#ffffff';
    src.select();
}
function Mout(src)
{
    src.style.border = '0px';
    src.style.background = '';
}

//获取虚拟目录路径
function getRootPath() {
    var strFullPath = window.document.location.href;
    var strPath = window.document.location.pathname;
    var pos = strFullPath.indexOf(strPath);
    var prePath = strFullPath.substring(0, pos);
    var postPath = strPath.substring(0, strPath.substr(1).indexOf('/') + 1);
    return(prePath + postPath);
}

//获取虚拟目录路径
function getprePath() {
    var strFullPath = window.document.location.href;
    var strPath = window.document.location.pathname;
    var pos = strFullPath.indexOf(strPath);
    var prePath = strFullPath.substring(0, pos);
    return prePath;
}

/**
 * 获取当前文档的路径
 */
function getCurrentDirectory() {
    var locHref = location.href;
    var locArray = locHref.split("/");
    /**这里测试locArray效果**
     for(x in locArray){
     document.write("locArray[");
     document.write(x+"]: ");
     document.write(locArray[x]+"<br />");
     }
     **/
    delete locArray[locArray.length - 1];
    return locArray.join("/"); //利用join来粘合
}

/**
 * 获取URL路径
 * 例如:
 * alert("[/]="+getUrlPath("/")+"\n[./]="+getUrlPath("./")+"\n[../]="+getUrlPath("../"));
 * @param s 为"/"时返回root路径 为"./"时返回当前路径 为"../"时返回
 */
function getUrlPath(s) {
    var m = new Image();
    m.src = s;
    return   m.src;
}
var webRoot = getUrlPath("/") + '/web';

var sw = screen.width;
var sh = screen.height;
var w = 710;
var h = 430;
var l = (sw - w) / 2;
var t = (sh - h) / 2 - 40;

//以模态窗口的方式打开文章编辑界面
function onShowModalDialog(url, width, height) {
    var dialogType = 'center:yes; help:no;resizable:no;status:off;dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;left:' + l + ';top=' + t + ';';
    var reValue = window.showModalDialog(url, window, dialogType);
    //alert("reValue=" + reValue);
    if (reValue == undefined)
        reValue = '';
    //alert("reValue=" + reValue);
    return reValue;
}

//以模态窗口的方式打开文章编辑界面
function onShowModalDialogEditor(url) {
    var dialogType = 'center:yes; help:no;resizable:no;status:off;dialogWidth:700px;dialogHeight:640px;left:' + l + ';top=' + t + ';';
    return window.showModalDialog(url, window, dialogType);
}
//以模态窗口的方式打开界面
function onClickShowModalDialog(url) {
    var dialogType = 'center:yes; help:no;resizable:no;status:off;width=' + w + ";height=" + h + ";left=" + l + ";top=" + t;
    return window.showModalDialog(url, window, dialogType);
}
//以模态窗口的方式打开界面
function onClickShowModalMainDialog(url) {
    var width = document.body.clientWidth / 2;
    var height = document.body.clientHeight / 2;
    // alert('width='+width+'\theight='+height)
    var dialogType = 'center:yes; help:no;resizable:no;status:off;dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;left:' + l + ';top=' + t + ';';
    window.showModalDialog(url, window, dialogType);
}

//当关闭模块窗口时,刷新打开它的父窗口
function onClickCloseModalDialogRefParent(isRef, url) {
    if (isRef) {
        //window.dialogArguments.location.reload();
        window.dialogArguments.location.href = url;
    }
    window.close();
}

/**
 * 在页面中心打开非模态窗口
 * @param url 在模态窗口中显示的页面
 * @param width          宽度
 * @param height           高度
 */
function showWindowCenterDialog(url, width, height) {
    var showx = (window.screen.availWidth - width) / 2;
    var showy = (window.screen.availHeight - height) / 2;
    var window_name = window.location.href;
    window_name = window_name.split("?")[0];
    window_name = window_name.split("/")[window_name.split("/").length - 1];
    window_name = window_name.split(".")[0];
    window.open(url, window_name, "width=" + width + ",height=" + height + ",top=" + showy + ",left=" + showx + ",menubar=no,toolbar=no,scrollbars=yes,status=yes,resizable=yes");
    //window.open(url, window_name, "width="+width+",height="+height+",top="+showy+",left="+showx+",menubar=no,toolbar=no,status=yes,scrollbar=yes");
    //window.open(url, window_name, "width="+width+",height="+height+",top="+showy+",left="+showx+",menubar=yes,toolbar=yes,status=yes,resizable=yes");
}

/**
 * 在页面中心打开模态窗口
 * @param url 在模态窗口中显示的页面
 * @param width          宽度
 * @param height           高度
 */
function showWindowCenterModelessDialog(url, width, height) {
    var showx = (window.screen.availWidth - width) / 2;
    var showy = (window.screen.availHeight - height) / 2;
    var window_name = window.location.href;
    window_name = window_name.split("?")[0];
    window_name = window_name.split("/")[window_name.split("/").length - 1];
    window_name = window_name.split(".")[0];
    return showModelessDialog(url, "", "dialogHeight: " + width + "px; dialogWidth: " + width + "px; help:no;center:yes;scroll:no;status:no;title:no");
    //dialogHeight: 150px; dialogWidth: 264px;
}

//直接从url中取值
var request = { QueryString : function(val) {
    var uri = window.location.href;
    var re = new RegExp("" + val + "=([^&?]*)", "ig");
    return ((uri.match(re)) ? (uri.match(re)[0].substr(val.length + 1)) : null);
},QueryStrings : function() {
    var uri = window.location.href;
    var re = uri.split('?');
    if (re == null || re[1] == null)
        re = "";
    else {
        re = re[1];
        re = re.split('&');
        var temp = '';
        for (var i = 0; i < re.length; i++) {
            if (re[i] != null && re[i].indexOf('src') == -1) {
                if (temp.length <= 0)
                    temp += re[i];
                else
                    temp += '&' + re[i];
            }
        }
        re = temp;
    }
    return re;
}
}
/**
 *
 * @param obj 总checkbox
 * @param checkBoxName 指定需要的box
 */
function checkBzSelAll(obj, checkBoxName) {
    var check = document.getElementsByName(checkBoxName);
    for (var i = 0; i < check.length; i++)
        check[i].checked = obj.checked;

}
//------------------------------------------------------------
//javascript读写Cookie函数
function GetCookieVal(offset)
    //获得Cookie解码后的值
{
    var endstr = document.cookie.indexOf(";", offset);
    if (endstr == -1)
        endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}
function SetCookie(name, value)
    //设定Cookie值
{
    var expdate = new Date();
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    if (expires != null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
    document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ("; expires=" + expdate.toGMTString()))
            + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain))
            + ((secure == true) ? "; secure" : "");
}
function DelCookie(name)
    //删除Cookie
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = GetCookie(name);
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
function GetCookie(name)
    //获得Cookie的原始值
{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen)
    {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
            return GetCookieVal(j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    }
    return null;
}
//------------------------------------------------------------

/*过滤用户输入的数据是否存在特殊字符*/
function checkFH(obj) {
    var str = obj.value;
    if (str.indexOf("\\") != -1) {
        alert("您输入的：'" + str + "'中存在[\\](反斜杠)，请修改！！");
        return false;
    } else if (str.indexOf("\"") != -1) {
        alert("您输入的：'" + str + "'中存在[\"](半角的双引号)，请修改！！");
        return false;
    } else if (str.indexOf("“") != -1) {
        alert("您输入的：'" + str + "'中存在[“](全角的双引号)，请修改！！");
        return false;
    } else if (str.indexOf("'") != -1) {
        alert("您输入的：'" + str + "'中存在['](半角的单引号)，请修改！！");
        return false;
    } else if (str.indexOf("‘") != -1) {
        alert("您输入的：'" + str + "'中存在[‘](全角的左单引号)，请修改！！");
        return false;
    } else if (str.indexOf("’") != -1) {
        alert("您输入的：'" + str + "'中存在[’](全角的右单引号)，请修改！！");
        return false;
    } else if (str.indexOf("(") != -1) {
        alert("您输入的：'" + str + "'中存在[(](半角的左括号)，请修改！！");
        return false;
    } else if (str.indexOf("（") != -1) {
        alert("您输入的：'" + str + "'中存在[（](全角的左括号)，请修改！！");
        return false;
    } else if (str.indexOf(")") != -1) {
        alert("您输入的：'" + str + "'中存在[)](半角的右括号)，请修改！！");
        return false;
    } else if (str.indexOf("）") != -1) {
        alert("您输入的：'" + str + "'中存在[）](全角的右括号)，请修改！！");
        return false;
    } else if (str.indexOf("/") != -1) {
        alert("您输入的：'" + str + "'中存在[/] ，请修改！！");
        return false;
    } else if (str.indexOf("\\") != -1) {
        alert("您输入的：'" + str + "'中存在[\\] ，请修改！！");
        return false;
    } else {
        return true;
    }
}

/*进行小数后自动补零*/
function cents(amount)
{
    if (isNaN(amount)) return amount;
    amount -= 0;
    amount = round(amount, 2)
    if (amount == 0)
        amount = '0.00';
    else if (amount == Math.floor(amount))
        amount += '.00';
    else if (amount * 10 == Math.floor(amount * 10))
            amount += '0';
    return  amount;
}
/*进行小数后自动补零*/
function cent4(amount)
{
    if (isNaN(amount)) return amount;
    amount -= 0;
    amount = round(amount, 4)
    if (amount == 0)
        amount = '0.0000';
    else if (amount == Math.floor(amount))
        amount += '.0000';
    else if (amount * 1000 == Math.floor(amount * 1000))
            amount += '000';
    return  amount;
}
/*保留小数点后两位小数*/
function round(number, x)
{
    return Math.round(number * Math.pow(10, x)) / Math.pow(10, x);
}
/*监测输入数值是否为数字
 临时排除---字符
 */
function checkit(what)
{
    if (isNaN(what.value) && what.value != '──')
    {
        alert(what.value + "不是一个有效数字!");
        what.focus(0);
        return false;
    }
    else
    {
        what.value = cents(what.value);
        return true;
    }
}
/*监测输入数值是否为数字
 进行了float事件的处理
 */
function checkitt(what)
{
    if (isNaN(what.value) && what.value != '──')
    {
        alert(what.value + "不是一个有效数字!");
        what.focus(0);
        return false;
    }
    else
    {
        what.value = cents(what.value);
        return true;
    }
}
/**
 * 监测输入是否为空
 * @param what 控件对象
 */
function checkBlank(what) {
    var tem = what.value.trim();
    if (tem.length == 0) {
        alert("提示:不允许为空!");
        what.focus();
    }
}

/*监测输入数值是否为数字
 临时排除---字符
 */
function checkitint(what)
{
    if (isNaN(what.value) && what.value != '──')
    {
        alert(what.value + "不是一个有效数字!");
        what.focus(0);
        //what.value="0.00";
        return false;
    }
}

/*点击回车后光标下移*/
function checklock(what)
{
    //    alert('asdf');
    if (isNaN(what.value))
    {
        if (what.value.length < 1)
        {
            what.focus();
            return false;
        }
    }
    var name = what.name;
    if (window.event.keyCode == 13)
    {
        window.event.keyCode = 9;
        return;
    }
    if (window.event.keyCode == 37)
    {
        return;
    }
    if (window.event.keyCode == 39)
    {
        window.event.keyCode = 9;
        return;
    }
    if (window.event.keyCode == 40)
    {
        /*var rightnum = eval('1' + '+' + name.substring(2, name.length));
         if (rightnum < 20)
         {
         name = name.substring(0, 2) + rightnum;
         document.all.item(name).focus();
         }*/
        return;
    }
    if (window.event.keyCode == 38)
    {
        /*var rightnum = eval(name.substring(2, name.length) + '-' + '1');
         if (rightnum > 0)
         {
         name = name.substring(0, 2) + rightnum;
         document.all.item(name).focus();
         }*/
        return;
    }
}
/*判断输入是否为整型*/
function checkInteger(obj)
{
    if (isNaN(obj.value))
    {
        alert(obj.value + "不是有效数字");
        obj.value = "0.00";
        obj.focus(0);
        return;
    }
    else {
        obj.value = Math.floor(obj.value);
    }
}

/**
 * 获取客户端的日期
 */
function getCurDate() {
    var d, s = "";           // 声明变量。
    d = new Date();                           // 创建 Date 对象
    s += d.getYear() + "-";                         // 获取年份
    s += (d.getMonth() + 1) + "-";            // 获取月份。
    s += d.getDate();                   // 获取日
    return(s);
}

function strDateTime(str)
{
    if (str.length != 0)
    {
        var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
        if (r == null)return false;
        var d = new Date(r[1], r[3] - 1, r[4]);
        return (d.getYear() == r[1] && (d.getMonth() + 1) == r[3] && d.getDate() == r[4]);
    }
    else
        return true;

}

// 计数日期差值
function dateDiff(per, d1, d2)
{
    var d = (d2.getTime() - d1.getTime()) / 1000;
    switch (per)
            {
        //case "yyyy": d/=12;
        //case "mm": d*=12*7/365.25;
        case "ww": d /= 7;
        case "dd": d /= 24;
        case "hh": d /= 60;
        case "nn": d /= 60;
    }
    return Math.ceil(d);
}
//功能：判断intYear年intMonth月的天数
//返回值：intYear年intMonth月的天数
function fnComputerDay(intYear, intMonth)
{
    var dtmDate = new Date(intYear, intMonth, -1);
    var intDay = dtmDate.getDate() + 1;
    return intDay;
}

function checkIntLength(obj, bb)
{
    var aa = obj.value;
    if (aa == null || bb == null)
    {
        return;
    }
    var len = 0;
    if (aa.indexOf('.', 1) >= 0)
    {
        len = aa.indexOf('.', 1);
    }
    else
    {
        len = aa.length;
    }
    if (len > bb)
    {
        alert('输入的数据太大，不能保存');
        obj.focus(0);
        return false;
    }
}

//end

//2006.09.05
//去除空格，包括字符内部的空格
String.prototype.trim = function()
{
    //return this.replace(/(^[\s|　]*)|([\s|　]*$)/g,"");  //原来的替换方法
    //obj.value = obj.value.replace(/\s|　|&nbsp(;)?/gi, "");//新的校验方法
    //obj.focus();
    return this.replace(/\s|　|&nbsp(;)?/gi, "");
}

//检测字符串中是否有空格
function checkSpace(obj)
{
    obj.value = obj.value.replace(/\s|　|&nbsp(;)?/gi, "");
    //新的校验方法
}

//检测字符串中是否含有中文或者全角符号
function CheckChinese(obj)
{
    var str = obj.value;
    if (escape(str).indexOf('%u') != -1)
    {
        alert("不得含中文和全角符号！");
        return true;
    } else
    {
        return false;
    }
}

//JS中默认只能用ID与NAME来获取元素，但有时想能直接获取到CLASS就方便多了
document.getElementsByClassName = function(eleClassName) {
    var getEleClass = [];//定义一个数组
    var myclass = new RegExp("\\b" + eleClassName + "\\b");//创建一个正则表达式对像
    var elem = this.getElementsByTagName("*");//获取文档里所有的元素
    for (var h = 0; h < elem.length; h++)
    {
        var classes = elem[h].className;//获取class对像
        if (myclass.test(classes)) getEleClass.push(elem[h]);//正则比较，取到想要的CLASS对像
    }
    return getEleClass;//返回数组
}
//传入html 和解析标签 按照标签顺序解析并在div中显示解析到的内容
//解析标签 如
function f_getWordText(filetext) {
    try {
        document.getElementById('tabPage1').innerHTML = filetext;    //为全文预览标签页赋值
        var dind = document.getElementById('tabPage1').dindName;
        document.getElementById(dind).value = filetext;
    }
    catch(e)
    {
    }
    return true;
}
//传入html 和解析标签 按照标签顺序解析并在div中显示解析到的内容
function f_getHtmlText(filetext) {
    var reg_1 = /<img[^>]*>/ig; // 创建正则表达式模式。
    var find = filetext.match(reg_1);
    if (find != null) {
        for (u = 0; u < find.length; u++) {
            var imgstr = find[u].toString();
            imgstr = imgstr.replace("onload=\"show(this)\"", "");
            //放大图片的宽度
            var re = /width=([\"\'])?(\d+)\1/g
            var mresult = re.exec(imgstr);
            if (mresult != null) {
                var end = mresult.toString().indexOf(',');
                var start = mresult.toString().indexOf('=') + 1;
                var width = mresult.toString().substring(start, end);
                width = parseInt(width) * 1.0;
                imgstr = imgstr.replace(re, "$1width=" + width);
            }
            //alert("imgstr=" + imgstr);
            //放大图片的高度
            var re = /height=([\"\'])?(\d+)\1/g
            var mresult = re.exec(imgstr);
            if (mresult != null) {
                var end = mresult.toString().indexOf(',');
                var start = mresult.toString().indexOf('=') + 1;
                var height = mresult.toString().substring(start, end);
                height = parseInt(height) * 1.0;
                imgstr = imgstr.replace(re, "$1height=" + height);
            }
            filetext = filetext.replace(reg_1, imgstr);
        }
    }
    //alert("filetext="+filetext);
    filetext = f_changHref(filetext);

    //更改图片路径问题  区分内外网
    // 例如：127.0.0.1/web/images/images111.jpg
    // 路径只保存 /web/images/images111.jpg
    // 前面的ip在显示时才加上去 这样内外网都可以显示图片

    var re = /(<img[\s\S]*src=\")([^"]+)(\"[^>]*>)/g
    var RootPath = getprePath();
    //alert("RootPath="+RootPath);
    filetext = filetext.replace(re, "$1" + RootPath + "$2$3");
    try {
        document.getElementById('tabPage1').innerHTML = filetext;    //为全文预览标签页赋值
        var dind = document.getElementById('tabPage1').dindName;
        document.getElementById(dind).value = filetext;
    }
    catch(e)
    {
    }
    return true;
}

//更改联接ip
function f_changHref(filetext) {

    var reg = /(href=\")([^"]+)(\"[^>]*>)/g
    var RootPath = getprePath();
    var find = filetext.match(reg);
    if (find != null) {
        for (u = 0; u < find.length; u++) {
            var mresult = find[u].toString();
            if (mresult != null) {
                var temSrc = "";
                var href = mresult;
                var start2 = href.toString().indexOf('="');
                var href2 = href.toString().substring(start2 + 2);
                var end2 = href2.toString().indexOf('"');
                var href2 = href2.toString().substring(0, end2);
                var isHttp = href2.indexOf('http://');
                if (isHttp != '-1') {   //
                    var aa = href2.indexOf('/web');
                    if (aa != '-1') {
                        temSrc = href2.substring(aa);
                        var reg1 = /(href=\")([^"]+)(\"[^>]*>)/g
                        var href3 = href.replace(reg1, temSrc);
                        href3 = RootPath + href3;
                    } else {
                        var href3 = href2;
                    }
                    filetext = filetext.replace(href2, href3);
                }
            }
        }
    }
    return filetext;
}


/**
 * 初始化下拉列表
 * @param strJson 指定格式的字符串
 * @param selName 列表格式名称
 */
function fillSelect(strJson, selName) {
    eval("var strJson=" + strJson);
    var list = strJson.data;
    var objSel = eval("document.all." + selName);
    //清空选项
    objSel.options.length = 0;
    //初始化第一个选项
    var oOption = document.createElement("OPTION");
    oOption.text = "--请选择--";
    oOption.value = "";
    objSel.add(oOption);

    for (var i = 0; i < list.length; i++) {
        oOption = document.createElement("OPTION");
        oOption.text = list[i].CLASS_NAME;
        oOption.value = list[i].CLASS_DM;
        objSel.add(oOption);
    }
}
/**
 * 初始化下拉列表
 * @param strJson 指定格式的字符串
 * @param selObj 下拉列表对象
 */
function fillSelObj(strJson, selObj) {
    eval("var strJson=" + strJson);
    var list = strJson.data;
    //清空选项
    selObj.options.length = 0;
    //初始化第一个选项
    var oOption = document.createElement("OPTION");
    oOption.text = "--请选择--";
    oOption.value = "";
    selObj.add(oOption);

    for (var i = 0; i < list.length; i++) {
        oOption = document.createElement("OPTION");
        oOption.text = list[i].CLASS_NAME;
        oOption.value = list[i].CLASS_DM;
        selObj.add(oOption);
    }
}
/**
 * 初始化下拉列表
 * @param jsonObjClass 类的JSON对象字符串
 * @param selObj 下拉列表对象
 */
function initCLassSelObj(jsonObjClass, selObj) {
    //清空选项
    selObj.options.length = 0;
    //初始化第一个选项
    var oOption = document.createElement("OPTION");
    oOption.text = "--请选择--";
    oOption.value = "";
    selObj.add(oOption);
    for (var i = 0; i < jsonObjClass.length; i++) {
        oOption = document.createElement("OPTION");
        oOption.text = jsonObjClass[i].CLASS_NAME;
        oOption.value = jsonObjClass[i].CLASS_DM;
        selObj.add(oOption);
    }
}

//去掉联接ip
function f_ipHref(filetext) {
    var reg = /(href=\")([^"]+)(\"[^>]*>)/g
    var RootPath = getprePath();
    var find = filetext.match(reg);
    if (find != null) {
        for (u = 0; u < find.length; u++) {
            var mresult = find[u].toString();
            if (mresult != null) {
                var temSrc = "";
                var href = mresult;
                var start2 = href.toString().indexOf('="');
                var href2 = href.toString().substring(start2 + 2);
                var end2 = href2.toString().indexOf('"');
                var href2 = href2.toString().substring(0, end2);
                var isHttp = href2.indexOf('http://');
                if (isHttp != '-1') {
                    var aa = href2.indexOf('/web');
                    if (aa != '-1') {
                        temSrc = href2.substring(aa);
                        var reg1 = /(href=\")([^"]+)(\"[^>]*>)/g
                        var href3 = href.replace(reg1, temSrc);
                    } else {
                        var href3 = href2;
                    }
                    filetext = filetext.replace(href2, href3);
                }
            }
        }
    }
    return filetext;
}

//将img的src中的ip去掉
function f_ChangImgSrc(html) {
    try {
        var reg = /<IMG[^>]*>/ig; // 创建正则表达式模式。
        var find = html.match(reg);
        for (var u = 0; u < find.length; u++) {
            var fstr = find[u].toString();
            var tempHtml = "";
            var src = fstr.match(/(src=\")([^"]+)(\"[^>]*\>)/g);
            if (src != null) {
                var issrc = src.toString().indexOf('src');
                var tsrc = src.toString().substring(issrc);
                var a = tsrc.toString().substring(5);
                var b = tsrc.toString().substring(5, a.indexOf("\"") + 5);
                var temSrc = b;
                var isHttp = temSrc.indexOf('http://');
                if (isHttp != '-1') {
                    temSrc = temSrc.substring(temSrc.indexOf('/web'));
                    var re = /(src=\")([^"]+)(\"[^>]*\>)/
                    var temfstr = fstr.replace(re, "$1" + temSrc + "$3");
                    html = html.replace(fstr, temfstr);
                }
            }
        }
    } catch(e) {
    }
    return html;
}


//图层定位
function intval(v) {
    v = parseInt(v);
    return isNaN(v) ? 0 : v;
}
// 获取元素信息
function getPos(e) {
    var l = 0;
    var t = 0;
    var w = intval(e.style.width);
    var h = intval(e.style.height);
    var wb = e.offsetWidth;
    var hb = e.offsetHeight;
    while (e.offsetParent) {
        l += e.offsetLeft + (e.currentStyle ? intval(e.currentStyle.borderLeftWidth) : 0);
        t += e.offsetTop + (e.currentStyle ? intval(e.currentStyle.borderTopWidth) : 0);
        e = e.offsetParent;
    }
    l += e.offsetLeft + (e.currentStyle ? intval(e.currentStyle.borderLeftWidth) : 0) - 180;
    t += e.offsetTop + (e.currentStyle ? intval(e.currentStyle.borderTopWidth) : 0) - 180;
    return {x:l, y:t, w:w, h:h, wb:wb, hb:hb};
}
// 获取滚动条信息
function getScroll() {
    var t, l, w, h;
    if (document.documentElement && document.documentElement.scrollTop) {
        t = document.documentElement.scrollTop;
        l = document.documentElement.scrollLeft;
        w = document.documentElement.scrollWidth;
        h = document.documentElement.scrollHeight;
    } else if (document.body) {

        t = document.getElementById('tabPage1').scrollTop;
        l = document.getElementById('tabPage1').scrollLeft;
        w = document.getElementById('tabPage1').scrollWidth;
        h = document.getElementById('tabPage1').scrollHeight;
        //            t = document.body.scrollTop;
        //            l = document.body.scrollLeft;
        //            w = document.body.scrollWidth;
        //            h = document.body.scrollHeight;
    }
    return { t: t, l: l, w: w, h: h };
}
// 锚点(Anchor)间平滑跳转
function scroller(el, duration) {
    if (typeof el != 'object')
    {
        el = document.getElementById(el);
    }
    if (!el) return;
    var z = this;
    z.el = el;
    z.p = getPos(el);
    z.s = getScroll();
    z.clear = function()
    {
        window.clearInterval(z.timer);
        z.timer = null
    };
    z.t = (new Date).getTime();
    z.step = function() {
        var t = (new Date).getTime();
        var p = (t - z.t) / duration;
        if (t >= duration + z.t) {
            z.clear();
            window.setTimeout(function() {
                z.scroll(z.p.y, z.p.x)
            }, 13);
        } else {
            st = ((-Math.cos(p * Math.PI) / 2) + 0.5) * (z.p.y - z.s.t) + z.s.t;
            sl = ((-Math.cos(p * Math.PI) / 2) + 0.5) * (z.p.x - z.s.l) + z.s.l;
            z.scroll(st, sl);
        }
    };
    z.scroll = function (t, l) {
        scrollTo(l, t);
    };
    z.timer = window.setInterval(function() {
        z.step();
    }, 13);
}

function scrollTo(l, t) {
    document.getElementById('tabPage1').scrollTop = t;
}

//图册定位结束

function show(obj) {
    var w,h;
    var k;
    var con;
    w = obj.width;
    h = obj.height;
    //500,440
    k = obj.width / obj.height;
    if (k >= 1) {
        if (obj.width >= 100) {
            obj.width = 600;
            obj.height = obj.width / k;
        }
    } else {
        if (obj.height >= 140) {
            obj.height = 540;
            obj.width = k * obj.height;
        }
    }
}
function bbimg(o) {
    var zoom = parseInt(o.style.zoom, 10) || 100;
    zoom += event.wheelDelta / 12;
    if (zoom < 100) return false;
    if (zoom > 0) o.style.zoom = zoom + '%';
    return false;
}
/**
 * 取得权限按钮  by jiangxiangwei
 */
function getSecurityButton(strJson) {
    var strSecu = "";
    if (strJson == undefined || strJson == "")
        return "";
    if (strJson.length != 0)
        for (var k in strJson)
            strSecu += strJson[k];
    return strSecu;
}
/**
 * 检测是否超时
 */
function checkUserLogin() {
    var xhrArgs = {
        url:"checkUserLogin.do",
        method:"POST",
        callback:[checkUserLoginCallBack]
    };
    taxTools.xhrAjax(xhrArgs);
    xhrArgs = null;
}
function checkUserLoginCallBack(strJson) {
    if (strJson.code == "0") {
        window.location.href = "/error/overtime.htm";
    }
}

/*
*获得前一个页面的字符串值
*/
var request =
   {
       QueryString : function(val)
        {
            var uri = window.location.href;
            var re = new RegExp("" + val + "=([^&?]*)", "ig");
            return ((uri.match(re))?(uri.match(re)[0].substr(val.length + 1)):null);
        },
        QueryStrings : function()
        {
            var uri = window.location.href;
            var re = uri.split('?');
            if (re == null || re[1] == null)
            {
                re = null;
            }
            else
            {
                re = re[1];
                re = re.split('&');
                var temp = '';
                for (var i = 0; i < re.length; i++)
                {
                    if (re[i] != null && re[i].indexOf('src') == -1)
                    {
                        if (temp.length <= 0)
                        {
                            temp += re[i];
                        }
                        else
                        {
                            temp += '&' + re[i];
                        }
                    }
                }
                re = temp;
            }
            return re;
        }
    }

