﻿//给对像增加属性
//array属性里加一个删除数组元素的功能
Array.prototype.remove = function(dx) {
    if (isNaN(dx) || dx > this.length) { return false; }
    for (var i = 0, n = 0; i < this.length; i++) {
        if (this[i] != this[dx]) {
            this[n++] = this[i]
        }
    }
    this.length -= 1
}
//类区
//字符串的类
z_str = {
    //判断浏览器
    getOs: function() {
        var OsObject = "";
        if (navigator.userAgent.indexOf("MSIE") > 0) {
            return "MSIE";
        }
        if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
            return "Firefox";
        }
        if (isSafari = navigator.userAgent.indexOf("Safari") > 0) {
            return "Safari";
        }
        if (isCamino = navigator.userAgent.indexOf("Camino") > 0) {
            return "Camino";
        }
        if (isMozilla = navigator.userAgent.indexOf("Gecko") > 0) {
            return "Gecko";
        }
    },
    //去除首尾空格函数
    trimSpace: function(str) {
        while (str.substring(0, 1) == " ") {
            str = str.substring(1);
        }
        while (str.substring(str.length - 1) == " ") {
            str = str.substring(0, str.length - 1);
        }
        return str;
    },
    //接收request
    request: function(strName, layer) {
        var strHref
        switch (Number(layer)) {
            case 1:
                strHref = window.document.location.href;
                break;
            case 2:
                strHref = parent.window.document.location.href;
                break;
        }
        var intPos = strHref.indexOf("?");
        var strRight = strHref.substr(intPos + 1);
        var arrTmp = strRight.split("&");
        for (var i = 0; i < arrTmp.length; i++) {
            var arrTemp = arrTmp[i].split("=");
            if (arrTemp[0].toUpperCase() == strName.toUpperCase()) return arrTemp[1];
        }
        return "";
    },
    //AJAX的随机字符串
    ajaxRnd: function() {
        var mydate = new Date()
        var mydate_str = ""
        mydate_str += mydate.getFullYear().toString()
        var mymonth = Number(mydate.getMonth() + 1)
        mydate_str += mymonth.toString().length == 1 ? "0" + mymonth.toString() : mymonth.toString()
        mydate_str += mydate.getDate().toString().length == 1 ? "0" + mydate.getDate().toString() : mydate.getDate().toString()
        mydate_str += mydate.getHours().toString().length == 1 ? "0" + mydate.getHours().toString() : mydate.getHours().toString()
        mydate_str += mydate.getMinutes().toString().length == 1 ? "0" + mydate.getMinutes().toString() : mydate.getMinutes().toString()
        mydate_str += mydate.getSeconds().toString().length == 1 ? "0" + mydate.getSeconds().toString() : mydate.getSeconds().toString()
        var myrnd_str = new Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
        var i, u, t = 0, s = "", f = 0, k = 0
        u = mydate_str.toString().length;
        for (i = 0; i <= u; i++) {
            t = Math.floor(0 + (25 - 0) * Math.random())
            s += myrnd_str[t]
            if (i == u) {
                f = Math.floor(10 + (99 - 10) * Math.random())
                s += f - (Number(f.toString().substring(0, 1)) + Number(f.toString().substring(1, 2))) + (35 - t)
            } else {
                s += Number(mydate_str.toString().substring(i, i + 1)) + t
            }
        }
        return s
    },
    //本地化的路径及上传后的路径
    Ajax_RootUrl: function(x) {
        var rootUrl = window.location.href
        var AjaxUrlObj = new Object()
        AjaxUrlObj.w_Url = "/js/ajax_main"
        AjaxUrlObj.w_Ext = "h"
        AjaxUrlObj.EnCodeKind = 1
        AjaxUrlObj.rnd = z_str.ajaxRnd()
        if (rootUrl.toLowerCase().indexOf(x.toString().toLowerCase()) >= 0) {
            return "/" + x + z_str.ConvertToUrl(AjaxUrlObj)
        } else {
            return z_str.ConvertToUrl(AjaxUrlObj)
        }
    },
    //解析网址
    ConvertToUrl: function(UrlObj) {
        var Ajax_Url, Ajax_Path, Ajax_Ext, Ajax_Param = ""
        var rnd = Math.random() * 100000000000000
        UrlObj.zdsRnd = Math.floor(rnd)
        for (var i in UrlObj) {
            switch (i) {
                case "w_Url":
                    Ajax_Path = eval("UrlObj." + i) + "."
                    break;
                case "w_Ext":
                    Ajax_Ext = "as" + eval("UrlObj." + i) + "x"
                    break;
                case "w_All_Ext":
                    Ajax_Ext = eval("UrlObj." + i)
                    break;
                default:
                    Ajax_Param += "&" + i + "=" + eval("UrlObj." + i)
            }
        }
        Ajax_Url = Ajax_Path + Ajax_Ext + Ajax_Param
        return Ajax_Url.replace("&", "?")
    },
    SetCookie: function(name, value) {//两个参数，一个是cookie的名子，一个是值
        var Days = 90; //此 cookie 将被保存 90 天
        var exp = new Date(); //new Date("December 31, 9998");
        exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
        document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
    },
    getCookie: function(name) {//取cookies函数       
        var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
        if (arr != null) return unescape(arr[2]); return null;
    },
    delCookie: function(name) {//删除cookie
        var exp = new Date();
        exp.setTime(exp.getTime() - 1);
        var cval = z_str.getCookie(name);
        if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString()
    }
}


//ajax类
z_ajax = {
    //不同浏览器的ajax
    getXMLHttpRequest: function() {
        var xmlHttpRequest;
        if (window.XMLHttpRequest) //For general cases. 
        {
            xmlHttpRequest = new XMLHttpRequest();
        }
        else //For IE. 
        {
            if (window.ActiveXObject) {
                xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
        return xmlHttpRequest;
    },
    //ajax的GET函数
    ajaxGetFunction: function(UrlObj, UrlRnd, FNum) {
        //可选参数一
        if (UrlRnd == void 0) {
            UrlRnd = 0
        }
        //可选参数二
        if (FNum == void 0) {
            FNum = 1
        }
        var http = z_ajax.getXMLHttpRequest()//正常操作
        switch (Number(FNum)) {
            case 1: //取客户端随机数
                http.open("get", z_str.Ajax_RootUrl("liguocui"), true)
                break;
            case 2: //取服务器端随机数
                http.open("get", z_str.ConvertToUrl(UrlObj) + "&rnd=" + UrlRnd + "&w_Uid=" + escape(z_str.request("uid", 1)), true)
                break;
        }
        http.onreadystatechange = function() {
            if (http.readyState == 4 && http.status == 200) {
                switch (Number(FNum)) {
                    case 1:
                        //返回随机值的话
                        var ajaxRnd = http.responseText
                        if (ajaxRnd == "error") {
                            alert("非法请求！")
                            return
                        } else {
                            z_ajax.ajaxGetFunction(UrlObj, ajaxRnd, 2)
                        }
                        break;
                    case 2:
                        //返回内容的话
                        var ajaxText = http.responseText
                        if (ajaxText == "error") {
                            alert("请求时间过长，请重试！")
                            return
                        }
                        if (http.responseText == "w_no_mamashuojiusuannizhucedeyumingzaichangbaidudounengsousuochulai") {//如果验证丢了
                            alert("登陆信息已丢失，需要重新登陆！")
                            parent.window.location.href = "../default.htm"
                            break;
                        }
                        if (http.responseText == "w_no2_mamashuojiusuannizhucedeyumingzaichangbaidudounengsousuochulai") {//如果验证丢了
                            alert("您的账号已经在别处登陆！")
                            parent.window.location.href = "../default.htm"
                            break;
                        }
                        var body_all = http.responseText
                        body_all = escape(body_all)
                        eval(UrlObj.backfunction + "('" + body_all + "')")
                        break;
                }
            }
        }
        http.send(null)
    },
    //ajax的GET函数，有BEGIN和END，用来执行函数的
    ajaxGetFunctionBeginEnd: function(UrlObj, UrlRnd, FNum) {
        //可选参数一
        if (UrlRnd == void 0) {
            UrlRnd = 0
        }
        //可选参数二
        if (FNum == void 0) {
            FNum = 1
        }
        var http = z_ajax.getXMLHttpRequest()//正常操作
        switch (Number(FNum)) {
            case 1: //取客户端随机数
                http.open("get", z_str.Ajax_RootUrl("liguocui"), true)
                break;
            case 2: //取服务器端随机数
                http.open("get", z_str.ConvertToUrl(UrlObj) + "&rnd=" + UrlRnd + "&w_Uid=" + escape(z_str.request("uid", 1)), true)
                break;
        }
        http.onreadystatechange = function() {
            if (http.readyState == 4 && http.status == 200) {
                switch (Number(FNum)) {
                    case 1:
                        //返回随机值的话
                        var ajaxRnd = http.responseText
                        if (ajaxRnd == "error") {
                            alert("非法请求！")
                            return
                        } else {
                            z_ajax.ajaxGetFunctionBeginEnd(UrlObj, ajaxRnd, 2)
                        }
                        break;
                    case 2:
                        var myhtmlbody = http.responseText//传回的内容
                        var ajaxText = http.responseText
                        if (ajaxText == "error") {
                            alert("请求时间过长，请重试！")
                            return
                        }
                        if (ajaxText.toString().indexOf("w_no_mamashuojiusuannizhucedeyumingzaichangbaidudounengsousuochulai") >= 0) {//如果验证丢了
                            alert("登陆信息已丢失，需要重新登陆！")
                            parent.window.location.href = "../default.htm"
                            return
                        }
                        if (ajaxText.toString().indexOf("w_no2_mamashuojiusuannizhucedeyumingzaichangbaidudounengsousuochulai") >= 0) {//如果验证丢了
                            alert("您的账号已经在别处登陆！")
                            parent.window.location.href = "../default.htm"
                            return
                        }
                        var myhtmlbody_start = myhtmlbody.indexOf("<!--begin-->")//文字开始索引数
                        var myhtmlbody_end = myhtmlbody.indexOf("<!--end-->")//文字结束索引数
                        var body_all = myhtmlbody.substring(myhtmlbody_start + 12, myhtmlbody_end)
                        //返回内容的话
                        if (body_all == "error") {
                            alert("请求时间过长，请重试！")
                            return
                        }
                        body_all = escape(body_all)
                        eval(UrlObj.backfunction + "('" + body_all + "')")
                        break;
                }
            }
        }
        http.send(null)
    },
    //ajax的post函数
    ajaxPost: function(UrlObj, UrlRnd, FNum) {
        //可选参数一
        if (UrlRnd == void 0) {
            UrlRnd = 0
        }
        //可选参数二
        if (FNum == void 0) {
            FNum = 1
        }
        var http = z_ajax.getXMLHttpRequest()//正常操作
        switch (Number(FNum)) {
            case 1: //取客户端随机数
                http.open("get", z_str.Ajax_RootUrl("liguocui"), true)
                http.onreadystatechange = function() {
                    if (http.readyState == 4 && http.status == 200) {
                        //返回随机值的话
                        var ajaxRnd = http.responseText
                        if (ajaxRnd == "error") {
                            alert("非法请求！")
                            return
                        } else {
                            z_ajax.ajaxPost(UrlObj, ajaxRnd, 2)
                        }
                    }
                }
                http.send(null)
                break;
            case 2: //取服务器端随机数
                var my_url_array = new Array()
                var my_url_array_str = z_str.ConvertToUrl(UrlObj) + "&rnd=" + UrlRnd
                my_url_array = my_url_array_str.split("?")
                http.open("post", my_url_array[0], true)
                http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=gb2312");
                http.onreadystatechange = function() {
                    if (http.readyState == 4 && http.status == 200) {
                        var ajaxText = http.responseText
                        if (ajaxText == "error") {
                            alert("请求时间过长，请重试！")
                            return
                        }
                        if (http.responseText == "w_no_mamashuojiusuannizhucedeyumingzaichangbaidudounengsousuochulai") {//如果验证丢了
                            alert("登陆信息已丢失，需要重新登陆！")
                            parent.window.location.href = "../default.htm"
                            return
                        }
                        if (http.responseText == "w_no2_mamashuojiusuannizhucedeyumingzaichangbaidudounengsousuochulai") {//如果验证丢了
                            alert("您的账号已经在别处登陆！")
                            parent.window.location.href = "../default.htm"
                            return
                        }
                        var body_all = http.responseText
                        body_all = escape(body_all)
                        eval(UrlObj.backfunction + "('" + body_all + "')")
                    }
                }
                http.send(my_url_array[1])
                break;
        }
    }
}

//特效函数
z_filter = {
    //控件的位置
    //参数说明：my_ctrl_name 激发的对像名称　my_x 向左偏移　my_y 向右偏移 myById 显示出来的对像名称
    controlSite: function(my_ctrl_name, my_x, my_y, myById) {
        var t = my_ctrl_name.offsetTop;
        var l = my_ctrl_name.offsetLeft;
        while (my_ctrl_name = my_ctrl_name.offsetParent) {
            t += my_ctrl_name.offsetTop;
            l += my_ctrl_name.offsetLeft;
        }
        document.getElementById(myById).style.display = ""
        document.getElementById(myById).style.left = Number(l + my_x) + "px"
        document.getElementById(myById).style.top = Number(t + my_y) + "px"
    },
    //透明度渐显
    //参数说明: x 起始透明度(40) y 操作对像名称
    alphaOn: function(x, y) {
        document.getElementById(y).style.filter = "alpha(opacity=" + x + ")"
        document.getElementById(y).style.opacity = Number(x) * 0.01
        if (x <= 100) {
            x += 10
            window.setTimeout("z_filter.alphaOn(" + Number(x) + ",'" + y + "')", (x - 30))
        }
    },
    //透明度渐隐
    //参数说明: x 起始透明度(100) y 操作对像名称
    alphaOff: function(x, y) {
        document.getElementById(y).style.filter = "alpha(opacity=" + x + ")"
        document.getElementById(y).style.opacity = Number(x) * 0.01
        if (x >= 40) {
            x -= 10
            window.setTimeout("z_filter.alphaOff(" + Number(x) + ",'" + y + "')", 100 - x)
        } else {
            document.getElementById(y).style.display = "none"
        }
    },
    //字符一个一个的出来
    //myById 对像名称  mystr 所要显示的字符串 startint从第几个开始显示
    myStr123: function(myById, mystr, startint) {

        document.getElementById(myById).innerHTML = mystr.toString().substring(0, startint)
        if (startint < mystr.toString().length) {
            startint += 1
            window.setTimeout("z_filter.myStr123('" + myById + "','" + mystr + "'," + startint + ")", 200)
        }
    },

    //X方向或Y扩展对像
    //myById 对像名称  start_int起始数字(小)   end_int终止数字(大)  step_int增长段数  xy 是以哪个方向增长的
    scaleOpen: function(myById, start_int, end_int, step_int, xy) {
        document.getElementById(myById).style.display = ""
        if (xy == "x") {
            document.getElementById(myById).style.width = start_int + "px"
        } else {
            document.getElementById(myById).style.height = start_int + "px"
        }
        if (start_int <= end_int) {
            start_int += step_int
            window.setTimeout("z_filter.scaleOpen('" + myById + "'," + start_int + "," + end_int + "," + step_int + ",'" + xy + "')", 10)
        }
    },
    //X方向或Y收缩对像
    //myById 对像名称  start_int起始数字(大)   end_int终止数字(小)  step_int增长段数  xy 是以哪个方向增长的
    scaleClose: function(myById, start_int, end_int, step_int, xy) {
        if (xy == "x") {
            document.getElementById(myById).style.width = start_int + "px"
        } else {
            document.getElementById(myById).style.height = start_int + "px"
        }
        if (start_int >= end_int) {
            start_int -= step_int
            window.setTimeout("z_filter.scaleClose('" + myById + "'," + start_int + "," + end_int + "," + step_int + ",'" + xy + "')", 10)
        } else {
            document.getElementById(myById).style.display = "none"
        }
    },
    //创建半透明遮挡层
    //用法： 打开 z_filter.zheDang("zz1")
    //用法：关闭 zz1.parentNode.removeChild(zz1);
    zheDang: function(myById) {
        var z1 = document.createElement("div")
        z1.id = myById + "_div"
        var mywidth1, mywidth2
        mywidth1 = document.documentElement.offsetWidth
        mywidth2 = document.body.scrollWidth + 5
        if (mywidth1 >= mywidth2) {
            z1.style.width = mywidth1 + "px"
        } else {
            z1.style.width = mywidth2 + "px"
        }
        var myheight1, myheight2
        myheight1 = document.documentElement.offsetHeight
        myheight2 = document.body.scrollHeight + 10
        if (myheight1 >= myheight2) {
            z1.style.height = myheight1 + "px"
        } else {
            z1.style.height = myheight2 + "px"
        }
        z1.style.background = "#000000"
        z1.style.filter = "alpha(opacity=20)"
        z1.style.opacity = 0.2
        z1.style.position = "absolute"
        z1.style.left = 0 + "px"
        z1.style.top = 0 + "px"
        z1.style.zIndex = 2
        document.body.appendChild(z1)
        z_filter.iframeZheDang(z1, myById)//增加一个iframe遮挡
    },
    //针对遮挡层的调整
    //用法：z_filter.zheDangResize(zz1)
    zheDangResize: function(z1) {
        var mywidth1, mywidth2
        mywidth1 = document.documentElement.offsetWidth
        mywidth2 = document.body.scrollWidth + 5
        if (mywidth1 >= mywidth2) {
            z1.style.width = mywidth1
        } else {
            z1.style.width = mywidth2
        }
        var myheight1, myheight2
        myheight1 = document.documentElement.offsetHeight
        myheight2 = document.body.scrollHeight + 10
        if (myheight1 >= myheight2) {
            z1.style.height = myheight1
        } else {
            z1.style.height = myheight2
        }
    },
    //针对遮挡层的关闭
    zheDangClose: function(myId) {
        try {
            z_filter.iframeZheDangClose(myId)
            document.body.removeChild(document.getElementById(myId + "_div"));
        } catch (e) {
        }
    },
    //得到鼠标的位置
    mouseRightSite: function(myId, e) {
        e = e || window.event;
        var root = document.documentElement;
        var x = root.scrollLeft + e.clientX;
        var y = root.scrollTop + e.clientY;
        if (document.getElementById(myId).clientWidth + e.clientX > root.clientWidth) {
            x = x - document.getElementById(myId).clientWidth;
        }
        if (document.getElementById(myId).clientHeight + e.clientY > root.clientHeight) {
            y = y - document.getElementById(myId).clientHeight;
        }
        document.getElementById(myId).style.left = x + "px"
        document.getElementById(myId).style.top = y + "px"
    },
    //对像x的坐标
    getX: function(obj) {
        var ParentObj = obj;
        var left = obj.offsetLeft;
        while (ParentObj = ParentObj.offsetParent) {
            left += ParentObj.offsetLeft;
        }
        return left;
    },
    //对像y的坐标
    getY: function(obj) {
        var ParentObj = obj;
        var top = obj.offsetTop;
        while (ParentObj = ParentObj.offsetParent) {
            top += ParentObj.offsetTop;
        }
        return top;
    },
    //引导框的函数
    yinDaoBox: function(start_E, end_E, box_E, temp_Num) {
        var start_Width = parseInt(document.getElementById(start_E).style.width)
        var start_Height = parseInt(document.getElementById(start_E).style.height)
        var start_X = z_filter.getX(document.getElementById(start_E))
        var start_Y = z_filter.getY(document.getElementById(start_E))
        var end_X = z_filter.getX(document.getElementById(end_E))
        var end_Y = z_filter.getY(document.getElementById(end_E))
        //可选参数一
        if (temp_Num == void 0) {
            temp_Num = 1
        }

        document.getElementById(box_E).style.display = ""
        var move_X = 0//算出每次移动X的距离
        var move_Y = 0//算出每次移动Y的距离
        var move_only_X = 0
        var move_all_X = 0
        var move_Width = (start_Width - 5) / 21 * temp_Num//每次减少的宽度
        var move_Height = (start_Height - 5) / 21 * temp_Num//每次减少的高度
        //得到引导框X的位置
        if (start_X < end_X) {//如果起始点左于终点
            move_only_X = (end_X - start_X) / 20
            move_all_X = (end_X - start_X)
            move_X = (end_X - start_X) / 20 * temp_Num
            document.getElementById(box_E).style.left = Number(start_X + move_X - (end_X - start_X) / 20) + "px"
        } else {//如果起始点右于终点
            move_only_X = (start_X - end_X) / 20
            move_all_X = (start_X - end_X)
            move_X = (start_X - end_X) / 20 * temp_Num
            document.getElementById(box_E).style.left = Number(start_X - move_X + (start_X - end_X) / 20) + "px"
        }
        //得到引导框Y的位置
        if (start_Y < end_Y) {//如果起始点高于终点
            move_Y = (end_Y - start_Y) / 20 * temp_Num
            document.getElementById(box_E).style.top = Number(start_Y + move_Y - (end_Y - start_Y) / 20) + "px"
        } else {//如果起始点低于终点
            move_Y = (start_Y - end_Y) / 20 * temp_Num
            document.getElementById(box_E).style.top = Number(start_Y - move_Y + (start_Y - end_Y) / 20) + "px"
        }
        if (Number(start_Width - move_Width) >= 5) {
            document.getElementById(box_E).style.width = Number(start_Width - move_Width) + "px"
            document.getElementById(box_E).style.height = Number(start_Height - move_Height) + "px"
        }
        //如果达到了引导框的目的上限的话
        if (Number(move_only_X * temp_Num) <= move_all_X) {
            window.setTimeout("z_filter.yinDaoBox('" + start_E + "','" + end_E + "','" + box_E + "'," + Number(temp_Num + 1) + ")", 15)
        } else {
            document.getElementById(box_E).style.display = "none"
        }
    },
    //针对SELECT的ZINDEX过高，而用IFRAME来挡住
    iframeZheDang: function(e, myid) {
        if (navigator.userAgent.indexOf("MSIE 6") > 0) {
            var myiframe = document.createElement("iframe")
            myiframe.id = myid + "_iframe"
            myiframe.style.filter = "alpha(opacity=0)"
            myiframe.style.opacity = 0
            myiframe.style.position = "absolute"
            myiframe.style.width = e.clientWidth
            myiframe.style.height = e.clientHeight
            myiframe.style.left = e.style.left
            myiframe.style.top = e.style.top
            myiframe.style.zIndex = e.style.zIndex - 1
            document.body.appendChild(myiframe)
        }
    },
    //针对SELECT的ZINDEX过高，而用IFRAME来挡住－取消
    iframeZheDangClose: function(myid) {
        if (navigator.userAgent.indexOf("MSIE 6") > 0) {
            try {
                document.body.removeChild(document.getElementById(myid + "_iframe"));
            } catch (e) {
            }
        }
    }

}


//分页的类
z_paging = {
    //主类：z_paging.MyPaging("显示GRIDVIEW的DIV框", "放分页的DIV框", "一个识别对像", 每页显示多少条记录, "记录分组页的公共变量")
    //z_paging.MyPaging("MyList", "List_Pager", "GridView1Hidden", 10, "public_PageGroupNum")
    MyPaging: function(GridViewDivId, PageDivId, GridViewRowCountHiddenId2, PageSize, PageGroupNum, PageIndex) {
        //得到总行数
        var myPageRowCount = 0
        var myPageFind_Array = new Array()
        myPageFind_Array = document.getElementById(GridViewDivId).getElementsByTagName("table")
        for (var i = 0; i < myPageFind_Array.length; i++) {
            if (myPageFind_Array[i].PageId == GridViewRowCountHiddenId2) {
                myPageRowCount = myPageFind_Array[i].PageRowCount
            }
        }
        //如果一条记录也没有的话
        if (myPageRowCount == 0) {
            document.getElementById(PageDivId).innerHTML = "无信息，无分页！"
            return
        }
        //传参数开始操作
        var PageObj = new Object()
        PageObj.GridViewDivId = GridViewDivId
        PageObj.PageDivId = PageDivId
        PageObj.GridViewRowCountHiddenId2 = GridViewRowCountHiddenId2
        PageObj.PageCount = myPageRowCount
        PageObj.PageSize = PageSize
        PageObj.PageGroupNum = PageGroupNum
        PageObj.PageIndex = PageIndex
        z_paging.AllowPaging(PageObj)
    },
    //分页的加载项
    AllowPaging: function(PageObj) {
        document.getElementById(PageObj.PageDivId).innerHTML = ""
        var PageCount = Math.ceil(PageObj.PageCount / PageObj.PageSize)//一共可以有多少页
        var PageCountDispStart = eval(PageObj.PageGroupNum) * 10//循环起始页
        var PageCountDispEnd = PageCount <= PageCountDispStart + 10 ? PageCount : PageCountDispStart + 10//循环终止页
        //加载上一页
        var myPageMessageTable = document.createElement("table")
        myPageMessageTable.style.styleFloat = "left"
        var myPageMessagerow = myPageMessageTable.insertRow(0)
        var myPageMessagecell = myPageMessagerow.insertCell(0)
        myPageMessagecell.style.backgroundColor = "#F2F6FB"
        myPageMessagecell.style.border = "1px solid #B6CAE3"
        myPageMessagecell.style.width = "140px"
        myPageMessagecell.style.fontSize = "12px"
        myPageMessagecell.style.height = "18px"
        myPageMessagecell.style.textAlign = "center"
        myPageMessagecell.style.fontWeight = "bold"
        myPageMessagecell.innerHTML = "第" + PageCount + "&nbsp;/&nbsp;<span id='" + PageObj.PageDivId + "_Page_Select_Num'>" + PageObj.PageIndex + "</span>页(共" + PageObj.PageCount + "条记录)"
        document.getElementById(PageObj.PageDivId).appendChild(myPageMessageTable)
        if (eval(PageObj.PageGroupNum) != 0) {
            //加载上一页
            var myPagePreviousTable = document.createElement("table")
            myPagePreviousTable.style.styleFloat = "left"
            var myPagePreviousrow = myPagePreviousTable.insertRow(0)
            var myPagePreviouscell = myPagePreviousrow.insertCell(0)
            myPagePreviouscell.style.backgroundColor = "#F2F6FB"
            myPagePreviouscell.style.border = "1px solid #B6CAE3"
            myPagePreviouscell.style.width = "20px"
            myPagePreviouscell.style.fontSize = "12px"
            myPagePreviouscell.style.height = "18px"
            myPagePreviouscell.style.textAlign = "center"
            myPagePreviouscell.style.cursor = "pointer"

            myPagePreviouscell.onclick = Function("z_paging.PageingGroupSelect('" + PageObj.PageGroupNum + "','-=');z_paging.MyPaging('" + PageObj.GridViewDivId + "','" + PageObj.PageDivId + "','" + PageObj.GridViewRowCountHiddenId2 + "'," + PageObj.PageSize + ",'" + PageObj.PageGroupNum + "');PagingSelect('" + PageObj.PageDivId + "',-1)")
            myPagePreviouscell.innerHTML = "上"
            document.getElementById(PageObj.PageDivId).appendChild(myPagePreviousTable)
        }
        //加载页码
        var myPageTable = document.createElement("table")
        myPageTable.style.styleFloat = "left"
        var myrow = myPageTable.insertRow(0)
        var k = 0
        for (var i = PageCountDispStart; i < PageCountDispEnd; i++) {
            var mycell = myrow.insertCell(k)
            mycell.style.backgroundColor = "#F2F6FB"
            if (i + 1 == PageObj.PageIndex) {
                mycell.style.border = "1px solid #FF6600"
                mycell.style.color = "#7AD9C7"
            } else {
                mycell.style.border = "1px solid #B6CAE3"
            }
            mycell.style.width = "20px"
            mycell.style.fontSize = "12px"
            mycell.style.height = "18px"
            mycell.style.textAlign = "center"
            mycell.style.cursor = "pointer"
            mycell.onclick = Function("document.getElementById('" + PageObj.PageDivId + "_Page_Select_Num').innerHTML=" + Number(parseInt(i) + 1) + ";PagingSelect('" + PageObj.PageDivId + "',0)")
            mycell.innerHTML = i + 1
            k += 1
        }
        document.getElementById(PageObj.PageDivId).appendChild(myPageTable)
        if (eval(PageObj.PageGroupNum) < Math.floor(PageCount / 10) && i != PageCount) {
            //加载下一页
            var myPageNextTable = document.createElement("table")
            myPageNextTable.style.styleFloat = "left"
            var myPageNextrow = myPageNextTable.insertRow(0)
            var myPageNextcell = myPageNextrow.insertCell(0)
            myPageNextcell.style.backgroundColor = "#F2F6FB"
            myPageNextcell.style.border = "1px solid #B6CAE3"
            myPageNextcell.style.width = "20px"
            myPageNextcell.style.fontSize = "12px"
            myPageNextcell.style.height = "18px"
            myPageNextcell.style.textAlign = "center"
            myPageNextcell.style.cursor = "pointer"
            myPageNextcell.onclick = Function("z_paging.PageingGroupSelect('" + PageObj.PageGroupNum + "','+=');z_paging.MyPaging('" + PageObj.GridViewDivId + "','" + PageObj.PageDivId + "','" + PageObj.GridViewRowCountHiddenId2 + "'," + PageObj.PageSize + ",'" + PageObj.PageGroupNum + "');PagingSelect('" + PageObj.PageDivId + "',1)")
            myPageNextcell.innerHTML = "下"
            document.getElementById(PageObj.PageDivId).appendChild(myPageNextTable)
        }
    },
    //选择页
    PageingGroupSelect: function(PageGroupNum, JoinStr) {
        eval(PageGroupNum + JoinStr + 1)
    }
}



//创建对像函数
z_control = {
    //创建radio
    //用法：document.getElementById("aa").appendChild(createRadio("ra", "ra1", "hello", "checked","myonclick"))
    createRadio: function(name, id, value, isChecked, myonclick) {
        //可选参数一
        if (myonclick == void 0) {
            myonclick = "void(0)"
        }
        var oRadio = null;
        if (window.navigator.userAgent.indexOf("MSIE") >= 1) {
            oRadio = document.createElement("<input onclick='" + myonclick + "' name='" + name + (isChecked ? "' checked='" + isChecked + "'/>" : "' />"));
            oRadio.id = id;
            oRadio.type = "radio";
            oRadio.value = value;
        }
        else {
            oRadio = document.createElement("input");
            oRadio.setAttribute("type", "radio");
            oRadio.setAttribute("id", id);
            oRadio.setAttribute("name", name);
            oRadio.setAttribute("value", value);
            if (isChecked) {
                oRadio.setAttribute("checked", isChecked);
            }
        }
        return oRadio;
    },

    //创建checkbox
    //用法：document.getElementById("aa").appendChild(createRadio("name", "id", "value", "checked","myonclick"))
    createCheckbox: function(name, id, value, isChecked, myonclick) {
        var oRadio = null;
        if (window.navigator.userAgent.indexOf("MSIE") >= 1) {
            oRadio = document.createElement("<input onclick='" + myonclick + "' name='" + name + (isChecked ? "' checked='" + isChecked + "'/>" : "' />"));
            oRadio.id = id;
            oRadio.type = "checkbox";
            oRadio.value = value;
        }
        else {
            oRadio = document.createElement("input");
            oRadio.setAttribute("type", "checkbox");
            oRadio.setAttribute("id", id);
            oRadio.setAttribute("name", name);
            oRadio.setAttribute("value", value);
            oRadio.setAttribute("onclick", myonclick);
            if (isChecked) {
                oRadio.setAttribute("checked", isChecked);
            }
        }
        return oRadio;
    },
    //创建其它的控件
    createElement: function(tagName, name, type, value) {
        var element = null;
        try {
            element = document.createElement('<' + tagName + ' name="' + name + '" />');
            element.type = type;
            element.value = value;
        }
        catch (e) {
        }
        if (!element) {
            element = document.createElement(tagName);
            element.setAttribute("type", type);
            element.setAttribute("name", name);
            element.setAttribute("value", value);
        }
        return element;
    }
}
