﻿function loginClick()
{ showDiv("header_register_title_right_login"); hiddenDiv("header_register_title_right_unlogin"); }
function logoutClick()
{ showDiv("header_register_title_right_unlogin"); hiddenDiv("header_register_title_right_login"); }
function addBookmark(title, url) { window.external.AddFavorite(url, title); }
function showDiv(divId)
{ setAttribute(document.getElementById(divId), "class", ""); }
function hiddenDiv(divId)
{ setAttribute(document.getElementById(divId), "class", "hidden"); }
function setAttribute(object, attName, value)
{ object.setAttribute(attName, value); object.setAttribute(attName + "Name", value); }
function showDialog(sURL, dialogHeight, dialogWidth) {
    var features; var returnVal; if (dialogHeight == null || dialogWidth == null)
    { features = "dialogHeight:600px;dialogWidth:700px"; }
    else
    { features = "dialogHeight:" + dialogHeight + ";dialogWidth:" + dialogWidth; }
    returnVal = showModalDialog(sURL, window, features + ";scroll:no;status:no;help:no"); if (returnVal == "True")
    { window.location.href = window.location.href; window.location.reload; } 
}
function closeDialog()
{ window.returnValue = "True"; window.close(); }
var t_DiglogX, t_DiglogY, t_DiglogW, t_DiglogH; function StrCode(str) {
    if (encodeURIComponent)
        return encodeURIComponent(str); if (escape)
        return escape(str);
}
function Browser() {
    var ua, s, i; this.isIE = false; this.isNS = false; this.isOP = false; this.isSF = false; ua = navigator.userAgent.toLowerCase(); s = "opera"; if ((i = ua.indexOf(s)) >= 0) { this.isOP = true; return; }
    s = "msie"; if ((i = ua.indexOf(s)) >= 0) { this.isIE = true; return; }
    s = "netscape6/"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; return; }
    s = "gecko"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; return; }
    s = "safari"; if ((i = ua.indexOf(s)) >= 0) { this.isSF = true; return; } 
}
function DialogShow(showdata, ow, oh, w, h) {
    var objDialog = document.getElementById("DialogMove"); if (!objDialog)
        objDialog = document.createElement("div"); t_DiglogW = ow; t_DiglogH = oh; DialogLoc(); objDialog.id = "DialogMove"; var oS = objDialog.style; oS.display = "block"; oS.top = t_DiglogY + "px"; oS.left = t_DiglogX + "px"; oS.margin = "0px"; oS.padding = "0px"; oS.width = w + "px"; oS.height = h + "px"; oS.position = "absolute"; oS.zIndex = "5"; oS.background = "#FFF"; oS.border = "solid #000 1px"; objDialog.innerHTML = showdata; document.body.appendChild(objDialog); document.documentElement.style.overflow = "hidden"; window.onscroll = function()
        { var dde = document.documentElement; oS.top = (1 + dde.scrollTop + ((dde.offsetHeight - t_DiglogH) / 2)) + "px"; } 
}
function waitingClose() {
    ScreenClean(); var objDialog = document.getElementById("DialogMove"); if (objDialog)
        objDialog.style.display = "none"; window.document.documentElement.style.overflow = "auto";
}
function DialogLoc() {
    var dde = document.documentElement; if (window.innerWidth) { var ww = window.innerWidth; var wh = window.innerHeight; var bgX = window.pageXOffset; var bgY = window.pageYOffset; } else { var ww = dde.offsetWidth; var wh = dde.offsetHeight; var bgX = dde.scrollLeft; var bgY = dde.scrollTop; }
    t_DiglogX = (bgX + ((ww - t_DiglogW) / 2)); t_DiglogY = (bgY + ((wh - t_DiglogH) / 2));
}
function ScreenConvert() {
    var browser = new Browser(); var objScreen = document.getElementById("ScreenOver"); if (!objScreen)
        var objScreen = document.createElement("div"); var oS = objScreen.style; objScreen.id = "ScreenOver"; oS.display = "block"; oS.top = oS.left = oS.margin = oS.padding = "0px"; oS.width = "100%"; oS.height = document.documentElement.scrollHeight + "px"; oS.position = "absolute"; oS.zIndex = "3"; if ((!browser.isSF) && (!browser.isOP)) { oS.background = "#cccccc"; } else { oS.background = "#cccccc"; }
    oS.filter = "alpha(opacity=50)"; oS.opacity = 40 / 100; oS.MozOpacity = 40 / 100; document.body.appendChild(objScreen); var allselect = document.getElementsByTagName("select"); for (var i = 0; i < allselect.length; i++)
        allselect[i].style.visibility = "hidden";
}
function ScreenClean() {
    var objScreen = document.getElementById("ScreenOver"); if (objScreen)
        objScreen.style.display = "none"; var allselect = document.getElementsByTagName("select"); for (var i = 0; i < allselect.length; i++)
        allselect[i].style.visibility = "visible";
}
function ShowWaiting() {
    ScreenConvert(); var ShowDiv = "<div><table border=0 height=\"32px\"><tr>"
+ "<td width=\"32px\" style=\"vertical-align:top;\">"
+ "<img src=\"../images/loading.gif\">"
+ "</td><td style=\"vertical-align:middle;font-size:9pt;\">"
+ "等待服务器数据返回...请稍候!</td></tr></table></div>"; DialogShow(ShowDiv, 250, 120, 240, 34); window.scroll = false;
}
function AddFavorite(sURL, sTitle) {
    try { window.external.addFavorite(sURL, sTitle); }
    catch (e) {
        try { window.sidebar.addPanel(sTitle, sURL, ""); }
        catch (e) { alert("加入收藏失败，有劳您手动添加。"); } 
    } 
}
function validteCode() {
    var codes = new Array(4); var colors = new Array("Red", "Green", "Gray", "Blue", "Maroon", "Aqua", "Fuchsia", "Lime", "Olive", "Silver"); for (var i = 0; i < codes.length; i++) { codes[i] = Math.floor(Math.random() * 10); }
    var spans = document.getElementById("divCode").all; for (var i = 0; i < spans.length; i++) { spans[i].innerHTML = codes[i]; spans[i].style.color = colors[Math.floor(Math.random() * 10)]; } 
}
