addOnLoadEvent(function() {
    clear_a();
});
var bug = new Array();
var t = 's';
var s, stri = "";
var xmlHttp;
s = location.search;
stri = s.split("=");
var a = stri[1];
function load_img(id, name) {
    if (arguments.length < 2) {
        $(id).innerHTML = ' <img src="imageStyle/Loading.gif" width="16" height="16" align="absmiddle" />loading....';
    }
    else {
        $(id).innerHTML = ' <img src="imageStyle/Loading.gif" width="16" height="16" align="absmiddle" />' + name;
    }
    setTimeout(function() {
        if ($(id).innerHTML == ' <img src="imageStyle/Loading.gif" width="16" height="16" align="absmiddle" /> loading...') {
            $(id).innerHTML = "网络繁忙";
            return false;
        }
    },
    10);
}
function XMLDoc() {
    var me = this;
    var req = null;
    if (window.XMLHttpRequest) {
        try {
            req = new XMLHttpRequest();
        } catch(e) {
            req = null;
        }
    } else if (window.ActiveXObject) {
        try {
            req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {
                req = null;
            }
        }
    } else {
        alert("执行代码出现错误，错误代号：" + rq.status + "错误说明：" + rq.statusText + "");
    }
    this.request = req;
    this.loadXMLDoc = function(url, loadHardler) {
        if (this.request) {
            this.request.open("GET", url, true);
            this.request.onreadystatechange = function() {
                loadHardler(me)
            };
            this.request.setRequestHeader("Content_Type", "text/xml");
            this.request.send("");
        }
    };
}
function load_web(id, url) {
    var load_web = new XMLDoc();
    load_web.loadXMLDoc(url,
    function() {
        show_load(load_web, id);
    });
}
function show_load(req, id) {
    req = req.request;
    if (req.readyState == 4 && req.status == 200) {
        $(id).innerHTML = req.responseText;
    }
}
function come_liuyan(id) {
    url = 'liuyan_box.asp?s=' + a + '&page=' + id + '&ts=' + new Date().getTime();
    var load_liuyan = new XMLDoc();
    load_liuyan.loadXMLDoc(url, catchLiuyan);
}
function catchLiuyan(req) {
    req = req.request;
    if (req.readyState == 4 && req.status == 200) {
        xml = req.responseText;
        if (xml != "no") {

            $("liuyan_box").innerHTML = xml;
        }
    }
}
function send_toto() {
    var obj1 = $("liuyan_name").value.replace(/\+/g, "%2B");
    var obj2 = $("liuyan_textarea").value.replace(/\+/g, "%2B");
    var obj3 = $("liuyan_mail").value;
    var obj4 = $("liuyan_web").value;
    if ($("liuyan_web").value.trim() == "") {
        obj4 = "http://www.14pc.com/?ch=user";
    } else {
        obj4 = $("liuyan_web").value;
    }
    var url = 'liuyan_action.asp?s=' + a + '&name=' + escape(obj1) + '&textarea=' + escape(obj2) + '&mail=' + escape(obj3) + '&web=' + escape(obj4) + '&ts=' + new Date().getTime();
    var send_obj_liuyan = new XMLDoc();
    send_obj_liuyan.loadXMLDoc(url, obj_liuyan);
}
function obj_liuyan(req) {
    req = req.request;
    if (req.readyState == 4 && req.status == 200) {
        if (req.responseText == "yes") {
            popo.post();
            var send = popo.drag_layer("send_loading");
            document.body.appendChild(send);
            load_img("send_loading", "正在提交数据...");
            h_w(400, 200, "send_loading");
            setTimeout(function() {
                popo.remove("divId_no_click", "send_loading");
                come_liuyan(9999999);
                clear_form();
            },
            3000);

        } else {
            alert("no");
        }
    }
}
var drg = true;
var ns = (document.all) ? false: true;
function divcenter(ids) {
    popo.x();
    var ch2 = iFra.x("h2");
    ch2.innerHTML = '<h1><a href="javascript:void(0)" class="close_frame" onclick="c_f();" ></a>友情提醒</h1>';
    var drag_c = popo.drag_layer("rss_div");
    drag_c.appendChild(ch2);
    var iframe_box = popo.iframe_layer("iframe_rss");
    ids = ids || 'site';
    iframe_box.src = "http://"+document.domain+"/rss_div.asp?u=" + ids + "&spamp=" + new Date().getTime();
    drag_c.appendChild(iframe_box);
    document.body.appendChild(drag_c);
    h_w(400, 200, "rss_div");

}
var popo = {

    x: function() {
        popo.remove("divId_no_click");
        var no_click_div = document.createElement("div");
        no_click_div.id = "divId_no_click";
        document.body.appendChild(no_click_div); //唯一的一个ID
    },
    drag_layer: function(r) {
        var c = iFra.x("div");
        c.id = r;
        c.setAttribute("dragable", "dragable");
        c.onmousedown = function() {
            foo(r);
        }
        return c;
    },
    iframe_layer: function(r) {
        var cr = iFra.x("iframe");
        cr.id = r;
        cr.frameBorder = "0";
        cr.scrolling = "no";
        return cr;
    },
    post: function() {
        this.x();
        Class.bint("divId_no_click");
    },
    remove: function() {
        var len = arguments.length;
        for (var i = 0; i < len; i++) {
            this.removeChild(arguments[i]);
        }
    },
    removeChild: function(r) {
        if (document.getElementById(r)) {
            document.body.removeChild(document.getElementById(r));
        }
    }
};

//各种提示框框的制作
var msg_box = {
    title: function() {
        var ch2 = iFra.x("h2");
        ch2.innerHTML = '<h1><a href="javascript:void(0)" class="close_frame" onclick="send_f();" ></a>出错误了</h1>';
        return ch2;
    },
    content: function(r) {
        var re_w = iFra.x("div");
        re_w.className = "msg_box_200";
        re_w.innerHTML = r;
        return re_w; //msg要插入的信息
    },
    x: function(r) {
        popo.post();
        var send_wrong = popo.drag_layer("send_wrong");
        var ch = this.title();
        var ch1 = this.content(r);
        send_wrong.appendChild(ch);
        send_wrong.appendChild(ch1);
        document.body.appendChild(send_wrong);
        h_w(200, 80, "send_wrong"); //for200*80
    }
};

//for iframe

var iFra = {
    x: function(r) {
        return document.createElement(r);
    }

};

function foo(id) {

    if (drg) {
        if (document.getElementById(id) != null) {
            obj = document.getElementById(id);
            document.onmousedown = m_d;
            document.onmouseup = m_u;
        }
    }
    else {

        document.onmousemove = no_f;
        document.onmousedown = no_f;
        document.onmouseup = no_f;
    }
}
function m_d(e) {

    document.onmousemove = m_m;
    x = (ns) ? e.pageX: event.x;
    y = (ns) ? e.pageY: event.y;
    cx = obj.offsetLeft - x;
    cy = obj.offsetTop - y;

}
function m_m(e) {

    drg = false;
    x = (ns) ? e.pageX: event.x;
    y = (ns) ? e.pageY: event.y;
    obj.style.left = (cx + x) + "px";
    obj.style.top = (cy + y) + "px";

}
function m_u() {
    drg = true;
    document.onmousedown = no_f;
    document.onmousemove = no_f;
    document.onmouseup = no_f;
}
function no_f() {
    return false;
}
//提示框居中效果和拖放效果在一起
function h_w(a, b, id) {
    divId = document.getElementById(id);
    divId.style.width = "0px";
    divId.style.height = "0px";
    var s = function() {
        var w = parseInt(divId.style.width);
        if (w < a) {
            divId.style.width = w + Math.ceil((a - w) / 2) + "px";
            divId.style.left = (document.documentElement.clientWidth - divId.clientWidth) / 2 + document.documentElement.scrollLeft + "px";
        }
        else {
            clearInterval(st);
            divId.style.width = a + "px";
        }

    }
    var t = function() {
        var h = parseInt(divId.style.height);
        if (h < b) {
            divId.style.height = h + Math.ceil((b - h) / 1) + "px";
            divId.style.top = (document.documentElement.clientHeight - divId.clientHeight) / 2 + document.documentElement.scrollTop - 10 + "px";
        }
        else {
            clearInterval(tt);
            divId.style.height = b + "px";
        }

    }

    var st = window.setInterval(s, 1);
    var tt = window.setInterval(t, 1);

}
//遮照
var Class = {
    min_w: 940,
    bint: function(r) {

        $(r).style.display = "block";
        $(r).style.height = Math.max(parseInt(document.documentElement.scrollHeight), parseInt(document.documentElement.offsetHeight)) + "px";
        $(r).style.width = Math.max(parseInt(document.body.offsetWidth), Class.min_w) + "px";
    },
    res: function(r, wr) {

        $(r).style.width = Math.max(parseInt(document.body.offsetWidth), Class.min_w) + "px";
        $(r).style.height = Math.max(parseInt(document.documentElement.scrollHeight), parseInt(document.documentElement.offsetHeight)) + "px";
    }
};