﻿// JScript 文件
var WebPageParameter = "";
var WorkModuleCurrent = 0;
var WriteHistoryCount = 0;
var PageLoadFinished=null;
var WorkModuleLoadingFlg = null;
var PageMarqueestr = "";
var ModifyMarqueeFlg = "";
var MarqueeFinished = "";
function NoCopy_NoCut() {
    oncontextmenu = "window.event.returnValue=false";
    oncopy = "return false";
    oncut = "return false";
}

function mOvr(src, clrOver) {
    src.style.cursor = "pointer";
    src.className = clrOver;
}

function mOut(src, clrIn) {
    src.className = clrIn;
}

/*
==================================================================
设置一维Cookies的值
==================================================================
*/
function SetCookie(sName, sValue) {
    LoadPageData("GET", "/zzs_admin/WebControl/Cookies/Cookies.aspx?CookiesType=WriteOne&CookiesName=" + sName + "&CookiesValue=" + escape(sValue), "", "", "", "", "", "");
}
/*
==================================================================
设置二维Cookies的值
==================================================================
*/

function SetCookies(sName, sKeyValue, sValue) {
    LoadPageData("GET", "/zzs_admin/WebControl/Cookies/Cookies.aspx?CookiesType=WriteTwo&CookiesName=" + sName + "&CookiesKeyValue=" + sKeyValue + "&CookiesValue=" + escape(sValue), "", "", "", "", "", "");
}
/*
* 函数说明：取cookie值
* 参数：	cookie字段名
* 返回值：	cookie值
* 时间：2006-5-12
*/
function getCookie(sName) {
    var aCookie = document.cookie.split("; ");
    for (var i = 0; i < aCookie.length; i++) {
        var aCrumb = aCookie[i].split("=");
        if (sName == aCrumb[0]) {
            return aCrumb[1]?unescape(aCrumb[1]):"";
        }
    }
    return null;
}
/*
==================================================================
取二维Cookies的值
==================================================================
*/
function getCookies(sName, sKeyValue) {
    var aCookie = document.cookie.split("; ");
    for (var i = 0; i < aCookie.length; i++) {
        var aCrumb = aCookie[i].split("=");
        if (sName == aCrumb[0]) {
            var MyCookieArr = decodeURI(aCookie[i]).replace((sName + "="), "").split("&");
            for (var j = 0; j < MyCookieArr.length; j++) {
                var CookieTemp = MyCookieArr[j];
                var ArrCookieTemp = CookieTemp.split("=");
                if (sKeyValue == ArrCookieTemp[0]) {
                    return unescape(ArrCookieTemp[1]);
                    break;
                }
            }
        }
    }
    return null;
}

function clearCookies(sName) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    document.cookie = sName + "=" + escape("") + "; expires=" + exp.toGMTString();
}


function checkSensitiveWords(content) {
    if (content == null || trim(content) == "") return "";
    var wordsArrays = new Array();
    wordsArrays[0] = new Array(";", "；", "*", "|", "$", "^");
    wordsArrays[1] = new Array("●", "▲", "■", "◎", "★", "※", "〓", "§", "☆", "○", "◇", "◆", "□", "△", "＾");

    for (var k = 0; k < wordsArrays.length; k++) {
        var wordsArray = wordsArrays[k];
        var len = wordsArray.length;
        for (var i = 0; i < len; i++) {
            if (content.indexOf(wordsArray[i]) != -1) {
                return wordsArray[i];
            }
        }
    }
    return "";
}

function DisableCopy(Obj) {
    var Explorer = GetWebExplorer();
    if (Explorer == "MSIE") {
        document.onselectstart = new Function("return false");
    } else {
        // firefox下禁止元素被选取的变通办法
        Obj.onmousedown = new Function("return false");
        Obj.onmouseup = new Function("return true");
    }
}

/*
==================================================================
Trim(string):去除前后空格
==================================================================
*/
function trim(value) {
    return value.replace(/(^\s*)|(\s*$)/g, "");
}

/*
==================================================================
初始化焦点设置
==================================================================
*/
function setfocus(setobject) {
    setobject.focus();
}
/*
==================================================================
页面转向
==================================================================
*/
function PageTransfer(url, targetMod, FunParameter, IframFlg) {
    var NewUrl = "";
    if (url.indexOf("?") > 0) {
        NewUrl = url + "&randnum=" + Math.random();
    }
    else {
        NewUrl = url + "?randnum=" + Math.random();
    }

    if (targetMod != null && targetMod != "") {
        if (targetMod == "_blank") {
            open(NewUrl);
        }
    }
    else {
        if (IframFlg != "") {
            location.href = NewUrl;
        }
        else {
            parent.WinContent.location.href = NewUrl;
        }
    }
}

/*
==================================================================
通过url传值设置某ID的值
sType 当值为Val时返回值,当为Doc时给对像赋值
==================================================================
*/

function SetElementObjValue(sElementID, sType) {
    var str = location.href.toString().toLowerCase();
    var num = str.indexOf("?");
    if (num > 0) {
        strtemp = str.split("?")[1];
        var arrtmp = strtemp.split("&");
        for (i = 0; i < arrtmp.length; i++) {
            var arrtmpi = arrtmp[i];
            num = arrtmpi.indexOf("=");

            if (num > 0) {
                if ((arrtmpi.split("=")[0]).toLowerCase() == (sElementID).toLowerCase()) {
                    if (sType == "Val")
                        return arrtmpi.split("=")[1];
                    else
                        document.getElementById(sElementID).value = (arrtmpi.split("=")[1]);
                    break;
                }
            }
            else {
                if (sType == "Val")
                    return "";
                else
                    document.getElementById(sElementID).value = 0;
            }
        }
    }
    else {
        if (sType == "Val")
            return "";
        else
            document.getElementById(sElementID).value = 0;
    }
}

function GetQueryString(queryStringName) {
    var query = window.location.search;
    var iLen = queryStringName.length;
    var iStart = query.indexOf(queryStringName);
    if (iStart == -1) return "";
    iStart += iLen + 1;
    var iEnd = query.indexOf("&", iStart);
    if (iEnd == -1) return query.substring(iStart);
    return query.substring(iStart, iEnd);
}

function GetUrlQueryString(queryStringName, UrlValue) {
    var returnValue = "";
    var URLString = new String(UrlValue);
    var serachLocation = -1;
    var queryStringLength = queryStringName.length;
    do {
        serachLocation = URLString.indexOf(queryStringName + "\=");
        if (serachLocation != -1) {
            if ((URLString.charAt(serachLocation - 1) == '?') || (URLString.charAt(serachLocation - 1) == '&')) {
                URLString = URLString.substr(serachLocation); break;
            }
            URLString = URLString.substr(serachLocation + queryStringLength + 1);
        }
    }
    while (serachLocation != -1)
    if (serachLocation != -1) {
        var seperatorLocation = URLString.indexOf("&");
        if (seperatorLocation == -1) {
            returnValue = URLString.substr(queryStringLength + 1);
        }
        else {
            returnValue = URLString.substring(queryStringLength + 1, seperatorLocation);
        }
    }
    return returnValue;
}

/*
==================================================================
检查Email输入是否合法
==================================================================
*/
function boolEmail(str_email) {

    var myregEmali = /^([\.\w-]){3,}@([\w-]){2,}(\.([\w]){2,4}){1,2}$/;
    if (myregEmali.test(str_email)) {
        return false;
    } else {
        return true; //无效的Email格式
    }
}

/*
==================================================================
判断输入数字,负数,小数,整数,最多20位
==================================================================
*/
function isDigit(s) {
    var patrn = /(^-?\d\d*\.\d{1,20}$)|(^-?\d\d{1,20}$)|(^-?\.\d\d{1,20}$)|(^[0-9]{1,20}$)/;
    if (!patrn.exec(s)) {
        return false;
    }
    return true;
}
/*
==================================================================
判断输入是否为电话号码
==================================================================
*/
function isTell(s) {
    var patrn = /(^(\(\d{3,4}\)|\d{3,4}-)?\d{7,8}$)/;
    if (!patrn.exec(s))
        return false;
    return true;
}

function isURL(str_url) {
    var strRegex = "^((https|http|ftp|rtsp|mms)?://)"
      + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@ 
      + "(((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)" // IP形式的URL- 199.194.52.184 
      + "|" // 允许IP和DOMAIN（域名）
      + "([0-9a-z_!~*'()-]+\.)*" // 域名- www. 
      + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名 
      + "[a-z]{2,6})" // first level domain- .com or .museum 
      + "(:[0-9]{1,4})?" // 端口- :80 
      + "((/?)|" // a slash isn't required if there is no file name 
      + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";

    var re = new RegExp(strRegex);

    if (re.test(str_url))
        return false;
    return true;
}

/*
==================================================================
判断输入是否为手机号码
==================================================================
* 中国移动拥有号码段为:139,138,137,136,135,134,159,158,157(3G),151,150,188(3G),187(3G);13个号段
* 中国联通拥有号码段为:130,131,132,156(3G),186(3G),185(3G);6个号段
* 中国电信拥有号码段为:133,153,189(3G),180(3G);4个号码段
*/
function isMobile(s) {
    var patrn = /(^0?(130|131|132|133|134|135|136|137|138|139|150|151|153|156|157|158|159|185|186|187|188|189)(\d){8}$)/;
    if (!patrn.exec(s))
        return false;
    return true;
}

/*
==================================================================
判断输入是否为颜色代码
==================================================================
*/

function isColor(s) {
    var patrn = /^#?[0-9|a-f|A-F]{6}$/;
    if (!patrn.exec(s))
        return false;
    return true;
}


/*
==================================================================
判断日期格式是否正确
==================================================================
*/

function isTime(str) {
    var reg = /^([1-9]{1}[\d]{3})-([\d]{1,2})-([0-4]{0,1}[\d]{1}) ([\d]{1,2}):([\d]{1,2}):([\d]{1,2})$/;
    var r = str.match(reg);
    if (r == null) return false;
    return true;
}

function StringToDate(DateStr) {
    var reg = /^([1-9]{1}[\d]{3})-([\d]{1,2})-([0-4]{0,1}[\d]{1}) ([\d]{1,2}):([\d]{1,2}):([\d]{1,2})$/;
    var r = DateStr.match(reg);
    if (r == null) return false;
    r[2] = r[2] - 1;
    var d = new Date(r[1], r[2], r[3], r[4], r[5], r[6]);
    return d;
}

function isIdCardNo(num) {
    num = num.toUpperCase();
    if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {
        alert('输入的身份证号长度不对，或者号码不符合规定！\n15位号码应全为数字，18位号码末位可以为数字或X。');
        return false;
    }
    var len, re;
    len = num.length;
    if (len == 15) {
        re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/);
        var arrSplit = num.match(re);
        var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]);
        var bGoodDay;
        bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
        if (!bGoodDay) {
            alert('输入的身份证号里出生日期不对！');
            return false;
        }
        else {
            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
            var nTemp = 0, i;
            num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6);
            for (i = 0; i < 17; i++) {
                nTemp += num.substr(i, 1) * arrInt;
            }
            num += arrCh[nTemp % 11];
            return num;
        }
    }
    if (len == 18) {
        re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
        var arrSplit = num.match(re);
        var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]);
        var bGoodDay;
        bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
        if (!bGoodDay) {
            alert(dtmBirth.getYear());
            alert(arrSplit[2]);
            alert('输入的身份证号里出生日期不对！');
            return false;
        }
        else {
            var valnum;
            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
            var nTemp = 0, i;
            for (i = 0; i < 17; i++) {
                nTemp += num.substr(i, 1) * arrInt;
            }
            valnum = arrCh[nTemp % 11];
            if (valnum != num.substr(17, 1)) {
                alert('18位身份证的校验码不正确！应该为：' + valnum);
                return false;
            }
            return num;
        }
    }
    return false;
}

function GetWebExplorer() {
    if (navigator.userAgent.indexOf("MSIE") > 0) {
        return "MSIE";
    }
    if (navigator.userAgent.indexOf("Firefox") > 0) {
        return "Firefox";
    }
    if (navigator.userAgent.indexOf("Safari") > 0) {
        return "Safari";
    }
    if (navigator.userAgent.indexOf("Camino") > 0) {
        return "Camino";
    }
    if (navigator.userAgent.indexOf("Gecko/") > 0) {
        return "Gecko";
    }
}

function FullSceen() {
    top.moveTo(0, 0);
    top.resizeTo(screen.availWidth, screen.availHeight);
}

function changDivStyleBorderColor(Obj, BorderValue) {
    document.getElementById(Obj.id).style.border = BorderValue;
}

function SetInputBlankValue(ObjID) {
    document.getElementById(ObjID).value = "";
}
function changDivStyleBgColor(Obj, BorderValue) {
    document.getElementById(Obj.id).style.backgroundColor = BorderValue;
}

/* ---------------------------- RGB转换为16进制 开始 --------------------------- */
function RGBtoHex(rgb) {
    var arrRgb = new Array();
    var newRgb = "";
    var r, g, b;
    var color = "";

    // 分割rgb格式并获得红、绿、蓝赋值给arrRgb数组
    if (rgb.indexOf("rgb") != -1) {
        newRgb = rgb.substring(4, rgb.length - 1);
        arrRgb = newRgb.split(",");

        if (arrRgb.length > 2) {
            r = arrRgb[0];
            g = arrRgb[1];
            b = arrRgb[2];
        }
        // 转换为16进制
        r = Math.max(0, r)
        r = Math.min(255, r)
        g = Math.max(0, g)
        g = Math.min(255, g)
        b = Math.max(0, b)
        b = Math.min(255, b)

        rgb = "#" + this.toHex(r) + this.toHex(g) + this.toHex(b);
    }

    return rgb;
}

function toHex(N) {
    N = Math.max(0, N)
    N = Math.min(255, N)
    return "0123456789ABCDEF".charAt((N - N % 16) / 16) + "0123456789ABCDEF".charAt(N % 16)
}
/* --------------------------------------- RGB转换为16进制 结束 ------------------------- */


function disableAll(s) {
    for (i = 0; i < s.split(',').length - 1; i++) {
        var Obj = document.getElementById(s.split(',')[i]);
        if (Obj != null && Obj != "null") {
            Obj.disabled = "disabled";
        }
    }
}

function undisableAll(s) {
    for (i = 0; i < s.split(',').length - 1; i++) {
        var Obj = document.getElementById(s.split(',')[i]);
        if (Obj != null && Obj != "null") {
            Obj.disabled = "";
        }
    }
}

function ClearInnerHtml(s) {
    for (i = 0; i < s.split(',').length - 1; i++) {
        var Obj = document.getElementById(s.split(',')[i]);
        if (Obj != null && Obj != "null") {
            Obj.innerHTML = "";
        }
    }
}

function IncludeJS(FilePath, FileTyel, ScrId) {
    if (FilePath != null && FilePath != "null") {
        var oHead = parent.window.document.getElementsByTagName('HEAD').item(0);
        if (oHead != null && oHead != "null" && oHead != "") {
            var oScript;
            switch (FileTyel.toLowerCase()) {
                case "js":
                    {
                        oScript = parent.window.document.createElement("script");
                        oScript.language = "javascript";
                        oScript.type = "text/javascript";
                        oScript.src = FilePath;
                        break;
                    }
                case "css":
                    {
                        oScript = parent.window.document.createElement("link");
                        oScript.rel = "stylesheet";
                        oScript.type = "text/css";
                        oScript.href = FilePath;
                        break;
                    }
                default:
                    {
                        oScript = parent.window.document.createElement("script");
                        oScript.language = "javascript";
                        oScript.type = "text/javascript";
                        oScript.src = FilePath;
                        break;
                    }
            }
            if (ScrId != null && ScrId != "null") {
                oScript.id = ScrId;
                var ScrIdObj = parent.window.document.getElementById(ScrId);
                if (ScrIdObj != null && ScrIdObj.parentNode != null && ScrIdObj != "null") {
                    ScrIdObj.parentNode.removeChild(ScrIdObj);
                }
            }
            oHead.appendChild(oScript);
        }
    }
}

function CreatStyleCssContent(Content, ScrId) {
    var WebExplorer = parent.GetWebExplorer();
    var oStyle;
    if (Content != null && Content != "null") {
        var aSheet = parent.top.document.styleSheets;
        if (aSheet != null && aSheet != "null" && aSheet != "") {
            if (!aSheet) {
                if (WebExplorer == "MSIE") {
                    oStyle = parent.top.document.createStyleSheet();
                    oStyle.cssText = Content;
                }
                else {
                    var oHead = parent.top.document.getElementsByTagName('HEAD').item(0);
                    if (oHead != null && oHead != "null" && oHead != "") {
                        oStyle = parent.top.document.createElement("style");
                        oStyle.type = "text/css";
                        if (ScrId != null && ScrId != "null") {
                            oStyle.id = ScrId;
                            var ScrIdObj = parent.top.document.getElementById(ScrId);
                            if (ScrIdObj != null && ScrIdObj.parentNode != null && ScrIdObj != "null") {
                                ScrIdObj.parentNode.removeChild(ScrIdObj);
                            }
                        }
                        oStyle.innerHTML = Content;
                        oHead.appendChild(oStyle);
                    }
                }
            }
            else {
                var cssWrite = true;
                if (WebExplorer == "MSIE") {
                    for (var i = 0; i < aSheet.length; i++) {
                        if (aSheet[i].cssText.length + Content.length < 130000) {
                            aSheet[i].cssText = aSheet[i].cssText + Content;
                            cssWrite = false;
                            break;
                        }
                    }
                    if (cssWrite) {
                        oStyle = parent.top.document.createStyleSheet();
                        oStyle.cssText = Content;
                    }
                }
                else {
                    aStyle = document.getElementsByTagName("style");
                    if (aStyle != null && aStyle != "null" && aStyle != "") {
                        for (var i = 0; i < aStyle.length; i++) {
                            if (aStyle[i].innerHTML.length + Content.length < 130000) {
                                aStyle[i].innerHTML = aStyle[i].innerHTML + Content;
                                cssWrite = false;
                                break;
                            }
                        }
                        if (cssWrite) {
                            var oHead = parent.top.document.getElementsByTagName('HEAD').item(0);
                            if (oHead != null && oHead != "null" && oHead != "") {
                                oStyle = parent.top.document.createElement("style");
                                oStyle.type = "text/css";
                                if (ScrId != null && ScrId != "null") {
                                    oStyle.id = ScrId;
                                    var ScrIdObj = parent.top.document.getElementById(ScrId);
                                    if (ScrIdObj != null && ScrIdObj.parentNode != null && ScrIdObj != "null") {
                                        ScrIdObj.parentNode.removeChild(ScrIdObj);
                                    }
                                }
                                oStyle.innerHTML = Content;
                                oHead.appendChild(oStyle);
                            }
                        }
                    }
                }
            }
        }
    }
}

function IncludeSelfJS(FilePath, FileTyel, ScrId) {
    if (FilePath != null && FilePath != "null") {
        var oHead = document.getElementsByTagName('HEAD').item(0);
        var oScript;
        if (oHead != null && oHead != "null" && oHead != "") {
            switch (FileTyel.toLowerCase()) {
                case "js":
                    {
                        oScript = document.createElement("script");
                        oScript.language = "javascript";
                        oScript.type = "text/javascript";
                        oScript.src = FilePath;
                        break;
                    }
                case "css":
                    {
                        oScript = document.createElement("link");
                        oScript.rel = "stylesheet";
                        oScript.type = "text/css";
                        oScript.href = FilePath;
                        break;
                    }
                default:
                    {
                        oScript = document.createElement("script");
                        oScript.language = "javascript";
                        oScript.type = "text/javascript";
                        oScript.src = FilePath;
                        break;
                    }
            }
            if (ScrId != null && ScrId != "null") {
                oScript.id = ScrId;
                var ScrIdObj = document.getElementById(ScrId);
                if (ScrIdObj != null && ScrIdObj.parentNode != null && ScrIdObj != "null") {
                    ScrIdObj.parentNode.removeChild(ScrIdObj);
                }
            }
            oHead.appendChild(oScript);
        }
    }
    FunctionFlg = false;
}

IncludeSelfJS("/javascript/JsHackJScript.js", "JS", "JsHack");
IncludeSelfJS("/javascript/Md5JScript.js", "JS", "MD5");

function jsRandomFun(CountBit) {
    var randnum = Math.random();
    if (CountBit != null && CountBit != "") {
        var k = 1;
        for (var i = 0; i < CountBit; i++) {
            k = k * 10;
        }
        return parseInt(randnum * k);
    }
    else {
        return randnum;
    }
}

var getHost = function(url) {
    var host = "null";
    if (typeof url == "undefined" || null == url) {
        url = window.location.href;
    }
    var regex = /.*\:\/\/([^\/]*).*/;
    var match = url.match(regex);
    if (typeof match != "undefined" && null != match) {
        host = match[1];
    }
    return host;
}

function WriteViewCookies() {
    window.onload;
    var strUrl = document.location.href;
    var zzsSiteInfo_ID = getCookies("zzsSiteInfo", "UploadeDir");
    if (zzsSiteInfo_ID == null || zzsSiteInfo_ID == "null" || zzsSiteInfo_ID == "") {
        top.location.href = "http://" + getHost(strUrl) + "?OldUrl=" + escape(strUrl);
    }
    else {
        var ViewerObj_ID = getCookies("ViewerObj", "ID");
        if (ViewerObj_ID == null || ViewerObj_ID == "null" || ViewerObj_ID == "") {
            var DateObj = new Date();
            var sValue = (DateObj.getMonth() + 1).toString() + DateObj.getDate().toString() + DateObj.getHours().toString() + DateObj.getMinutes().toString() + jsRandomFun(5);
            SetCookies("ViewerObj", "ID", sValue);
        }
        setIntervalCookiesObj = setInterval(WriteViewPage, 200);
    }
} 

function WriteViewPage() {
    var ViewerObj_ID = getCookies("ViewerObj", "ID");
    var URLString = new String(document.location);
    if (ViewerObj_ID != null && ViewerObj_ID != "null" && ViewerObj_ID != "") {
        clearInterval(setIntervalCookiesObj);
        var WebPagePath = "";
        if (document.getElementById("WebPagePath") != null) {
            WebPagePath = document.getElementById("WebPagePath").innerHTML;
            if (WriteHistoryCount == 0 && WebPagePath!="") {
                WriteHistoryCount = 1;
                LoadPageData("GET", "/zzs_admin/WebControl/Cookies/PageViewHistory.aspx?WebPagePath=" + escape(WebPagePath) + "&URLString=" + escape(URLString), "", "", "", "", "", "");
            }
        }
    }
}

function SetCookiesWebPageEdit() {
    var CWebViewState = getCookie("WebViewState");
    if (CWebViewState != "Edit") {
        SetCookie("WebViewState", "Edit");
    }
}

function SetCookiesWebPageView() {
    var CWebViewState = getCookie("WebViewState");
    if (CWebViewState != "View") {
        SetCookie("WebViewState", "View");
    }
}

function getStyle(oElm, strCssRule) {
    var strValue = "";
    if (document.defaultView && document.defaultView.getComputedStyle) {
        strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
    }
    else if (oElm.currentStyle) {
        strCssRule = strCssRule.replace(/\-(\w)/g, function(strMatch, p1) {
            return p1.toUpperCase();
        });
        strValue = oElm.currentStyle[strCssRule];
    }
    return strValue;
}

function GetMaxzIndex() {
    var DivObj = top.document.getElementsByTagName("div");
    var zIndexValue = "0";
    for (var i = 0; i < DivObj.length; i++) {
        if (DivObj[i] != null && DivObj[i] != "null") {
            var TempZIndexValue = parseInt(getStyle(DivObj[i], "z-index"));
            if (parseInt(TempZIndexValue) > parseInt(zIndexValue)) {
                zIndexValue = TempZIndexValue;
            }
        }
    }
    if ((zIndexValue.toLocaleString()).toLowerCase() == "auto" || zIndexValue.toLocaleString() == "") {
        zIndexValue = 1;
    }
    return parseInt(zIndexValue);
}

/////////////////////////////////////////////////
//模块添加步骤控制函数
/////////////////////////////////////////////////
var GoToStepSaveSubmitValue = "";
var GoToStepOldSubmitValue = "";
function GoToStep(NowShowDIV, StepDIV) {
    //初始化数据

    var WorkModuleSubmitObj = document.getElementById("WorkModuleSubmit");
    var IframeObj = top.document.getElementById("WorkModuleConfig").contentWindow;
    var NewStepInnerHTMLObj = document.getElementById("NewStepInnerHTML");
    if (NewStepInnerHTMLObj != null && NewStepInnerHTMLObj.parentNode != null && NewStepInnerHTMLObj != "null") {
        NewStepInnerHTMLObj.parentNode.removeChild(NewStepInnerHTMLObj);
    }
    if (GoToStepOldSubmitValue == "") {
        GoToStepOldSubmitValue = WorkModuleSubmitObj.innerHTML;
    }
    if (GoToStepSaveSubmitValue == "") {
        GoToStepSaveSubmitValue = WorkModuleSubmitObj.innerHTML;
    }

    if (WorkModuleSubmitObj != null && WorkModuleSubmitObj != "null" && IframeObj != null && IframeObj != "null") {
        if (WorkModuleSubmitObj != null && WorkModuleSubmitObj != "null") {
            var ButtomHtml = "";
            if (NowShowDIV != "") {
                var NowShowDIVObj = IframeObj.document.getElementById(NowShowDIV);
                if (NowShowDIVObj != null && NowShowDIVObj != "null" && StepDIV != null && StepDIV != "") {
                    var ArrayStepDIV = StepDIV.split(",");
                    var IntCurrent = "";
                    var CurrentLastDiv = "";
                    var CurrentNextDiv = "";
                    NowShowDIVObj.style.display = "block";
                    for (var i = 0; i < ArrayStepDIV.length; i++) {
                        var StepDIVObj = IframeObj.document.getElementById(ArrayStepDIV[i]);
                        if (StepDIVObj != null && StepDIVObj != "null") {
                            StepDIVObj.style.display = "none";
                            if (StepDIVObj.id == NowShowDIV) {
                                IntCurrent = i;
                                StepDIVObj.style.display = "block";
                            }
                        }
                    }
                    if (ArrayStepDIV[IntCurrent - 1] != null && ArrayStepDIV[IntCurrent - 1] != "") {
                        CurrentLastDiv = ArrayStepDIV[IntCurrent - 1];
                    }
                    if (ArrayStepDIV[IntCurrent + 1] != null && ArrayStepDIV[IntCurrent + 1] != "") {
                        CurrentNextDiv = ArrayStepDIV[IntCurrent + 1];
                    }

                    if (CurrentLastDiv != "") {
                        var CurrentLastFunctionDivObj = IframeObj.document.getElementById(CurrentLastDiv + "Function");
                        var CurrentLastFunction = "";
                        if (CurrentLastFunctionDivObj != null && CurrentLastFunctionDivObj != "null") {
                            if (CurrentLastFunctionDivObj.value != "") {
                                CurrentLastFunction = CurrentLastFunctionDivObj.value;
                                do {
                                    CurrentLastFunction = CurrentLastFunction.replace("IframObj.", "top.document.getElementById('WorkModuleConfig').contentWindow.");
                                }
                                while (CurrentLastFunction.indexOf("IframObj.") >= 0);
                                do {
                                    CurrentLastFunction = CurrentLastFunction.replace("zzs", "");
                                }
                                while (CurrentLastFunction.indexOf("zzs") >= 0);
                            }
                        }
                        if (CurrentLastFunction != "") {
                            CurrentLastFunction = CurrentLastFunction;
                        }
                        else {
                            CurrentLastFunction = "GoToStep('" + CurrentLastDiv + "','" + StepDIV + "');";
                        }
                        ButtomHtml += "<input type=\"button\" value=\"<上一步\" style=\"width:80px;cursor:pointer;\" onclick=\"" + CurrentLastFunction + "\" />";
                    }

                    if (CurrentNextDiv != "") {
                        var CurrentNextDivFunctionObj = IframeObj.document.getElementById(CurrentNextDiv + "Function");
                        var CurrentNextDivFunction = "";
                        if (CurrentNextDivFunctionObj.value != "") {
                            CurrentNextDivFunction = CurrentNextDivFunctionObj.value;
                            do {
                                CurrentNextDivFunction = CurrentNextDivFunction.replace("IframObj.", "top.document.getElementById('WorkModuleConfig').contentWindow.");
                            }
                            while (CurrentNextDivFunction.indexOf("IframObj.") >= 0);
                            do {
                                CurrentNextDivFunction = CurrentNextDivFunction.replace("zzs", "");
                            }
                            while (CurrentNextDivFunction.indexOf("zzs") >= 0);
                        }
                        if (CurrentNextDivFunction != "") {
                            CurrentNextDivFunction = CurrentNextDivFunction;
                        }
                        else {
                            CurrentNextDivFunction = "GoToStep('" + CurrentNextDiv + "','" + StepDIV + "');";
                        }
                        ButtomHtml += "<input type=\"button\" value=\"下一步>\" style=\"width:80px;cursor:pointer;\" onclick=\"" + CurrentNextDivFunction + "\" />";
                    }
                    else {
                        if (GoToStepSaveSubmitValue != "") {
                            ButtomHtml += GoToStepSaveSubmitValue;
                        }
                    }
                    ButtomHtml += "<div id=\"NewStepInnerHTML\" style=\"display:none;width:0px;height:0px;overflow:hidden\"></div>";
                }
            }
            else {
                var ArrayStepDIV = StepDIV.split(",");
                for (var i = 0; i < ArrayStepDIV.length; i++) {
                    if (ArrayStepDIV[i] != "") {
                        var StepDIVObj = IframeObj.document.getElementById(ArrayStepDIV[i]);
                        if (StepDIVObj != null && StepDIVObj != "null") {
                            StepDIVObj.style.display = "none";
                        }
                    }
                }
                ButtomHtml = GoToStepOldSubmitValue;
            }
            WorkModuleSubmitObj.innerHTML = ButtomHtml;
        }
    }
}

/////////////////////////////////////////////////////
//模块列宽调整函数及列数调整函数
IncludeSelfJS("/javascript/zzs_admin/Content/WebControl/WebEdit/TuneUpModuleStyle.js", "JS", "JsTuneUpModuleStyle");
IncludeSelfJS("/Function/Marquee/MSClass.js", "JS", "Marquee");
function GetObjOuterHtml(ObjID) {
    var RomDivID = parseInt(Math.random() * 100000);
    var DivNewTempStartObj = document.createElement("div");
    DivNewTempStartObj.id = "Start" + RomDivID;
    DivNewTempStartObj.style.display = "none";
    DivNewTempStartObj.innerHTML = "DivNewTempStart";

    var DivNewTempEndObj = document.createElement("div");
    DivNewTempEndObj.id = "End" + RomDivID;
    DivNewTempEndObj.style.display = "none";
    DivNewTempEndObj.innerHTML = "DivNewTempEnd";

    var f_mainParentObj = document.getElementById(ObjID).parentNode;
    var CurentObj = document.getElementById(ObjID);
    var ObjIDOuterHtml = "";
    if (f_mainParentObj != null && f_mainParentObj != "null") {
        f_mainParentObj.insertBefore(DivNewTempStartObj, CurentObj);

        if (CurentObj != null && CurentObj != "null") {
            insertAfter(DivNewTempEndObj, CurentObj);
        }
        var Tempf_mainParentObjInnerHtml = f_mainParentObj.innerHTML;

        var ObjIDOuterHtmlTemp = Tempf_mainParentObjInnerHtml.split("DivNewTempStart")[1];
        ObjIDOuterHtmlTemp = ObjIDOuterHtmlTemp.split("DivNewTempEnd")[0];

        var WebExplorer = GetWebExplorer();
        var ArrayTemp;
        switch (WebExplorer) {
            case "MSIE":
                {
                    ArrayTemp = ObjIDOuterHtmlTemp.split("</DIV>");

                    break;
                }
            default:
                {
                    ArrayTemp = ObjIDOuterHtmlTemp.split("</div>");
                    break;
                }
        }
        for (var i = 1; i < ArrayTemp.length; i++) {
            ObjIDOuterHtml += ArrayTemp[i] + "</div>";
        }

        f_mainParentObj.removeChild(document.getElementById("Start" + RomDivID));
        f_mainParentObj.removeChild(document.getElementById("End" + RomDivID));
    }
    return ObjIDOuterHtml;
}

function insertAfter(newElement, targetElement) {
    var parent = targetElement.parentNode;
    if (parent.lastChild == targetElement) {
        parent.appendChild(newElement);
    }
    else {
        parent.insertBefore(newElement, targetElement.nextSibling);
    }
}

function GetHeight(LoadDataID) {
    document.getElementById(LoadDataID).style.display = "block";
}
function SetLoadDataIDHeight(LoadDataID) {
    document.getElementById(LoadDataID).style.height = "auto";
}

function LoginAdmin() {
    top.location.href = "/zzs_admin/";
}

function GetObjTRBL(obj) {
    var outObj = new Object();
    var OldObj = obj;
    var objLeft = 0;
    var objTop = 0;
    outObj.left = outObj.right = outObj.top = outObj.bottom = 0;

    if (obj != null && obj != "null") {
        var ComeObj = obj;
        while (obj != document.body && obj != null && typeof (obj.offsetParent) == "object" && obj != "null") {
            var ObjBorderTopWidth = 0;
            if (obj.style.borderTopWidth == "medium") {
                ObjBorderTopWidth = 4;
            }
            else if (obj.style.borderTopWidth == "") {
                ObjBorderTopWidth = 0;
            }
            else {
                ObjBorderTopWidth = parseInt(obj.style.borderTopWidth);
            }

            var ObjBorderLeftWidth = 0;
            if (obj.style.borderLeftWidth == "medium") {
                ObjBorderLeftWidth = 4;
            }
            else if (obj.style.borderLeftWidth == "") {
                ObjBorderLeftWidth = 0;
            }
            else {
                ObjBorderLeftWidth = parseInt(obj.style.borderLeftWidth);
            }

            if (obj != ComeObj) {
                objLeft += parseInt(obj.offsetLeft) + ObjBorderLeftWidth;
                objTop += parseInt(obj.offsetTop) + ObjBorderTopWidth;
            }
            else {
                objLeft += parseInt(obj.offsetLeft);
                objTop += parseInt(obj.offsetTop);
            }
            obj = obj.offsetParent;
        }
        outObj.left = parseInt(objLeft);
        outObj.top = parseInt(objTop);
        if (OldObj != null && OldObj != "null") {
            outObj.bottom = parseInt(outObj.top) + parseInt(OldObj.offsetHeight);
            outObj.right = parseInt(outObj.left) + parseInt(OldObj.offsetWidth);
        }
        else {
            outObj.bottom = parseInt(outObj.top);
            outObj.right = parseInt(outObj.left);
        }
    }
    return outObj;
}

function DelEditPic(Obj, FloatTop, FloatRight, FloatBottom, FloatLeft, DisNID, DisNType, e) {
    var EditPicDivObj = document.getElementById(DisNID);
    if (Obj != null) {
        e = e || event;
        var x = e.clientX + document.documentElement.scrollLeft;
        var y = e.clientY + document.documentElement.scrollTop;
        var ObjLeft = GetObjTRBL(Obj).left + FloatLeft;
        var ObjRight = GetObjTRBL(Obj).right + FloatRight;
        var ObjTop = GetObjTRBL(Obj).top + FloatTop;
        var ObjBottom = GetObjTRBL(Obj).bottom + FloatBottom;
        if (x - ObjLeft <= 0 || x - ObjRight >= 0 || y - ObjTop <= 0 || y - ObjBottom >= 0) {
            if (EditPicDivObj != null && EditPicDivObj != "") {
                function CheckThisFun() {
                    var NewEditPicDivObj = document.getElementById(DisNID);
                    if (NewEditPicDivObj == null || NewEditPicDivObj.style.display == "none") {
                        clearInterval(interval);
                    }
                    EditPicDivObj.style.display = "none";
                    if (DisNType.toLowerCase() == "del") {
                        if (EditPicDivObj != null && EditPicDivObj.parentNode != null) {
                            EditPicDivObj.parentNode.removeChild(EditPicDivObj);
                        }
                    }
                }
                var interval = setInterval(CheckThisFun, 10);
            }
        }
    }
    else {
        if (EditPicDivObj != null && EditPicDivObj != "") {
            function CheckThisFun() {
                var NewEditPicDivObj = document.getElementById(DisNID);
                if (NewEditPicDivObj == null || NewEditPicDivObj.style.display == "none") {
                    clearInterval(interval);
                }
                EditPicDivObj.style.display = "none";
                if (DisNType.toLowerCase() == "del") {
                    if (EditPicDivObj != null && EditPicDivObj.parentNode != null) {
                        EditPicDivObj.parentNode.removeChild(EditPicDivObj);
                    }
                }
            }
            var interval = setInterval(CheckThisFun, 10);
        }
    }
}

//文件下载
function DownFileFun(strFile, WebType) {
    if (strFile != null && strFile != "null" && strFile != "") {
        if (WebType == "Web") {
            top.location.href = strFile;
        }
        else {
            var DownObj = document.getElementById("DownFileDivBody");
            if (DownObj != null && DownObj.parentNode != null) {
                DownObj.parentNode.removeChild(DownObj);
            }
            var strHtml = "";
            strHtml += "<div><iframe id=\"DownFileFram\" name=\"DownFileFram\" src=\"javascript:false;\" scrolling=\"no\" frameborder=\"0\" style=\"display:block; top:0px; left:0px; width:0px;height:0px;\"></iframe></div>";

            var CreatDownObj = document.createElement("div");
            CreatDownObj.id = "DownFileDivBody";
            CreatDownObj.style.width = "0px";
            CreatDownObj.style.height = "0px";
            CreatDownObj.style.display = "none";
            CreatDownObj.innerHTML = strHtml;
            document.body.appendChild(CreatDownObj);

            var IframeObj = document.getElementById("DownFileFram");
            if (IframeObj != null && IframeObj != "null") {
                top.DownFileFram.location.href = "/zzs_admin/WebControl/ReadModule/DownFile.aspx?strFile=" + escape(strFile);
            }
        }
    }
}

function OpAddFun(Obj) {
    var WebViewStateValue = getCookie("WebViewState");
    if (WebViewStateValue == "Edit" && AdDragState != "disabled") {
        var TADID = "ADSys" + Obj.id;
        var TADIDObj = document.getElementById(TADID);
        AdDragID = TADID;
        if (TADIDObj == null) {
            var CreatObj = document.createElement("div");
            CreatObj.id = TADID;
            CreatObj.style.position = "absolute";
            CreatObj.style.backgroundColor = "#FF0000";
            CreatObj.style.width = 105 + "px";
            CreatObj.style.height = 28 + "px";
            CreatObj.style.border = "2px solid #CCCCCC";
            CreatObj.style.top = GetObjTRBL(Obj).top + "px";
            CreatObj.style.left = (GetObjTRBL(Obj).right - 109) + "px";
            CreatObj.style.display = "block";
            CreatObj.innerHTML = "<div style=\"text-align:right;width:105px; height:28px;\"><img src=\"/Style/zzs_admin/Image/WebCss/DragLogo.gif\" width=\"105px\" height=\"28px\"/></div>";
            Obj.parentNode.insertBefore(CreatObj, Obj);
        }
        else {
            TADIDObj.style.top = GetObjTRBL(Obj).top + "px";
            TADIDObj.style.left = (GetObjTRBL(Obj).right - 109) + "px";
        }
    }
}

var setIntervalMarquee = null;
function LoadMarquee(ScrollContent, ScrollDirection, ScrollStep, ScrollWidth, ScrollHeight, ScrollTimer, ScrollDelayTime, ScrollWaitTime, ScrollWaitStep) {
    if (MarqueeFinished == "Finished") {
        if (setIntervalMarquee != null) {
            clearInterval(setIntervalMarquee);
            setIntervalMarquee = null;
        }
        if (PageMarqueestr.indexOf(ScrollContent + ",") == -1) {
            new Marquee(ScrollContent, ScrollDirection, ScrollStep, ScrollWidth, ScrollHeight, ScrollTimer, ScrollDelayTime, ScrollWaitTime, ScrollWaitStep);
            PageMarqueestr += ScrollContent + ",";
        }
        else {
            if (ModifyMarqueeFlg != "") {
                new Marquee(ScrollContent, ScrollDirection, ScrollStep, ScrollWidth, ScrollHeight, ScrollTimer, ScrollDelayTime, ScrollWaitTime, ScrollWaitStep);
                PageMarqueestr = PageMarqueestr.replace(ScrollContent + ",", "");
                PageMarqueestr += ScrollContent + ",";
                ModifyMarqueeFlg = "";
            }
        }
    }
    else {
        ModifyMarqueeFlg = "";
        setIntervalMarquee = setInterval("LoadMarquee('" + ScrollContent + ", " + ScrollDirection + ", " + ScrollStep + ", " + ScrollWidth + ", " + ScrollHeight + ", " + ScrollTimer + ", " + ScrollDelayTime + ", " + ScrollWaitTime + ", " + ScrollWaitStep + "')", 100);
    }
}
var startCheckInterval=null;
window.onload = function() {
    if (document.all) {
        startCheckInterval = setInterval(IECheckPageLoad, 1);
    } else {
        PageLoadFinished = "Finished";
    }
}
function IECheckPageLoad()
{
    if (document.readyState == "complete") {
        if (startCheckInterval != null) {
            clearInterval(startCheckInterval);
            startCheckInterval = null;
        }
        PageLoadFinished="Finished";
    }
}
