/****************************************************************************************
				作者：萧 枫
				QQ:7092734
				MSN:xiaofengnet@hotmail.com
				Email:xiaofengnet@163.com
				网址：http://www.d369.net
				请保留版权　　谢谢合作
				版本:V 1.0.4
/*****************************************************************************************
*/
/*
修改了弹出窗口不能显示在当前窗口的相对中间位置
修改了Alert 中 类型不设置时默认为　warning
V 1.0.2
修改了　弹出框限制在　窗体内
V 1.0.3
更新了　框架　地址用　javascript:return false;在IE　7.0下报错的问题
V 1.0.4
更新了　本弹出窗口在同一个页面　只能弹出一次
*/
/*========================================================================================
	 框架核心内容--------【基础工具类】
  ========================================================================================
*/
if(!XiaoFeng || typeof XiaoFeng == "undefined" || !window.XiaoFeng)var XiaoFeng = new Object();
/*===========================================================================================
【弹出对话框】
主要是一些系统方法:弹出框 重写弹出框 输入框 等
*/
XiaoFeng.MessageBox = {
    alert: function(Title, Info, ShowResult) {
        if (typeof (arguments[0]) == "object") {
            var Query = arguments[0];
            Title = Query.Title;
            Info = Query.Info;
            ShowResult = Query.CallBack;
        } else
            if (arguments.length < 3) return;
        Title = typeof (Title) == "undefined" ? "警告" : Title;
        Info = typeof (Info) == "Info" ? "参数设置有问题." : Info;
        var o = Object.Size(2);
        var s = Object.Scroll();
        var d = this.Create.Div((o.x - 200 + s.y) / 2, (o.y - 90 + s.x) / 2, 200);
        var dHtml = "";
        dHtml += this.Create.Top(Title);
        dHtml += this.Create.Body(0, Info, 90);
        dHtml += this.Create.Botton(0);
        dHtml += this.Create.Bottom();
        d.innerHTML = dHtml;
        this.msg.Type = "alert";
        this.msg.Fun = ShowResult;
        this.$("Message_Btn_Yes").focus();
    },
    Alert: function(Type, Title, Info, ShowResult) {
        if (typeof (arguments[0]) == "object") {
            var Query = arguments[0];
            Type = Query.Type;
            Title = Query.Title;
            Info = Query.Info;
            ShowResult = Query.CallBack;
        } else
            if (arguments.length < 1) return;
        Title = typeof (Title) == "undefined" || Title == "" ? "提示" : Title;
        Type = typeof (Type) == "undefined" || Type == "" ? "warning" : Type;
        Info = typeof (Info) == "Info" ? "参数设置有问题." : Info;
        switch (Type.toLowerCase()) {
            case "error": Type = 1; break;
            case "info": Type = 2; break;
            case "question": Type = 3; break;
            case "warning": Type = 4; break;
            default: Type = 4; break;
        }
        var o = Object.Size(2);
        var s = Object.Scroll();
        var d = this.Create.Div((o.x - 250 + s.y) / 2, (o.y - 100 + s.x) / 2, 250);
        var dHtml = "";
        dHtml += this.Create.Top(Title);
        dHtml += this.Create.Body(Type, Info, 100);
        dHtml += this.Create.Botton(0);
        dHtml += this.Create.Bottom();
        d.innerHTML = dHtml;
        this.msg.Type = "Type";
        this.msg.Fun = ShowResult;
        this.$("Message_Btn_Yes").focus();
    },
    confirm: function(Title, Info, ShowResult) {
        if (typeof (arguments[0]) == "object") {
            var Query = arguments[0];
            Title = Query.Title;
            Info = Query.Info;
            ShowResult = Query.CallBack;
        } else
            if (arguments.length < 3) return;
        if (typeof (ShowResult) != "function") return;
        Title = typeof (Title) == "undefined" ? "询问" : Title;
        Info = typeof (Info) == "Info" ? "参数设置有问题." : Info;
        var o = Object.Size(2);
        var s = Object.Scroll();
        var d = this.Create.Div((o.x - 280 + s.y) / 2, (o.y - 90 + s.x) / 2, 280);
        var dHtml = "";
        dHtml += this.Create.Top(Title);
        dHtml += this.Create.Body(3, Info, 120);
        dHtml += this.Create.Botton(1);
        dHtml += this.Create.Bottom();
        d.innerHTML = dHtml;
        this.msg.Type = "confrim";
        this.msg.Fun = ShowResult;
        this.$("Message_Btn_Yes").focus();
    },
    prompt: function(Title, Info, ShowResult, Value) {
        if (typeof (arguments[0]) == "object") {
            var Query = arguments[0];
            Title = Query.Title;
            Info = Query.Info;
            ShowResult = Query.CallBack;
            Value = typeof (Query.Value) == "undefined" ? "" : Query.Value;
        } else
            if (arguments.length < 3) return;
        if (typeof (ShowResult) != "function") return;
        Title = typeof (Title) == "undefined" ? "请输入" : Title;
        Info = typeof (Info) == "Info" ? "请输入" : Info;
        Value = typeof (Value) == "undefined" ? "" : Value;
        var o = Object.Size(2);
        var s = Object.Scroll();
        var d = this.Create.Div((o.x - 280 + s.y) / 2, (o.y - 90 + s.x) / 2, 280);
        var dHtml = "";
        dHtml += this.Create.Top(Title);
        dHtml += this.Create.Body(5, Info, 120, Value);
        dHtml += this.Create.Botton(1);
        dHtml += this.Create.Bottom();
        d.innerHTML = dHtml;
        this.msg.Type = "prompt";
        this.msg.Fun = ShowResult;
        this.$("XiaoFeng_MessageInput").focus();
    },
    Prompt: function(Title, Info, ShowResult, Value) {
        if (typeof (arguments[0]) == "object") {
            var Query = arguments[0];
            Title = Query.Title;
            Info = Query.Info;
            ShowResult = Query.CallBack;
            Value = typeof (Query.Value) == "undefined" ? "" : Query.Value;
        } else
            if (arguments.length < 3) return;
        if (typeof (ShowResult) != "function") return;
        Title = typeof (Title) == "undefined" ? "请输入" : Title;
        Info = typeof (Info) == "Info" ? "请输入" : Info;
        Value = typeof (Value) == "undefined" ? "" : Value;
        var o = Object.Size(2);
        var s = Object.Scroll();
        var d = this.Create.Div((o.x - 300 + s.y) / 2, (o.y - 90 + s.x) / 2, 300);
        var dHtml = "";
        dHtml += this.Create.Top(Title);
        dHtml += this.Create.Body(6, Info, 150, Value);
        dHtml += this.Create.Botton(1);
        dHtml += this.Create.Bottom();
        d.innerHTML = dHtml;
        this.msg.Type = "prompts";
        this.msg.Fun = ShowResult;
        this.$("XiaoFeng_MessageInput").focus();
    },
    YesNoCancel: function(Title, Info, ShowResult) {
        if (typeof (arguments[0]) == "object") {
            var Query = arguments[0];
            Title = Query.Title;
            Info = Query.Info;
            ShowResult = Query.CallBack;
        } else
            if (arguments.length < 3) return;
        if (typeof (ShowResult) != "function") return;
        Title = typeof (Title) == "undefined" ? "请确认" : Title;
        Info = typeof (Info) == "Info" ? "请确认" : Info;
        var o = Object.Size(2);
        var s = Object.Scroll();
        var d = this.Create.Div((o.x - 300 + s.y) / 2, (o.y - 90 + s.x) / 2, 300);
        var dHtml = "";
        dHtml += this.Create.Top(Title);
        dHtml += this.Create.Body(3, Info, 120);
        dHtml += this.Create.Botton(2);
        dHtml += this.Create.Bottom();
        d.innerHTML = dHtml;
        this.msg.Type = "yesno";
        this.msg.Fun = ShowResult;
    },
    Create: {
        Div: function(l, t, w) {
        var Win = {
        x: Math.max(document.documentElement.offsetWidth, document.body.clientWidth),
                y: Math.max(document.body.clientHeight,window.screen.height)
            };
            if (XiaoFeng.MessageBox.$("XiaoFengMessageAlertBg")) return;
            var Div_Bg = XiaoFeng.MessageBox.$C("div");
            Div_Bg.id = "XiaoFengMessageAlertBg";
            Div_Bg.style.cssText = "position:absolute;left:0px;top:0px; width:" + Win.x + "px;height:" + Win.y + "px;background:#000000;filter:Alpha(Opacity=70);opacity:0.7;z-index:10000;"
            Div_Bg.innerHTML = '\
				<iframe src="javascript:false;" style="position:absolute; visibility:inherit;frameborder：0px; top:0px; left:0px; width:' + Win.x + 'px;height:' + Win.y + 'px; z-index:10000; filter:Alpha(Opacity=0);"></iframe>\
				';
            document.body.appendChild(Div_Bg);
            var d = XiaoFeng.MessageBox.$C("div");
            d.id = "XiaoFeng_Message_Alert_Bg";
            d.style.cssText = "position:absolute;left:" + l + "px;top:" + t + "px; width:" + w + "px;filter:Alpha(Opacity=100);z-index:999999999;-moz-user-select: none;-khtml-user-select: none;user-select: none;";
            d.onmousedown = function() { XiaoFeng.MessageBox.Move(this); }
            document.body.appendChild(d);
            
            return d;
        },
        Top: function(Title) {
            var TopStr = '\
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="cursor:move;" onmousedown="XiaoFeng.MessageBox.Move(this.parentNode)">\
				  <tr>\
					<td class="Message_Top_Left"></td>\
					<td class="Message_Top_Center">' + Title + '</td>\
					<td class="Message_Top_Center" style="width:15px;"><img src="/_Images/Message/Close.gif" style="cursor:pointer;" onclick="XiaoFeng.MessageBox.Msg(-1)"/></td>\
					<td class="Message_Top_Right"></td>\
				  </tr>\
				</table>\
			';
            return TopStr;
        },
        Body: function(Type, Info, h, Value) {
            h = typeof (h) == "undefined" ? 30 : (h - 57);
            var BodyStr = '\
		    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">\
			  <tr>\
				<td class="Message_Body_Left"></td>\
				<td valign="top" class="Message_Body_Center" onselectstart="return false;">\
			';
            switch (Type) {
                case 0: /*无图[对应alert 确定/OK]*/
                    BodyStr += '\
					<div style="line-height:18px;margin:10px;word-wrap: break-word; word-break: break-all;font-size:12px;color:#000000;" onselectstart="return false;">' + Info + '</div>\
					'; /*确定/OK*/
                    break;
                case 1: /*有图[对应alert:{error]*/
                    BodyStr += '\
						<div style="float:left;width:40px;text-align:center;margin:5px;" onselectstart="return false;"><img src="/_Images/Message/icon-error.gif"/></div>\
						<div style="float:left;text-align:left;line-height:18px;margin:5px;word-wrap: break-word; word-break: break-all;font-size:12px;color:#000000;" onselectstart="return false;">' + Info + '</div>\
					';
                    break;
                case 2: /*有图[对应alert:information]*/
                    BodyStr += '\
						<div style="float:left;width:40px;text-align:center;margin:5px;" onselectstart="return false;"><img src="/_Images/Message/icon-info.gif"/></div>\
						<div style="float:left;text-align:left;line-height:18px;margin:5px;word-wrap: break-word; word-break: break-all;font-size:12px;color:#000000;" onselectstart="return false;">' + Info + '</div>\
					';
                    break;
                case 3: /*有图[对应alert:question,confirm,YesNoCancel]*/
                    BodyStr += '\
						<div style="float:left;width:40px;text-align:center;margin:5px;" onselectstart="return false;"><img src="/_Images/Message/icon-question.gif"/></div>\
						<div style="float:left;text-align:left;line-height:18px;margin:5px;word-wrap: break-word; word-break: break-all; font-size:12px;color:#000000;" onselectstart="return false;">' + Info + '</div>\
					';
                    break;
                case 4: /*有图[对应alert:warning]*/
                    BodyStr += '\
						<div style="float:left;width:40px;text-align:center;" onselectstart="return false;"><img src="/_Images/Message/icon-warning.gif"/></div>\
						<div style="float:left;text-align:left;line-height:18px;margin:5px;word-wrap: break-word; word-break: break-all; font-size:12px;color:#000000;" onselectstart="return false;">' + Info + '</div>\
					';
                    break;
                case 5: /*无图[对应prompt单行]*/
                    BodyStr += '\
						<div style="float:left;text-align:left;line-height:18px;margin:5px;margin-top:10px;word-wrap: break-word; word-break: break-all; height:' + h + 'px;font-size:12px;color:#000000;" onselectstart="return true;">' + Info + '：<br>\
						<input type="text" name="XiaoFeng_MessageInput" id="XiaoFeng_MessageInput" style="width:234px;height:18px;border:1px solid #5794BF;" value="' + Value + '"/>\
						</div>\
					';
                    break;
                case 6: /*无图[对应prompt多行]*/
                    BodyStr += '\
						<div style="float:left;text-align:left;margin:5px;font-size:12px;color:#000000;">' + Info + '：<br>\
						<textarea name="XiaoFeng_MessageInput" id="XiaoFeng_MessageInput" cols="45" rows="5" style="width:250px;border:1px solid #5794BF;">' + Value + '</textarea>\
						</div>\
					';
                    break;
                default: /*无图[对应alert 确定/OK]*/
                    BodyStr += '\
					<div style="line-height:18px;margin:2px; height:' + h + 'px;font-size:12px;color:#000000;" onselectstart="return false;">' + Info + '</div>\
					'; /*确定/OK*/
                    break;
            }
            BodyStr += '\
            </td>\
				<td class="Message_Body_Right"></td>\
			  </tr>\
			</table>\
			';
            return BodyStr;
        },
        Botton: function(Type) {
            var BottonStr = '\
			<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">\
			  <tr>\
				<td class="Message_Body_Left"></td>\
				<td valign="top" class="Message_Body_Center" style="text-align:center;padding-top:5px;" onselectstart="return false;">\
			';
            switch (Type) {
                case 0: /*无图[对应alert 确定[OK] {error,informational,question,warning}]*/
                    BottonStr += '\
					<button type="button" name="Message_Btn_Yes" id="Message_Btn_Yes" class="Message_Btn_up" onmouseover="this.className=\'Message_Btn_down\';" onmouseout="this.className=\'Message_Btn_up\';" onclick="XiaoFeng.MessageBox.Msg(1)"/>OK</button>\
					'; /*确定[OK]*/
                    break;
                case 1: /*有图[对应confirm 确定[YES]/取消[Cancel]*/
                    BottonStr += '\
					<button type="button" name="Message_Btn_Yes" id="BtnYes" class="Message_Btn_up" onmouseover="this.className=\'Message_Btn_down\';" onmouseout="this.className=\'Message_Btn_up\';" onclick="XiaoFeng.MessageBox.Msg(1)"/>Yes</button>&nbsp;\
					'; /*确定[YES]*/
                    BottonStr += '\
					<button type="button" name="Message_Btn_Cancel" id="Message_Btn_Cancel" class="Message_Btn_up" onmouseover="this.className=\'Message_Btn_down\';" onmouseout="this.className=\'Message_Btn_up\';" onclick="XiaoFeng.MessageBox.Msg(-1)"/>Cancel</button>\
					'; /*取消[NO]*/
                    break;
                case 2: /*有图[对应YES|NO|CANCEL:是[Yes]|不是[No]|取消[Cancel]]*/
                    BottonStr += '\
					<button type="button" name="Message_Btn_Yes" id="Message_Btn_Yes" class="Message_Btn_up" onmouseover="this.className=\'Message_Btn_down\';" onmouseout="this.className=\'Message_Btn_up\';" onclick="XiaoFeng.MessageBox.Msg(1)"/>Yes</button>&nbsp;\
					'; /*确定[YES]*/
                    BottonStr += '\
					<button type="button" name="Message_Btn_No" id="Message_Btn_No" class="Message_Btn_up" onmouseover="this.className=\'Message_Btn_down\';" onmouseout="this.className=\'Message_Btn_up\';" onclick="XiaoFeng.MessageBox.Msg(0)"/>No</button>&nbsp;\
					'; /*不是[NO]*/
                    BottonStr += '\
					<button type="button" name="Message_Btn_Cancel" id="Message_Btn_Cancel" class="Message_Btn_up" onmouseover="this.className=\'Message_Btn_down\';" onmouseout="this.className=\'Message_Btn_up\';" onclick="XiaoFeng.MessageBox.Msg(-1)"/>Cancel</button>\
					'; /*取消[Cancel]*/
                    break;
                default: /*无图[对应alert]*/
                    /*无图[对应alert 确定[OK] {error,informational,question,warning}]*/
                    BottonStr += '\
					<button type="button" name="Message_Btn_Yes" id="Message_Btn_Yes" class="Message_Btn_up" onmouseover="this.className=\'Message_Btn_down\';" onmouseout="this.className=\'Message_Btn_up\';" onclick="XiaoFeng.MessageBox.Msg(1)"/>OK</button>\
					'; /*确定[OK]*/
                    break;
            }
            BottonStr += '\
			</td>\
			<td class="Message_Body_Right"></td>\
		  </tr>\
		</table>\
			';
            return BottonStr;
        },
        Bottom: function() {
            var BottomStr = '\
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">\
			  <tr>\
				<td class="Message_Foot_Left">&nbsp;</td>\
				<td class="Message_Foot_Center">&nbsp;</td>\
				<td class="Message_Foot_Right">&nbsp;</td>\
			  </tr>\
			</table>\
			';
            return BottomStr;
        }
    },
    msg: { Fun: new Object(), Type: "", Button: -2, Info: "" },
    Msg: function(M) {
        this.msg.Button = M;
        this.msg.Info = this.$("XiaoFeng_MessageInput") ? this.$("XiaoFeng_MessageInput").value : "";
        if (this.$("XiaoFengMessageAlertBg")) this.$("XiaoFengMessageAlertBg").parentNode.removeChild(this.$("XiaoFengMessageAlertBg"));
        if (this.$("XiaoFeng_Message_Alert_Bg")) this.$("XiaoFeng_Message_Alert_Bg").parentNode.removeChild(this.$("XiaoFeng_Message_Alert_Bg"));
        if (typeof (this.msg.Fun) == "function") this.msg.Fun({ Button: this.msg.Button, Info: this.msg.Info });
    },
    Move: function(o) {
        m(o);
    },
    $: function() {
        var elements = new Array();
        for (var i = 0; i < arguments.length; i++) {
            var element = arguments[i];
            if (typeof element == "string") element = document.getElementById ? document.getElementById(element) : document.all.element;
            if (arguments.length == 1) return element;
            elements.push(element);
        }
        return elements;
    },
    $C: function() { return document.createElement(arguments[0]); }
}
/*===========================================================================================
【弹出窗口】
弹出窗口相当于window.open
XiaoFeng.Modal.open(url,width,height);
XiaoFeng.Modal.close();
*/
XiaoFeng.Modal = {
    Init: function(l, t, w, h, u) {
        var Win = {
            x: Math.max(document.documentElement.clientWidth, document.body.clientWidth),
            y: Math.max(document.documentElement.clientHeight, document.body.clientHeight)
        };
        var Div_Bg = document.createElement("div");
        Div_Bg.id = "XiaoFengModalWindowBg";
        Div_Bg.style.cssText = "position:absolute;left:0px;top:0px; width:" + Win.x + "px;height:" + Win.y + "px;background:#000000;filter:Alpha(Opacity=70);opacity:0.7;z-index:10000;"
        Div_Bg.innerHTML = '\
			<iframe style="position:absolute; top:0px; left:0px; width:' + Win.x + 'px;height:' + Win.y + 'px; z-index:10000; filter:Alpha(Opacity=0);"></iframe>\
			';
        document.body.appendChild(Div_Bg);
        var d = this.$C("div");
        d.id = "XiaoFeng_Modal_Window_Bg";
        d.style.cssText = "border:1px solid #99BBE8;position:absolute;left:" + l + "px;top:" + t + "px; width:" + w + "px;filter:Alpha(Opacity=100);z-index:999999999";
        d.innerHTML = '\
			<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">\
			  <tr>\
				<td onmousedown="XiaoFeng.Modal.move(event)" style="cursor:move;line-height:23px;height:23px;font-size:14px;color:#286593" class="Modal_Title_Bg"><div style="float:left;line-height:23px;height:23px;padding-left:22px;padding-top:3px; background:url(/_Images/Message/icon-title.gif) 3px 5px no-repeat;">窗体标题</div><div style="float:right; padding-right:5px;font-size:15px;font-family:宋体;line-height:23px;height:23px; cursor:default;padding-top:3px;" title="关闭" onclick="XiaoFeng.Modal.close()"><img src="/_Images/Message/Close.gif"></div></td>\
			  </tr>\
			  <tr>\
				<td align="center" valign="top" style="padding:0px;border-bottom:1px solid #99BBE8;height:' + h + ';background-color:#FFFFFF;"><iframe src="' + u + '" width="100%" frameborder="0" id="XiaoFeng_Modal_Window_Iframe" onload="XiaoFeng.Modal.WriteTitle()" name="XiaoFeng_Modal_Window_Iframe" height="' + h + '"></iframe></td>\
			  </tr>\
			  <tr><td style="background-color:#D8E6F6; text-align:right;cursor:nw-resize;height:5px;overflow:hidden;" onmousedown="XiaoFeng.Modal.ReSize(XiaoFeng_Modal_Window_Bg,event)"></td></tr>\
			</table>\
		';
        document.body.appendChild(d);
    },
    open: function(u, w, h) {
        var o = Object.Size(2);
        this.Init((o.x - w) / 2, (o.y - h) / 2, w, h - 30, u);
        this.$("XiaoFeng_Modal_Window_Iframe").src = u;
    },
    close: function() {
        this.$("XiaoFengModalWindowBg").parentNode.removeChild(this.$("XiaoFengModalWindowBg"));
        this.$("XiaoFeng_Modal_Window_Bg").parentNode.removeChild(this.$("XiaoFeng_Modal_Window_Bg"));
    },
    ReSize: function(o, e) {
        return;
        var Drag = true;
        var E = e;
        var O = { w: parseInt(o.offsetWidth), h: parseInt(o.getElementsByTagName("table")[0].rows[1].cells[0].offsetHeight) };
        o.style.filter = "Alpha(Opacity=100)";
        document.onmousemove = function() {
            if (Drag) {
                var e = getEvent(); ;
                o.style.pixelWidth = (O.w + e.x - E.x) + "px";
                if (parseInt(O.w + e.x - E.x) < 120) o.style.pixelWidth = 120 + "px";
                o.getElementsByTagName("table")[0].rows[1].cells[0].style.pixelHeight = (O.h + e.y - E.y) + "px";
                o.getElementsByTagName("table")[0].rows[1].cells[0].getElementsByTagName("iframe")[0].style.pixelHeight = (O.h + e.y - E.y) + "px";
                o.setCapture();
            }
        }
        document.onmouseup = function() {
            o.style.filter = "Alpha(Opacity=100)";
            Drag = false;
            o.releaseCapture();
        }
    },
    move: function(o) {
        m(this.$("XiaoFeng_Modal_Window_Bg"), o);
    },
    WriteTitle: function() {
        var myTitle = this.$("XiaoFeng_Modal_Window_Iframe").contentWindow.document.title;
        this.$("XiaoFeng_Modal_Window_Bg").getElementsByTagName("table")[0].rows[0].cells[0].getElementsByTagName("div")[0].innerHTML = myTitle == "弹出窗口" ? "" : myTitle;
    },
    $: function() {
        var elements = new Array();
        for (var i = 0; i < arguments.length; i++) {
            var element = arguments[i];
            if (typeof element == "string") element = document.getElementById ? document.getElementById(element) : document.all.element;
            if (arguments.length == 1) return element;
            elements.push(element);
        }
        return elements;
    },
    $C: function() { return document.createElement(arguments[0]); }
}
Object.prototype.Event = function() {//获取Event
    return window.event ? window.event : (function(o) {
        do { o = o.caller; } while (o && !/^\[object[ A-Za-z]*Event\]$/.test(o.arguments[0]));
        return o.arguments[0];
    })(this.arguments[0]);
}
Object.prototype.Scroll = function() {
    var s = { x: 0, y: 0 };
    if (document.compatMode == 'CSS1Compat') {
        s.x = document.documentElement.scrollTop;
        s.y = document.documentElement.scrollLeft;
    } else if (document.body) {
        s.x = document.body.scrollTop;
        s.y = document.body.scrollLeft;
    }
    return s;
}
Object.prototype.Size = function() {//【获得窗体的宽高】
    var s = { x: 0, y: 0 };
    if (window.innerWidth) {
        s.x = window.innerWidth;
        s.y = window.innerHeight;
    } else if (document.compatMode == 'CSS1Compat') {
        if (arguments[0] == 1) {
            s.x = document.body.clientWidth;
            s.y = document.body.clientHeight;
        } else if (arguments[0] == 2) {
            s.x = parseInt(document.documentElement.clientWidth) + parseInt(document.documentElement.scrollLeft);
            s.y = parseInt(document.documentElement.clientHeight) + parseInt(document.documentElement.scrollTop);
        } else {
            s.x = document.documentElement.clientWidth;
            s.y = document.documentElement.clientHeight;
        }
    } else if (document.body) {
        if (arguments[0] == 1) {
            s.x = document.body.scrollWidth;
            s.y = document.body.scrollHeight;
        } else if (arguments[0] == 2) {
            s.x = document.body.clientWidth + document.body.scrollLeft;
            s.y = document.body.clientHeight + document.body.scrollTop;
        } else {
            s.x = document.body.clientWidth;
            s.y = document.body.clientHeight;
        }
    }
    return s;
}
function getDim(e) {
    e = typeof e == "object"?e:document.getElementById(e); var rd = { x: 0, y: 0 };
    do { rd.x += e.offsetLeft; rd.y += e.offsetTop; e = e.offsetParent; } while (e)
    return rd;
}
function getEvent() {
    return window.event || arguments.callee.caller.arguments[0];
}
function m(o) {
    var moveX = 0;
    var moveY = 0;
    var moveTop = 0;
    var moveLeft = 0;
    var moveable = false;
    var docMouseMoveEvent = document.onmousemove;
    var docMouseUpEvent = document.onmouseup;
    var iWidth = document.documentElement.clientWidth;
    var iHeight = document.documentElement.clientHeight;
    o.onmousedown = function() {
        var evt = getEvent();
        moveable = true;
        moveX = evt.clientX;
        moveY = evt.clientY;
        moveTop = parseInt(o.style.top);
        moveLeft = parseInt(o.style.left);
        var w = parseInt(o.offsetWidth);
        var h = parseInt(o.offsetHeight);
        document.onmousemove = function() {
            if (moveable) {
                var evt = getEvent();
                var x = moveLeft + evt.clientX - moveX;
                var y = moveTop + evt.clientY - moveY;
                if (x > 0 && (x + w < iWidth) && y > 0 && (y + h < iHeight)) {
                    o.style.left = x + "px";
                    o.style.top = y + "px";
                }
                if (!window.captureEvents)
                    o.setCapture();
                else
                    window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
            }
        };
        document.onmouseup = function() {
            if (moveable) {
                document.onmousemove = docMouseMoveEvent;
                document.onmouseup = docMouseUpEvent;
                moveable = false;
                moveX = 0;
                moveY = 0;
                moveTop = 0;
                moveLeft = 0;
            }
            if (!window.captureEvents)
                o.releaseCapture();
            else
                window.releaseEvents(Event.MOUSEMOVE | Event.MOUSEUP);
        };
    }
}

