﻿//通用
function gao(id) { if (!id) var id = "main"; var o = parent.document.getElementById(id); if (o) o.height = document.body.scrollHeight; }
function tishi() {
    var o = gtO("tishi"); if (!o) return;
    switch (o.value)
    {
        case "": return;
        case "close": window.close(); return;
        default: alert(o.value);
    }
    o.value = "";
}
String.prototype.Trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }
Array.prototype.Contains = function(value) { for (var i = 0; i < this.length; i++) { if (this[i] == value) return true; } return false; }
function gtO(i) { return document.getElementById(i); }
function gtV(i) { return document.getElementById(i).value; }
function gtF(i) { document.getElementById(i).focus(); }
function gtB(i) { var o = document.getElementById(i); o.focus(); o.blur(); }
function gtH(i) { return document.getElementById(i).innerHTML; }
function gtT(i) { return document.getElementById(i).innerText; }
function gtC(i) { return document.getElementById(i).checked; }
function gtS(i) { return document.getElementById(i).selectedIndex; }
function gtSV(i) { var o = document.getElementById(i); return o.options[o.selectedIndex].value; }
function gtST(i) { var o = document.getElementById(i); return o.options[o.selectedIndex].text; }
function gtA() { var a; try { a = new XMLHttpRequest(); } catch (e) { try { a = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { a = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { return; } } } return a; }
function gtQ(n, s) {
    if (!s) var s = location.search;
    if (s == "" || s == "?") return null;
    s = "&" + s.substr(1).toLowerCase() + "&";
    var m = s.indexOf("&" + n.toLowerCase() + "=");
    if (m < 0) return null;
    s = s.substring(m + n.length + 2);
    m = s.indexOf("&");
    return m < 0 ? s : s.substring(0, m);
} //返回null和空字符串是不同的，null表示无此参数，空字符串表示有参数，但值为空
function gtID(s) {
    var id = location.pathname.toLowerCase();
    if (s && id.indexOf(s) != 1) return 0;
    id = id.substr(0, id.lastIndexOf("/"));
    id = id.substr(id.lastIndexOf("/") + 1);
    id = parseInt(id, 10);
    return (isNaN(id) || id < 1) ? 0 : id;
} //从地址获取ID
//处理
function doTrim(o) { o.value = o.value.replace(/(^\s*)|(\s*$)/g, ""); }
//function doSingleLine(o, length) { o.value = o.value.replace(/\r\n/g, " "); if (length && o.value.length > length) o.value = o.value.substr(0, length) }
function doKey(o) { o.value = o.value.replace(new RegExp('[/\\\\:*"<>|?#%&+]', "g"), "").replace(/ +/g, " ").replace(/\.+/g, ".").replace(/^ |(\.| )*$/g, "").replace(/^(con|aux|prn|com1|lpt2)$/i, ""); }
function notKey(s, length) { if (!length) var length = 20; if (s.length > length) return true; return new RegExp('([/\\\\:*\"<>|?#%&+]|  |\\.\\.|^ |[ \\.]$|^(con|aux|prn|com1|lpt2)$)', "i").test(s) }
function doKs(text) { text.value = text.value.replace(new RegExp('[\\\\:*"<>|?]', 'g'), '').replace(new RegExp(' +', 'g'), ' ').replace(new RegExp('/ ', 'g'), '/').replace(new RegExp(' /', 'g'), '/').replace(new RegExp('/+', 'g'), '/').replace(new RegExp('(^[ /])|([ /]$)', 'g'), ''); }
function doPK(text) { text.value = text.value.replace(/ +/g, " ").replace(/(^ )|( $)/g, ""); } //作为主键
function doULN(o) { o.value = o.value.replace(/[^A-Za-z0-9]/g, ""); }
function doN(o) { o.value = o.value.replace(/[^0-9]/g, ""); }
function doU(o) { o.value = o.value.replace(/[^A-Z]/g, ""); }
function doLN(o) { o.value = o.value.replace(/[^a-z0-9]/g, ""); }
function doUN(o) { o.value = o.value.replace(/[^A-Z0-9]/g, ""); }
function doUL(o) { o.value = o.value.replace(/[^A-Za-z]/g, ""); }
function doDomain(text) { text.value = text.value.toLowerCase().replace(/[^-.a-z0-9]/g, ""); }
function doInt(text, Min, Max, d) {
    if (d == null)//未指定默认值
    {
        if (text.value != text.defaultValue)
        {
            var s = parseInt(text.value, 10);
            if (isNaN(s))
                text.value = text.defaultValue;
            else
            {
                if (Min != null && s < Min) { text.value = Min; return; }
                if (Max != null && s > Max) { text.value = Max; return; }
                text.value = s;
            }
        }
    }
    else
    {
        if (text.value != d)
        {
            var s = parseInt(text.value, 10);
            if (isNaN(s) || s < Min || s > Max)
                text.value = d;
            else
                text.value = s;
        }
    }
} //确保输入数字
function doDecimal(text, d, l, min, max) {
    if (d == null || d == "?") var d = text.defaultValue; //默认值
    if (text.value == d) return;
    if (l == null) var l = 2; //小数位数
    if (min == null || min == "?")
    {
        var min = 1;
        for (var i = 0; i < l; i++)
            min = min / 10;
    }
    else if (min == "-")
    {
        if (text.maxLength == 1)
            min = 0;
        else
        {
            var min = 9;
            for (var i = 2; i < text.maxLength; i++)
                min = min * 10 + 9;
            for (var i = 0; i < l; i++)
                min = min / 10;
            min = -min;
        }
    }
    if (max == null)
    {
        var max = 9;
        for (var i = 1; i < text.maxLength; i++)
            max = max * 10 + 9;
        for (var i = 0; i < l; i++)
            max = max / 10;
    }
    var s = Number(text.value);
    text.value = d;
    if (isNaN(s) || s > max || s < min) return;
    var w = "";
    for (var i = 0; i < l; i++)
        w += "0";
    var x = s.toString().indexOf(".");
    if (x > -1)
        text.value = (s + w).substr(0, x + l + 1);
    else
        text.value = s + "." + w;
} //l必须大于0
function doTime(text, D) {
    if (D == null) var D = text.defaultValue;
    var t = text.value;
    if (t == D) return;
    text.value = D;
    t = t.replace(/[^0-9]+/g, "-").replace(/(^-*)|(-*$)/g, "");
    if (t == "") return;
    var z = t.split("-");
    var y = Number(z[0]); if (y > 9999) return; if (y < 1000) y += 2000;
    var M = 1; if (z[1]) { M = Number(z[1]); if (M == 0 || M > 12) return; }
    var d = 1;
    if (z[2])
    {
        d = Number(z[2]);
        if (d == 0 || d > 31 || (M == 2 && ((y % 4 != 0 && d > 28) || d > 29)) || ((M == 4 || M == 6 || M == 9 || M == 11) && d > 30)) return;
    }
    if (text.maxLength == 10) { text.value = y + "-" + M + "-" + d; return; }
    var H = 0; if (z[3]) { H = Number(z[3]); if (H > 59) return; }
    var m = 0; if (z[4]) { m = Number(z[4]); if (m > 59) return; }
    if (text.maxLength == 16) { text.value = y + "-" + M + "-" + d + " " + H + ":" + m; return; }
    var s = 0; if (z[5]) { s = Number(z[5]); if (s > 59) return; }
    text.value = y + "-" + M + "-" + d + " " + H + ":" + m + ":" + s;
}
//判断
function isShort(id, tip, min) { if (!min) var min = 1; var o = gtO(id); if (o.value.length < min) { o.focus(); if (tip) alert(tip); return true; } }
function selectBan(select, tip) { var o = gtO(select); if (o.options[o.selectedIndex].className == "s9wkewk") { o.focus(); alert(tip); return true; } }
function textEnd(text, end, tip) { var o = gtO(text); if (eval("/" + end + "$/").test(o.value)) { o.focus(); alert(tip); return true; } }
function textNotEnd(text, end, tip) { var o = gtO(text); if (!eval("/" + end + "$/").test(o.value)) { o.focus(); alert(tip); return true; } }
function textMail(text, tip) {
    var o = gtO(text);
    if (o.value.length < 5 || o.value.length > 60) { o.focus(); alert(tip); return true; }
    if (!new RegExp("^\\w+((-+)\\w+)*@[A-Za-z0-9]+((-+)[A-Za-z0-9]+)*\\.[A-Za-z]+(\\.[A-Za-z]+)*$", "g").test(o.value)) { o.focus(); alert(tip); return true; }
}
function textKs(text, tip) {
    var o = gtO(text); if (o.value == "") return false; var a = o.value.split("/");
    for (var i = 0; i < a.length; i++) { if (a[i].length > 20) { o.focus(); alert(tip + a[i]); return true; } }
}
function textKs2(o, tip) {
    if (o.value == "") return false; var a = o.value.split("/");
    for (var i = 0; i < a.length; i++) { if (a[i].length > 20) { o.focus(); alert(tip + a[i]); return true; } }
}
function textMi(text) {
    var o = gtO(text);
    if (o.value == "") { o.focus(); alert("请填写域名"); return true; }
    if (!new RegExp("^([A-Za-z0-9]+((-+)[A-Za-z0-9]+)*\\.)+[A-Za-z0-9]+$", "g").test(o.value)) { o.focus(); alert("域名格式不正确"); return true; }
}
function selectNone(id, tip) { var q = gtO(id).getElementsByTagName("input"); for (var i = 0; i < q.length; i++) { if ((q[i].type == "checkbox" || q[i].type == "radio") && q[i].checked) return false; } if (tip) alert(tip); return true; }
//设置
function currentRow(id) {
    if (!id) var id = "list";
    var t = gtO(id); if (!t) return;
    var current = "";
    var Hid = gtO("Hid");
    if (Hid) current = Hid.value;
    if (current == "")
    {
        var s = gtQ("id");
        if (s == null || s == "") return;
        current = s;
    }
    Hid.value = "";
    for (var i = 1; i < t.rows.length; i++)
    {
        if (t.rows[i].cells[0].innerHTML.replace(/[^A-Za-z0-9]/g, "").toLowerCase() == current)
        {
            t.rows[i].cells[0].style.backgroundColor = "#FF0000";
            if (Hid) Hid.value = current;
        }
        else
            t.rows[i].cells[0].style.backgroundColor = "";
    }
}
function optionsDisabled(id) {
    o = gtO(id); if (!o) return;
    for (var i = 0; i < o.options.length; i++)
        o.options[i].className = o.options[i].value == "0" ? "s9wkewk" : "";
}
function allSelect(o) {
    var table = o.parentNode; while (table.nodeName != "TABLE") table = table.parentNode;
    var q = table.getElementsByTagName("input");
    if (o.selectedIndex == 2)
    {
        for (var i = 0; i < q.length; i++)
        {
            if (q[i].type == "checkbox")
                q[i].checked = !q[i].checked;
        }
    }
    else
    {
        var b = o.selectedIndex == 1 ? true : false;
        for (var i = 0; i < q.length; i++)
        {
            if (q[i].type == "checkbox")
                q[i].checked = b;
        }
    }
    o.selectedIndex = 0;
}
function lookSelect(o, href) {
    var q = o.parentNode.getElementsByTagName("select");
    if (q.length == 0 || q[0].value == "-") return;
    var s = q[0].value;
    if (s == "0")
    {
        s = q[0].options[q[0].selectedIndex].text;
        s = s.substr(0, s.indexOf("-"));
    }
    window.open("/" + href + "/" + s + "/1.htm", "_blank");
}
function auth(TBauth, Iauth) {
    if (!TBauth) var TBauth = "TBauth";
    if (!Iauth) var Iauth = "Iauth";
    var TB = gtO(TBauth), I = gtO(Iauth);
    if (!TB || !I) return;
    TB.onblur = function() { doN(this) }
    TB.onfocus = function() {
        if (I.style.visibility == "visible") return;
        I.src = "/wkewk.com/auth.aspx?" + Math.random();
        I.style.visibility = "visible";
    }
    I.onclick = function() {
        this.src = "/wkewk.com/auth.aspx?" + Math.random();
    }
}
//返回函数
function getTableSelectValue(list) {
    if (!list) var list = "list"; list = gtO(list); if (!list) return "";
    var s = "", l = list.rows.length;
    if (list.rows[l - 1].cells.length == 1) l -= 1; //分页行
    for (var i = 1; i < l; i++)
    {
        if (list.rows[i].getElementsByTagName("input")[0].checked)
            s += "," + list.rows[i].cells[0].innerText;
    }
    return s == "" ? "" : s.substr(1).replace(/[^0-9,]/g, "");
}
function setTableSelectValue(list, ids) {
    if (!ids) var ids = "Hids"; ids = gtO(ids); if (!ids || ids.value == "") return;
    if (!list) var list = "list"; list = gtO(list); if (!list) return;
    var s = "," + ids.value + ",", l = list.rows.length;
    if (list.rows[l - 1].cells.length == 1) l -= 1; //分页行
    for (var i = 1; i < l; i++)
        list.rows[i].getElementsByTagName("input")[0].checked = s.indexOf("," + list.rows[i].cells[0].innerText.replace(/[^0-9]/g, "") + ",") > -1;
}
function getCell(o, i) { var tr = o.parentNode; while (tr.nodeName != "TR") tr = tr.parentNode; return tr.cells[i].innerHTML.Trim(); }
//Ajax
function ajaxSetString(s, p1, p2) { var i = 0; while (s.indexOf(i) > -1) { i++; } s = s.replace(/\+/g, "Z" + i).replace(/&/g, "R" + i); return p1 + "=" + s + "&" + p2 + "=" + i; }
function ajaxDoString(id) { return gtV(id).replace(/ /g, "&nbsp;").replace(/</g, "&lt;").replace(/\r\n/g, "<br />"); }
//——————————
function _list() {
    var o = gtO("list");
    if (!o) { alert("您尚未选择任何项"); return true; }
    var q = o.getElementsByTagName("input");
    for (var i = 0; i < q.length; i++) { if (q[i].type == "checkbox" && q[i].checked) return; }
    alert("您尚未选择任何项");
    return true;
}
function _Arow(o) {
    var tr = o.parentNode; while (tr.nodeName != "TR") tr = tr.parentNode;
    gtO("Hid").value = tr.cells[0].innerHTML.replace(/ /g, "");
    var t = tr.parentNode; while (t.nodeName != "TABLE") t = t.parentNode;
    currentRow(t.id);
}
//——————————
//function AvalueB(o, query, func){
//    o.onclick = function()
//    {
//        o.style.backgroundColor = "#FF0000";
//        var t = o.parentNode; while (t.nodeName != "TABLE") t = t.parentNode;
//        var s = getTableSelectValue(t.id);
//        if (s == "") { alert("您尚未选择任何项"); o.style.backgroundColor = ""; return; }
//        var v = func();
//        if (v == null) { o.style.backgroundColor = ""; return; }
//        var ajax = gtA(); if (!ajax) return;
//        ajax.onreadystatechange = function()
//        {
//            if (ajax.readyState != 4 || ajax.status != 200) return;
//            if (ajax.responseText == "") { ajax = null; top.location = "/wkewk.com/logout.aspx"; return; }
//            ajax = null;
//            var th = o.parentNode; while (th.nodeName != "TH") th = th.parentNode;
//            var tr = th.parentNode; while (tr.nodeName != "TR") tr = tr.parentNode;
//            var column = 0; while (tr.cells[column] != th) column++;
//            var l = t.rows.length;
//            if (t.rows[l - 1].cells.length == 1) l -= 1; //分页行
//            for (var i = 1; i < l; i++)
//            {
//                if (t.rows[i].getElementsByTagName("input")[0].checked)
//                    list.rows[i].cells[column].innerText = v;
//            }
//            o.style.backgroundColor = "";
//        }
//        ajax.open("POST", location.pathname.toLowerCase().replace(".aspx", "Ajax.aspx?" + query), true);
//        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
//        ajax.send("id=" + s + "&" + ajaxSetString(o.value, "v", "_v"));
//    }
//    o.onmouseover = function() { o.style.textDecoration = "none"; window.status = o.title; }
//    o.onmouseout = function() { o.style.textDecoration = "underline"; window.status = ""; }
//    o.onmouseover();
//}
function AdeleteB(o, query, func, tip1, tip2) {
    o.onclick = function() {
        o.style.backgroundColor = "#FF0000";
        if (tip1 == null) tip1 = "您确定要批量删除所有选定项吗";
        if (!confirm(tip1)) { o.style.backgroundColor = ""; return; }
        var t = o.parentNode; while (t.nodeName != "TABLE") t = t.parentNode;
        var s = getTableSelectValue(t.id);
        if (s == "") { alert("您尚未选择任何项"); o.style.backgroundColor = ""; return; }
        if (query == null) query = "delete";
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/wkewk.com/logout.aspx"; return; }
            var l = t.rows.length - 1, i = 1; if (t.rows[l].cells.length == 1) l -= 1;
            for (var i = l; i > 0; i--) { if (t.rows[i].getElementsByTagName("input")[0].checked) t.deleteRow(i); }
            var Hid = gtO("Hid"); if (Hid && ("," + s + ",").indexOf("," + Hid.value + ",") > -1) Hid.value = "";
            alternating(t.id);
            o.style.backgroundColor = "";
            if (func) func(o, t);
        }
        ajax.open("POST", location.pathname.toLowerCase().replace(".aspx", "Ajax.aspx?" + query), true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + s);
    }
    o.onmouseover = function() { o.style.textDecoration = "none"; if (tip2 == null) tip2 = "批量删除所有选定项"; window.status = tip2; }
    o.onmouseout = function() { o.style.textDecoration = "underline"; window.status = ""; }
    o.onmouseover();
} //批量删除
function Adelete(o, query, func, tip1, tip2) {
    var tr = o.parentNode; while (tr.nodeName != "TR") tr = tr.parentNode;
    var id = tr.cells[0].innerHTML.Trim();
    o.onclick = function() {
        o.style.backgroundColor = "#FF0000";
        if (tip1 == null) tip1 = "您确定要删除选定项吗？";
        if (!confirm(tip1)) { o.style.backgroundColor = ""; return; }
        if (query == null) query = "delete";
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/wkewk.com/logout.aspx"; return; }
            var t = tr.parentNode; while (t.nodeName != "TABLE") t = t.parentNode;
            for (var i = 0; i < t.rows.length; i++) { if (t.rows[i] == tr) { t.deleteRow(i); break; } }
            var Hid = gtO("Hid"); if (Hid && Hid.value == id) Hid.value = "";
            alternating(t.id);
            if (func) func(o, id, t, tr);
        }
        ajax.open("POST", location.pathname.toLowerCase().replace(".aspx", "Ajax.aspx?" + query), true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id);
    }
    o.onmouseover = function() { o.style.textDecoration = "none"; if (tip2 == null) tip2 = "删除"; window.status = tip2 + "：" + id; }
    o.onmouseout = function() { o.style.textDecoration = "underline"; window.status = ""; }
    o.onmouseover();
}
function LBTdelete(o, tip, ids) {
    var tr = o.parentNode; while (tr.nodeName != "TR") tr = tr.parentNode;
    var id = tr.cells[0].innerHTML.Trim();
    o.style.backgroundColor = "#FF0000";
    if (tip == null) tip = "您确定要删除选定项吗？";
    if (!confirm(tip)) { o.style.backgroundColor = ""; return false; }
    if (ids == null) ids = "tishi";
    gtO(ids).value = id;
    return true;
}
function LBTdeleteB(o, tip, ids) {
    o.style.backgroundColor = "#FF0000";
    if (tip == null) tip = "您确定要批量删除所有选定项吗";
    if (!confirm(tip)) { o.style.backgroundColor = ""; return false; }
    var t = o.parentNode; while (t.nodeName != "TABLE") t = t.parentNode;
    var s = getTableSelectValue(t.id);
    if (s == "") { alert("您尚未选择任何项"); o.style.backgroundColor = ""; return false; }
    if (ids == null) ids = "tishi";
    gtO(ids).value = s;
    return true;
} //批量删除
function Avalue(o, query, func) {
    var tr = o.parentNode; while (tr.nodeName != "TR") tr = tr.parentNode;
    var id = tr.cells[0].innerHTML.Trim();
    o.ondblclick = function() {
        o.style.backgroundColor = "#FF0000";
        if (o.onblur) o.onblur();
        if (!query) query = "value";
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/wkewk.com/logout.aspx"; return; }
            if (func) func(o, tr);
            o.defaultValue = o.value;
            o.style.backgroundColor = "#DDC6DF";
        }
        ajax.open("POST", location.pathname.toLowerCase().replace(".aspx", "Ajax.aspx?" + query), true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id + "&" + ajaxSetString(o.value, "v", "_v"));
    }
    o.onmouseover = function() { window.status = "双击保存：" + id; }
    o.onmouseout = function() { window.status = ""; }
    o.onmouseover();
}
function Abool(o, query, func) {
    var tr = o.parentNode; while (tr.nodeName != "TR") tr = tr.parentNode;
    var id = tr.cells[0].innerHTML.Trim();
    o.onclick = function() {
        o.style.backgroundColor = "#FF0000";
        var b = 0, s = "";
        switch (o.innerHTML.toLowerCase())
        {
            case "是": s = "<b>否</b>"; break;
            case "否": s = "<b>是</b>"; b = 1; break;
            case "<b>是</b>": s = "否"; break;
            case "<b>否</b>": s = "是"; b = 1; break;
        }
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/wkewk.com/logout.aspx"; return; }
            o.innerHTML = s;
            o.style.backgroundColor = "#DDC6DF";
            if (func) func(o, id, tr, b);
        }
        ajax.open("POST", location.pathname.toLowerCase().replace(".aspx", "Ajax.aspx?" + query), true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id + "&bool=" + b);
    }
    o.onmouseover = function() { o.style.textDecoration = "none"; window.status = "点击切换：" + id; }
    o.onmouseout = function() { o.style.textDecoration = "underline"; window.status = ""; }
    o.onmouseover();
}
//——————————
function color(o) {
    o.onmouseup = function() { o.style.backgroundColor = ""; }
    o.onmouseout = function() { var n = o.tagName; if (n != "TEXTAREA" && n != "INPUT") o.style.textDecoration = "underline"; o.style.backgroundColor = ""; window.status = ""; }
    o.onmouseover();
}
function copy(o, id) {
    o.onmousedown = function() {
        o.style.backgroundColor = "#FF0000";
        var s;
        if (id)
        {
            var d = gtO(id);
            s = d.value;
            if (s == null) s = d.innerHTML;
        }
        else if (o.tagName == "TEXTAREA" || o.tagName == "INPUT")
            s = o.value;
        else
        {
            var q = o.parentNode.getElementsByTagName("textarea");
            if (q.length > 0)
                s = q[0].value;
            else
            {
                q = o.parentNode.getElementsByTagName("input");
                for (var i = 0; i < q.length; i++)
                {
                    if (q[i].type == "text" || q[i].type == "password")
                    {
                        s = q[i].value;
                        break;
                    }
                }
                if (s == null)
                    s = o.innerHTML;
            }
        }
        clipboardData.setData("Text", s);
    }
    o.onmouseover = function() { o.style.textDecoration = "none"; window.status = "点击复制"; }
    color(o);
}
function paste(o, id) {
    o.onmousedown = function() {
        o.style.backgroundColor = "#FF0000";
        var s = clipboardData.getData("Text");
        if (s == null) return;
        if (id) { var d = gtO(id); if (d.tagName == "INPUT" && s.length > d.maxLength) s = s.substr(0, d.maxLength); d.value = s; d.focus(); d.blur(); }
        else if (o.tagName == "TEXTAREA") o.value = s;
        else if (o.tagName == "INPUT") { if (s.length > o.maxLength) s = s.substr(0, o.maxLength); o.value = s; }
        else
        {
            var q = o.parentNode.getElementsByTagName("textarea");
            if (q.length > 0)
            {
                q[0].value = s;
                q[0].focus();
                q[0].blur();
            }
            else
            {
                q = o.parentNode.getElementsByTagName("input");
                for (var i = 0; i < q.length; i++)
                {
                    if (q[i].type == "text" || q[i].type == "password")
                    {
                        if (s.length > q[i].maxLength) s = s.substr(0, q[i].maxLength);
                        q[i].value = s;
                        q[i].focus();
                        q[i].blur();
                        break;
                    }
                }
            }
        }
    }
    o.onmouseover = function() { o.style.textDecoration = "none"; window.status = "点击粘贴"; }
    color(o);
}
function sign(o, i) {
    var q = o.parentNode.getElementsByTagName("input");
    o.onmousedown = function() {
        o.style.backgroundColor = "#FF0000";
        clipboardData.setData("Text", "{" + i + ":" + (q.length == 0 ? o.innerText : q[0].value) + "/}");
    }
    o.onmouseover = function() { o.style.textDecoration = "none"; window.status = "点击复制调用标记：{" + i + ":" + (q.length == 0 ? o.innerText : q[0].value) + "/}"; }
    color(o);
}
//——————————
//插件
function current(id, css, type) {
    if (arguments.length < arguments.callee.length - 1) return;
    var o = gtO(id);
    if (o)
    {
        if (type && type == "+")
            o.className += " " + css;
        else
            o.className = css;
    }
}
function imgMax(imgArea, width, height) {
    var _imgArea = gtO(imgArea);
    var _width = parseInt(width, 10);
    var _height = parseInt(height, 10);
    //    if (arguments.length != arguments.callee.length)
    //    {
    //        alert("参数数目不对");
    //        return;
    //    }
    //    if (!_imgArea)
    //    {
    //        alert("图片区域不存在");
    //        return;
    //    }
    //    if (isNaN(_width) || _width < 0)
    //    {
    //        alert("图片最大宽度不能小于0");
    //        return;
    //    }
    //    if (isNaN(_height) || _height < 0)
    //    {
    //        alert("图片最大高度不能小于0");
    //        return;
    //    }
    //    if (_width == 0 && _height == 0)
    //    {
    //        alert("图片最大宽度和高度不能都为0");
    //        return;
    //    }
    if (!_imgArea) return;
    var o = _imgArea.getElementsByTagName("img");
    for (var i = 0; i < o.length; i++)
    {
        if (o.item(i).readyState == "complete")
        {
            o.item(i).removeAttribute("width");
            o.item(i).removeAttribute("height");
            if (_height == 0)
            {
                if (o.item(i).width > _width)
                {
                    o.item(i).height = o.item(i).height * _width / o.item(i).width;
                    o.item(i).width = _width;
                }
            }
            else if (_width == 0)
            {
                if (o.item(i).height > _height)
                {
                    o.item(i).width = o.item(i).width * _height / o.item(i).height;
                    o.item(i).height = _height;
                }
            }
            else
            {
                if (o.item(i).width > _width || o.item(i).height > _height)
                {
                    if (o.item(i).width * _height > o.item(i).height * _width)
                    {
                        o.item(i).height = o.item(i).height * _width / o.item(i).width;
                        o.item(i).width = _width;
                    }
                    else
                    {
                        o.item(i).width = o.item(i).width * _height / o.item(i).height;
                        o.item(i).height = _height;
                    }
                }
            }
        }
        else
        {
            o.item(i).onload = function() {
                this.removeAttribute("width");
                this.removeAttribute("height");
                if (_height == 0)
                {
                    if (this.width > _width)
                    {
                        this.height = this.height * _width / this.width;
                        this.width = _width;
                    }
                }
                else if (_width == 0)
                {
                    if (this.height > _height)
                    {
                        this.width = this.width * _height / this.height;
                        this.height = _height;
                    }
                }
                else
                {
                    if (this.width > _width || this.height > _height)
                    {
                        if (this.width * _height > this.height * _width)
                        {
                            this.height = this.height * _width / this.width;
                            this.width = _width;
                        }
                        else
                        {
                            this.width = this.width * _height / this.height;
                            this.height = _height;
                        }
                    }
                }
            }
        }
    }
}
function imgNone(imgArea, src) {
    if (arguments.length != arguments.callee.length)
    {
        alert("参数数目不对");
        return;
    }

    var _imgArea = gtO(imgArea); //图片容器
    if (!_imgArea) return;

    var o = _imgArea.getElementsByTagName("img");
    for (var i = 0; i < o.length; i++)
    {
        if (o.item(i).readyState == "uninitialized")
        {
            o[i].onerror = function() {
                this.src = src;
                this.onerror = function() { this.removeAttribute("src"); }
            }
            o[i].src = o[i].src; //正在加载和加载失败的重新加载，防止函数写入前图片已经加载失败
        }
    }
}
function currentA(page, area, css) {
    if (!area) var area = "nav"; var o = gtO(area);
    if (o)
    {
        var s = location.pathname.toLowerCase();
        if (page)
            s = s.substr(0, s.lastIndexOf("_") + 1) + page + ".aspx";
        var a = o.getElementsByTagName("a");
        for (var i = 0; i < a.length; i++)
        {
            if (a[i].href.toLowerCase().indexOf(s) > -1)
            {
                if (!css) var css = "n0wkewk";
                a[i].className = css;
                break;
            }
        }
    }
} //后台导航专用
function delay(id, wait) {
    var o = gtO(id);
    var v = o.value;
    if (wait)
    {
        wait = parseInt(wait, 10);
        if (isNaN(wait) || wait < 1)
            wait = 5;
    }
    else var wait = 5;
    o.value = wait;
    o.disabled = true;
    var d = function _delay() {
        var i = Number(o.value);
        if (i > 1)
        {
            o.value = i - 1;
        }
        else
        {
            clearInterval(d);
            o.value = v;
            o.disabled = false;
        }
    }
    setInterval(d, 1000);
}
function lookDomain(o) {
    var q = o.parentNode.getElementsByTagName("input");
    if (q.length > 0 && q[0].value != "")
        o.href = "http://" + q[0].value;
}
function selectU(o) {
    var toId = parseInt(o.value, 10);
    if (isNaN(toId)) return;
    var s = location.pathname;
    s = s.replace(s.substr(s.lastIndexOf("_") + 1), "e.aspx");
    s += stQ("id", toId);
    top.location = s;
}
function tableU(o, toUrl) {
    var path = location.pathname.toLowerCase();
    var myUrl = path.substring(path.lastIndexOf("_") + 1, path.lastIndexOf("."));
    var tr = o.parentNode; while (tr.nodeName != "TR") tr = tr.parentNode;
    var id = tr.cells[0].innerHTML.replace(/ /g, "");
    if (!toUrl) var toUrl = "e";
    o.href = path.replace(myUrl + ".aspx", toUrl + ".aspx?id=") + id;
    if (gtO("Hsort")) o.href += "&sort=" + gtV("Hsort");
    if (o.target == "_blank")
    {
        o.onclick = function() {
            gtO("Hid").value = id;
            var t = tr.parentNode; while (t.nodeName != "TABLE") t = t.parentNode;
            currentRow(t.id);
        }
    }
    o.onmouseover = null;
}
function _Arow(o) {
    var tr = o.parentNode; while (tr.nodeName != "TR") tr = tr.parentNode;
    gtO("Hid").value = tr.cells[0].innerHTML.replace(/ /g, "");
    var t = tr.parentNode; while (t.nodeName != "TABLE") t = t.parentNode;
    currentRow(t.id);
}
function alternating(list, begin, css) {
    if (!list) var list = "list";
    var o = gtO(list);
    if (!o) return;
    if (!begin) var begin = 1;
    if (!css) var css = "t2wkewk";
    for (var i = begin; i < o.rows.length; i++)
    {
        if (i % 2 == 0)
            o.rows[i].removeAttribute("className");
        else
            o.rows[i].className = css;
    }
} //交替行样式
function _sort(id) { gtO("Hsort").value = id; var o = gtO("Hids"); if (o) o.value = getTableSelectValue() }
function sortCurrent() {
    var o = gtO(gtV("Hsort"))
    if (o) { o.removeAttribute("href"); }
}
function hotkey(id) {
    var o = gtO(id), Hid = gtO("Hid");
    var pathname = location.pathname;
    var type = pathname.substr(pathname.lastIndexOf("_")).toLowerCase();
    pathname = pathname.substr(0, pathname.lastIndexOf("_") + 1) + id.substr(1) + ".aspx";
    if (id == "Ae" || id == "Ad" || id.substr(0, 2) == "Af")//附属页面
    {
        if (type == "_a.aspx")//列表页只看Hid，其他页还要看location.search
        {
            if (!Hid || Hid.value == "") { o.removeAttribute("href"); return; }
            pathname += "?id=" + Hid.value;
            var Hsort = gtO("Hsort"); if (Hsort && Hsort.value != "") pathname += "&sort=" + Hsort.value;
        }
        else
        {
            var q = "";
            if (Hid) q = Hid.value == null ? Hid.innerHTML : Hid.value;
            if (q != "") pathname += stQ("id", q);
            else if (/[?&]id=([0-9a-zA-Z]+&|[0-9a-zA-Z]+$)/.test(location.search)) pathname += location.search;
            else { o.removeAttribute("href"); return; }; //如果无id，则地址留空，不显示为链接
        }
    }
    else
    {
        switch (type)
        {
            case "_a.aspx": //列表页只看Hid，其他页还要看location.search
                var q = "";
                if (Hid && Hid.value != "") q = "&id=" + Hid.value;
                var Hsort = gtO("Hsort"); if (Hsort && Hsort.value != "") q += "&sort=" + Hsort.value;
                if (q != "") pathname += "?" + q.substr(1);
                break;
            case "_c.aspx": //增加页
                if (Hid && Hid.value != "") pathname += stQ("id", Hid.value);
                else pathname += location.search;
                break;
            default:
                pathname += location.search;
                break;
        }
    }
    o.href = pathname;
}
//function searchUrl(){
//    var s = location.pathname;
//    s = s.substring(s.lastIndexOf("_") + 1, s.lastIndexOf(".")).toLowerCase();
//    var o = gtO("Hid");
//    switch (s)
//    {
//        case "a":
//            s = "";
//            if (o)
//            {
//                if (o.value == null)
//                    s += "&id=" + o.innerHTML;
//                else if (o.value != "")
//                    s += "&id=" + o.value;
//            }
//            else
//            {
//                var q = gtQ("id");
//                if (q != null && q != "")
//                    s += "&id=" + q;
//            }
//            o = gtO("Hsort"); if (o && o.value != "") s += "&sort=" + o.value;
//            return s == "" ? "" : "?" + s.substr(1);
//        case "c":
//            if (!o || o.value == "") return location.search;
//            return stQ("id", o.value);
//        default:
//            return location.search;
//    }
//}
function stQ(n, v, s) {
    if (!s) var s = location.search;
    if (s == "" || s == "?")
        return "?" + n + "=" + v;
    var q = gtQ(n, s);
    if (q == null)
        return s + "&" + n + "=" + v;
    else
    {
        s = "&" + s.substr(1).toLowerCase() + "&";
        n = n.toLowerCase();
        s = s.replace("&" + n + "=" + q + "&", "&" + n + "=" + v + "&");
        return "?" + s.replace(/(^&*)|(&*$)/g, "");
    }
} //可能只有id需要设置
function alternate(area, tag, css, type) {
    if (arguments.length < arguments.callee.length - 1) return;
    var o = gtO(area);
    if (!o) return;
    var q = o.getElementsByTagName(tag);
    if (type && type == "+")
    {
        for (var i = 1; i < q.length; i += 2)
            q[i].className += " " + css;
    }
    else
    {
        for (var i = 1; i < q.length; i += 2)
            q[i].className = css;
    }
} //前台交替行样式
function toUser(o) {
    var tr = o.parentNode; while (tr.nodeName != "TR") tr = tr.parentNode;
    var id = tr.cells[0].innerHTML.replace(/[^0-9]/g, "");
    o.href = "Z1_user.aspx?id=" + id;
    o.onclick = function() {
        gtO("Hid").value = id;
        var t = tr.parentNode; while (t.nodeName != "TABLE") t = t.parentNode;
        currentRow(t.id);
    }
    o.onmouseover = null;
}
function currentImg(o) {
    var o = gtO(o);
    o.className = "fp-current";
    var div = o.parentNode; while (div.nodeName != "DIV") div = div.parentNode;
    var q = div.getElementsByTagName("td");
    if (q.length < 2)
    {
        gtO("Al").innerHTML = "没有了";
        gtO("Ar").innerHTML = "没有了";
        return;
    }
    for (var i = 0; i < q.length; i++)
    {
        if (q[i] == o)
        {
            if (i == 0)
            {
                gtO("Al").innerHTML = "没有了";
                gtO("Ar").href = q[i + 1].getElementsByTagName("a")[0].href;
            }
            else if (i == q.length - 1)
            {
                gtO("Al").href = q[i - 1].getElementsByTagName("a")[0].href;
                gtO("Ar").innerHTML = "没有了";
            }
            else
            {
                gtO("Al").href = q[i - 1].getElementsByTagName("a")[0].href;
                gtO("Ar").href = q[i + 1].getElementsByTagName("a")[0].href;
            }
        }
    }
    div.scrollLeft = o.offsetLeft + o.clientWidth / 2 - div.clientWidth / 2;
} //图片页上使用，当前图片
function saveImg(o) {
    o.onclick = function() {
        var w = window.open(o.src);
        w.document.execCommand("Saveas", true);
        w.window.close();
    }
    o.onmouseover = function() { window.status = "点击保存图片"; }
    o.onmouseout = function() { window.status = ""; }
    o.onmouseover();
}
//——————————前台页面函数
function pgAo() {
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "3") return;  //本地
            if (ajax == "") { top.location = "/"; return; } //不存在
            if (ajax == "0") { location.reload(); return; } //更新页面
        }
        ajax.open("POST", "/wkewk.com/Ao.aspx", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send(null);
    }
    this.main = function() {
        _main();
    }
}
function pgAp() {
    var name = location.pathname;
    if (!/^\/page\/ap\/(.+?).htm$/i.test(name)) { alert("当前页面不能调用pgAp函数"); return; }
    name = decodeURI(name.replace(/^\/page\/ap\/(.+?).htm$/i, "$1"));
    if (notKey(name)) { alert("自定义页面名称错误"); return; }
    this.id_click = "click";
    this.id_month = "month";
    this.id_week = "week";
    this.id_day = "day";
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/"; return; } //不存在
            if (ajax == "0") { location.reload(); return; } //更新页面
            var a = ajax.split(",");
            var o = gtO(id_click); if (o) o.innerHTML = a[0];
            o = gtO(id_month); if (o) o.innerHTML = a[1];
            o = gtO(id_week); if (o) o.innerHTML = a[2];
            o = gtO(id_day); if (o) o.innerHTML = a[3];
        }
        ajax.open("POST", "/wkewk.com/Ap.aspx", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send(ajaxSetString(name, "v", "_v"));
    }
    this.main = function() {
        id_click = this.id_click;
        id_month = this.id_month;
        id_week = this.id_week;
        id_day = this.id_day;
        _main();
    }
}
function pgBf() {

    var id = location.pathname;
    if (!/^\/page\/bf\/([1-9][0-9]{0,9}\/[1-9][0-9]{0,9}).htm$/i.test(id)) { alert("当前页面不能调用pgBf函数"); return; }
    id = id.replace(/^\/page\/bf\/([1-9][0-9]{0,9}\/[1-9][0-9]{0,9}).htm$/i, "$1");
    var pn = parseInt(id.substr(id.indexOf("/") + 1), 10);
    if (isNaN(pn) || pn < 1 || pn > 2147483647) { alert("页码错误"); return; }
    id = parseInt(id.substr(0, id.indexOf("/")), 10);
    if (isNaN(id) || id < 1 || id > 2147483647) { alert("ID错误"); return; }
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/"; return; } //不存在
            if (ajax == "0") { location.reload(); return; } //更新页面
            if (ajax == "2") { top.location = "/page/bf/" + id + "/1.htm"; return; } //无此分页
        }
        ajax.open("POST", "/wkewk.com/Bf.aspx", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id + "&pn=" + pn);
    }
    this.main = function() {
        _main();
    }
}
function pgBw() {
    var id = location.pathname;
    if (!/^\/page\/bw\/([1-9][0-9]{0,9}).htm$/i.test(id)) { alert("当前页面不能调用pgBw函数"); return; }
    id = parseInt(id.replace(/^\/page\/bw\/([1-9][0-9]{0,9}).htm$/i, "$1"), 10);
    if (isNaN(id) || id < 1 || id > 2147483647) { alert("ID错误"); return; }
    this.id_click = "click";
    this.id_month = "month";
    this.id_week = "week";
    this.id_day = "day";
    var id_click, id_month, id_week, id_day;
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/"; return; } //不存在
            if (ajax == "0") { location.reload(); return; } //更新页面
            var a = ajax.split(",");
            var o = gtO(id_click); if (o) o.innerHTML = a[0];
            o = gtO(id_month); if (o) o.innerHTML = a[1];
            o = gtO(id_week); if (o) o.innerHTML = a[2];
            o = gtO(id_day); if (o) o.innerHTML = a[3];
        }
        ajax.open("POST", "/wkewk.com/Bw.aspx", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id);
    }
    this.main = function() {
        id_click = this.id_click;
        id_month = this.id_month;
        id_week = this.id_week;
        id_day = this.id_day;
        _main();
    }
}
function pgEf() {
    var id = location.pathname;
    if (!/^\/page\/ef\/([1-9][0-9]{0,9}\/[1-9][0-9]{0,9}).htm$/i.test(id)) { alert("当前页面不能调用pgEf函数"); return; }
    id = id.replace(/^\/page\/ef\/([1-9][0-9]{0,9}\/[1-9][0-9]{0,9}).htm$/i, "$1");
    var pn = parseInt(id.substr(id.indexOf("/") + 1), 10);
    if (isNaN(pn) || pn < 1 || pn > 2147483647) { alert("页码错误"); return; }
    id = parseInt(id.substr(0, id.indexOf("/")), 10);
    if (isNaN(id) || id < 1 || id > 2147483647) { alert("ID错误"); return; }
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/"; return; } //不存在
            if (ajax == "0") { location.reload(); return; } //更新页面
            if (ajax == "2") { top.location = "/page/ef/" + id + "/1.htm"; return; } //无此分页
        }
        ajax.open("POST", "/wkewk.com/Ef.aspx", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id + "&pn=" + pn);
    }
    this.main = function() {
        _main();
    }
}
function pgEw() {
    var id = location.pathname;
    if (!/^\/page\/ew\/([1-9][0-9]{0,9}).htm$/i.test(id)) { alert("当前页面不能调用pgEw函数"); return; }
    id = parseInt(id.replace(/^\/page\/ew\/([1-9][0-9]{0,9}).htm$/i, "$1"), 10);
    if (isNaN(id) || id < 1 || id > 2147483647) { alert("ID错误"); return; }
    this.id_click = "click";
    this.id_month = "month";
    this.id_week = "week";
    this.id_day = "day";
    var id_click, id_month, id_week, id_day;
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/"; return; } //不存在
            if (ajax == "0") { location.reload(); return; } //更新页面
            var a = ajax.split(",");
            var o = gtO(id_click); if (o) o.innerHTML = a[0];
            o = gtO(id_month); if (o) o.innerHTML = a[1];
            o = gtO(id_week); if (o) o.innerHTML = a[2];
            o = gtO(id_day); if (o) o.innerHTML = a[3];
        }
        ajax.open("POST", "/wkewk.com/Ew.aspx", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id);
    }
    this.main = function() {
        id_click = this.id_click;
        id_month = this.id_month;
        id_week = this.id_week;
        id_day = this.id_day;
        _main();
    }
}
function pgEb() {
    var id = location.pathname;
    this.id_click = "click";
    this.id_month = "month";
    this.id_week = "week";
    this.id_day = "day";
    this.id_login = "login";
    this.id_regist = "regist";
    this.id_max = "max";
    this.id_user = "user";
    this.id_admin = "admin";
    this.id_reply = "reply";
    this.id_template = "template";
    this.id_text = "text";
    this.id_send = "send";
    this.alert_text = "内容不能为空";
    this.alert_shut = "该贴已被关闭或删除，页面将跳转到首页"; //因为有回复功能，所以有这个提示
    var id_click, id_month, id_week, id_day, id_login, id_regist, id_max, id_user, id_admin, id_reply, id_template, id_text, id_send, alert_text, alert_shut;
    var go = true, _read, uid = 0;
    function shut() {
        alert(alert_shut);
        top.location = "/";
    }
    function read() {
        if (!go) return;
        clearInterval(_read);
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { shut(); return; }
            if (ajax == "0") { location.reload(); return; } //刷新页面
            var a = ajax.split("\r\n");
            gtO(id_user).innerHTML = a[0];
            gtO(id_admin).innerHTML = a[1];
            if (a.length > 2)
            {
                gtO(id_max).value = a[2];
                gtO(id_reply).innerHTML += a[3];
            }
            if (go) _read = setInterval(read, 5000);
        }
        ajax.open("POST", "/wkewk.com/Eb.aspx?read", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id + "&max=" + gtV(id_max) + "&uid=" + uid + "&" + ajaxSetString(gtH(id_template), "v", "_v"));
    }
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { shut(); return; }
            if (ajax == "0") { location.reload(); return; } //刷新页面
            var a = ajax.split(",");
            gtO(id_click).innerHTML = a[0];
            gtO(id_month).innerHTML = a[1];
            gtO(id_week).innerHTML = a[2];
            gtO(id_day).innerHTML = a[3];
            if (a[4] == "0")
            {
                gtO(id_send).disabled = true;
                gtO(id_login).onmousemove = function() { this.href = "/login.aspx?" + location.pathname }
            }
            else
            {
                uid = a[4];
                gtO(id_login).style.display = "none";
                gtO(id_regist).style.display = "none";
                gtO(id_text).onblur = function() { doTrim(this); }
                gtO(id_send).onclick = function() {
                    if (isShort(id_text, alert_text)) return;
                    go = false;
                    var ajax = gtA(); if (!ajax) return;
                    ajax.onreadystatechange = function() {
                        if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
                        if (ajax == "") { shut(); return; }
                        if (ajax == "0") { location.reload(); return; }
                        delay(id_send);
                        gtO(id_text).value = "";
                        go = true;
                        _read = read();
                    }
                    ajax.open("POST", "/wkewk.com/Eb.aspx?send", true);
                    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                    ajax.send("id=" + id + "&" + ajaxSetString(gtV(id_text), "v", "_v"));
                }
                _read = read();
            }
        }
        ajax.open("POST", "/wkewk.com/Eb.aspx?main", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id);
    }
    this.main = function() {
        alert_shut = this.alert_shut;
        if (!/^\/page\/ew\/([1-9][0-9]{0,9}).htm$/i.test(id)) { alert("当前页面不能调用pgEb函数"); return; }
        id = parseInt(id.replace(/^\/page\/ew\/([1-9][0-9]{0,9}).htm$/i, "$1"), 10);
        if (isNaN(id) || id < 1 || id > 2147483647) { alert("ID错误"); return; }
        id_click = this.id_click;
        id_month = this.id_month;
        id_week = this.id_week;
        id_day = this.id_day;
        id_login = this.id_login;
        id_regist = this.id_regist;
        id_max = this.id_max;
        id_user = this.id_user;
        id_admin = this.id_admin;
        id_reply = this.id_reply;
        id_template = this.id_template;
        id_text = this.id_text;
        id_send = this.id_send;
        alert_text = this.alert_text;
        _main();
    }
}
function pgFf() {
    var id = location.pathname;
    if (!/^\/page\/ff\/([1-9][0-9]{0,9}\/[1-9][0-9]{0,9}).htm$/i.test(id)) { alert("当前页面不能调用pgBf函数"); return; }
    id = id.replace(/^\/page\/ff\/([1-9][0-9]{0,9}\/[1-9][0-9]{0,9}).htm$/i, "$1");
    var pn = parseInt(id.substr(id.indexOf("/") + 1), 10);
    if (isNaN(pn) || pn < 1 || pn > 2147483647) { alert("页码错误"); return; }
    id = parseInt(id.substr(0, id.indexOf("/")), 10);
    if (isNaN(id) || id < 1 || id > 2147483647) { alert("ID错误"); return; }
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/"; return; } //分类不存在
            if (ajax == "0") { location.reload(); return; } //更新页面
            if (ajax == "2") { top.location = "/page/ff/" + id + "/1.htm"; return; } //无此分页
        }
        ajax.open("POST", "/wkewk.com/Ff.aspx", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id + "&pn=" + pn);
    }
    this.main = function() {
        _main();
    }
}
function pgFw() {
    var id = location.pathname;
    if (!/^\/page\/fw\/([1-9][0-9]{0,9})\/((index|[1-9][0-9]{0,9}).htm){0,1}$/i.test(id)) { alert("当前页面不能调用pgBw函数"); return; }
    id = parseInt(id.replace(/^\/page\/fw\/([1-9][0-9]{0,9})\/((index|[1-9][0-9]{0,9}).htm){0,1}$/i, "$1"), 10);
    if (isNaN(id) || id < 1 || id > 2147483647) { alert("ID错误"); return; }
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/"; return; } //不存在
            if (ajax == "0") { location.reload(); return; } //更新页面
        }
        ajax.open("POST", "/wkewk.com/Fw.aspx", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send("id=" + id);
    }
    this.main = function() {
        _main();
    }
}
function pgSearch() {
    var key = location.pathname;
    var r = new RegExp("^/page/([bcefg]s/.+?).htm$", "i");
    if (!r.test(key)) { alert("当前页面不能调用pgSearch函数"); return; }
    key = key.replace(r, "$1");
    var type = key.substr(0, 2);
    key = decodeURI(key.substr(3));
    if (notKey(key)) { alert("搜索词错误"); return; }
    this.id_click = "click";
    this.id_month = "month";
    this.id_week = "week";
    this.id_day = "day";
    var id_click, id_month, id_week, id_day;
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { top.location = "/"; return; } //不存在
            if (ajax == "0") { location.reload(); return; } //更新页面
            var a = ajax.split(",");
            var o = gtO(id_click); if (o) o.innerHTML = a[0];
            o = gtO(id_month); if (o) o.innerHTML = a[1];
            o = gtO(id_week); if (o) o.innerHTML = a[2];
            o = gtO(id_day); if (o) o.innerHTML = a[3];
        }
        ajax.open("POST", "/wkewk.com/" + type + ".aspx", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send(ajaxSetString(key, "v", "_v"));
    }
    this.main = function() {
        id_click = this.id_click;
        id_month = this.id_month;
        id_week = this.id_week;
        id_day = this.id_day;
        _main();
    }
}
function pg() {
    this.id_click = "click";
    this.id_month = "month";
    this.id_week = "week";
    this.id_day = "day";
    var id_click, id_month, id_week, id_day;
    function _main() {
        var key = location.pathname;
        var p;
        if (key.substr(0, 6).toLowerCase() == "/page/")
        {
            switch (key.substr(6, 3).toLowerCase())
            {
                case "ap/": p = new pgAp(); break;
                case "bf/": p = new pgBf(); break;
                case "bw/": p = new pgBw(); break;
                case "ef/": p = new pgEf(); break;
                case "ew/": p = new pgEw(); break;
                case "eb/": p = new pgEb(); break;
                case "ff/": p = new pgFf(); break;
                case "fw/": p = new pgFw(); break;
                default: p = new pgSearch();
            }
        }
        else
            p = new pgAo();
        if (p.id_click) p.id_click = id_click;
        if (p.id_month) p.id_month = id_month;
        if (p.id_week) p.id_week = id_week;
        if (p.id_day) p.id_day = id_day;
        p.main();
    }
    this.main = function() {
        id_click = this.id_click;
        id_month = this.id_month;
        id_week = this.id_week;
        id_day = this.id_day;
        _main();
    }
}
function bxLogin() {
    this.id_login = "login";
    this.id_logout = "logout";
    var id_login, id_logout;
    function _main() {
        var ajax = gtA(); if (!ajax) return;
        ajax.onreadystatechange = function() {
            if (ajax.readyState != 4 || ajax.status != 200) return; ajax = ajax.responseText;
            if (ajax == "") { window.close(); return; }
            if (ajax != "0" && ajax != "1") { top.location = "http://" + ajax + location.pathname; return; }
            var o1 = gtO(id_login), o2 = gtO(id_logout);
            if (ajax == "0")
            {
                if (o1) o1.style.display = "none";
                if (o2) o2.style.display = "block";
            }
            else
            {
                if (o1) o1.style.display = "block";
                if (o2) o2.style.display = "none";
            }
        }
        ajax.open("POST", "/wkewk.com/login.aspx", true);
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send(null);
    }
    this.main = function() {
        id_login = this.id_login;
        id_logout = this.id_logout;
        _main();
    }
}
function marquee(Dout, Din, delay, step, direction) {
    var _Dout = gtO(Dout); //外层容器，通常为div
    var _Din = gtO(Din); //内层容器，通常为div
    var _delay = parseInt(delay, 10); //延迟时间，值越大，滚动越慢
    var _step = parseInt(step, 10); //每次滚动的距离，以像素为单位，值越大，滚动越快
    //direction：滚动方向，应为 top|t，bottom|b，left|l，right|r 四个值之一

    //以下是验证，如果正常运行，可以删除或注释以下内容
    if (arguments.length != arguments.callee.length)
    {
        alert('参数数目不对');
        return;
    }
    if (!_Dout)
    {
        alert('外层容器不存在');
        return;
    }
    if (!_Din)
    {
        alert('内层容器不存在');
        return;
    }
    if (_Dout.firstChild != _Din)
    {
        alert('内层容器不是外层容器的子元素');
        return;
    }
    if (_Dout.firstChild != _Dout.lastChild)
    {
        alert('内层容器不是外层容器的唯一子元素');
        return;
    }
    if (isNaN(_delay) || _delay < 1)
    {
        alert('延迟时间应为正整数');
        return;
    }
    if (isNaN(_step) || _step < 1)
    {
        alert('步长应为正整数');
        return;
    }
    if (!new RegExp('^(t|b|l|r)', 'i').test(direction))
    {
        alert('方向设置错误，应为 top,bottom,left,right 四个值之一');
        return;
    }
    //验证结束，如果正常运行，可以删除或注释以上内容
    var start = true;
    _Dout.onmouseover = function() { start = false; }
    _Dout.onmouseout = function() { start = true; }

    direction = direction.substr(0, 1).toLocaleLowerCase();
    if (direction == 't' || direction == 'b')
    {
        if (_Din.offsetHeight < _Dout.offsetHeight)//确保内层容器高度不小于外层容器高度
            _Din.style.height = _Dout.offsetHeight;
    }
    else
    {
        if (_Din.offsetWidth < _Dout.offsetWidth)//确保内层容器宽度不小于外层容器宽度
            _Din.style.width = _Dout.offsetWidth;
    }
    var o = document.createElement(_Dout.innerHTML); //复制内层容器
    o.innerHTML = _Din.innerHTML;
    o.removeAttribute('id');
    if (direction == 't' || direction == 'b')
        _Dout.appendChild(o);
    else
    {
        _Dout.appendChild(document.createElement('<div style="width:' + (2 * _Din.offsetWidth) + 'px"></div>'));
        _Dout.lastChild.appendChild(_Din); //实际上是移动而不是复制
        _Dout.lastChild.appendChild(o);
    }

    function _marquee() {
        if (start)
        {
            switch (direction)
            {
                case 't':
                    if (_Dout.scrollTop >= _Din.offsetHeight)
                        _Dout.scrollTop = 0;
                    else
                        _Dout.scrollTop += step;
                    break;
                case 'b':
                    if (_Dout.scrollTop <= 0)
                        _Dout.scrollTop = _Din.offsetHeight;
                    else
                        _Dout.scrollTop -= step;
                    break;
                case 'l':
                    if (_Dout.scrollLeft >= _Din.offsetWidth)
                        _Dout.scrollLeft = 0;
                    else
                        _Dout.scrollLeft += step;
                    break;
                case 'r':
                    if (_Dout.scrollLeft <= 0)
                        _Dout.scrollLeft = _Din.offsetWidth;
                    else
                        _Dout.scrollLeft -= step;
                    break;
            }
        }
    }
    setInterval(_marquee, _delay);
}
function slide1(wList, width, height, textheight) {
    var _wList = gtO(wList); //保存文章列表的表格table
    var _width = parseInt(width, 10); //幻灯宽度
    var _height = parseInt(height, 10); //幻灯高度
    var _textheight = parseInt(textheight, 10); //文章标题的高度

    //以下是验证，如果正常运行，可以删除或注释以下内容
    if (arguments.length != arguments.callee.length)
    {
        alert('参数数目不对');
        return;
    }
    if (!_wList)
    {
        alert('保存文章信息的表格不存在');
        return;
    }
    if (_wList.tagName != 'TABLE')
    {
        alert('保存文章信息的容器并非表格');
        return;
    }
    if (isNaN(_width) || _width < 1 || _width > 600)
    {
        alert('幻灯宽度错误');
        return;
    }
    if (isNaN(_height) || _height < 1 || _height > 600)
    {
        alert('幻灯高度错误');
        return;
    }
    if (isNaN(_textheight) || _textheight < 0 || _textheight > 100)
    {
        alert('文章标题高度错误');
        return;
    }
    if (!_wList.rows[0]) return;
    if (!_wList.rows[0].cells[2])
    {
        alert('保存文章信息的表格应为3列：图片地址、文章地址、文章标题');
        return;
    }
    //验证结束，如果正常运行，可以删除或注释以上内容
    var files = '', links = '', texts = '';
    for (var i = 0; i < _wList.rows.length; i++)
    {
        files += (files == '' ? '' : '|') + _wList.rows[i].cells[0].innerHTML.replace(/\s/g, '');
        links += (links == '' ? '' : '|') + _wList.rows[i].cells[1].innerHTML.replace(/\s/g, '');
        texts += (texts == '' ? '' : '|') + _wList.rows[i].cells[2].innerHTML;
    }
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'
        + width
        + '" height="'
        + (_height + _textheight)
        + '"><param name="movie" value="/file/_file/slide1.swf" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="opaque" /><param name="FlashVars" value="pics='
        + files
        + '&links='
        + links
        + '&texts='
        + texts
        + '&borderwidth='
        + _width
        + '&borderheight='
        + _height
        + '&textheight='
        + _textheight
        + '" /></object>');
}
function slide2(wList, width, height, textheight) {
    var _wList = gtO(wList); //保存文章列表的表格table
    var _width = parseInt(width, 10); //幻灯宽度
    var _height = parseInt(height, 10); //幻灯高度
    var _textheight = parseInt(textheight, 10); //文章标题的高度

    //以下是验证，如果正常运行，可以删除或注释以下内容
    if (arguments.length != arguments.callee.length)
    {
        alert('参数数目不对');
        return;
    }
    if (!_wList)
    {
        alert('保存文章信息的表格不存在');
        return;
    }
    if (_wList.tagName != 'TABLE')
    {
        alert('保存文章信息的容器并非表格');
        return;
    }
    if (isNaN(_width) || _width < 1 || _width > 600)
    {
        alert('幻灯宽度错误');
        return;
    }
    if (isNaN(_height) || _height < 1 || _height > 600)
    {
        alert('幻灯高度错误');
        return;
    }
    if (isNaN(_textheight) || _textheight < 0 || _textheight > 100)
    {
        alert('文章标题高度错误');
        return;
    }
    if (!_wList.rows[0]) return;
    if (!_wList.rows[0].cells[2])
    {
        alert('保存文章信息的表格应为3列：图片地址、文章地址、文章标题');
        return;
    }
    //验证结束，如果正常运行，可以删除或注释以上内容
    var files = '', links = '', texts = '';
    for (var i = 0; i < _wList.rows.length; i++)
    {
        files += (files == '' ? '' : '|') + _wList.rows[i].cells[0].innerHTML.replace(/\s/g, '');
        links += (links == '' ? '' : '|') + _wList.rows[i].cells[1].innerHTML.replace(/\s/g, '');
        texts += (texts == '' ? '' : '|') + _wList.rows[i].cells[2].innerHTML;
    }
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'
        + _width
        + '" height="'
        + (_height + _textheight)
        + '"><param name="movie" value="/file/_file/slide2.swf"><param name="quality" value="high"><param name="menu" value="false"><param name=wmode value="opaque"><param name="FlashVars" value="bcastr_file='
        + files
        + '&bcastr_link='
        + links
        + '&bcastr_title='
        + texts
        + '&bcastr_config=0xffffff|2|0x8CA2AD|60|0xffffff|0xff9900|0x000033|4|3|1|_blank"><embed src="/file/_file/slide2.swf" wmode="opaque" FlashVars="bcastr_file='
        + files
        + '&bcastr_link='
        + links
        + '&bcastr_title='
        + texts
        + '& menu="false" quality="high" width="'
        + _width
        + '" height="'
        + (_height + _textheight)
        + '" type="application/x-shockwave-flash" /></object>');
}
