﻿var IMAGESPATH="/images/";var HideScrollbar=true;var agt=window.navigator.userAgent;var isIE=agt.toLowerCase().indexOf("msie")!=-1;var isGecko=agt.toLowerCase().indexOf("gecko")!=-1;var ieVer=isIE?parseInt(agt.split(";")[1].replace(/(^\s*)|(\s*$)/g,"").split(" ")[1]):0;var isIE8=!!window.XDomainRequest&&!!document.documentMode;var isIE7=ieVer==7&&!isIE8;var ielt7=isIE&&ieVer<7;if(isIE){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}var $id=function(a){return typeof a=="string"?document.getElementById(a):a};Array.prototype.remove=function(c,b){if(b){var d=[];for(var a=0;a<this.length;a++){if(c==this[a]){d.push(this.splice(a,1)[0])}}return d}for(var a=0;a<this.length;a++){if(c==this[a]){this.splice(a,1)}}return this};var $topWindow=function(){var a=window;while(a!=a.parent){if(a.parent.document.getElementsByTagName("FRAMESET").length>0){break}a=a.parent}return a};var $bodyDimensions=function(g){g=g||window;var j=g.document;var c=j.compatMode=="BackCompat"?j.body.clientWidth:j.documentElement.clientWidth;var a=j.compatMode=="BackCompat"?j.body.clientHeight:j.documentElement.clientHeight;var b=Math.max(j.documentElement.scrollLeft,j.body.scrollLeft);var l=Math.max(j.documentElement.scrollTop,j.body.scrollTop);var k=Math.max(j.documentElement.scrollWidth,j.body.scrollWidth);var f=Math.max(j.documentElement.scrollHeight,j.body.scrollHeight);var i=Math.max(k,c);var d=Math.max(f,a);return{clientWidth:c,clientHeight:a,scrollLeft:b,scrollTop:l,scrollWidth:k,scrollHeight:f,width:i,height:d}};var fadeEffect=function(b,f,a,c,d){if(!b.effect){b.effect={fade:0,move:0,size:0}}clearInterval(b.effect.fade);var c=c||20;b.effect.fade=setInterval(function(){f=f<a?Math.min(f+c,a):Math.max(f-c,a);b.style.opacity=f/100;b.style.filter="alpha(opacity="+f+")";if(f==a){clearInterval(b.effect.fade);if(d){d.call(b)}}},20)};var topWin=$topWindow();var topDoc=topWin.document;var Dialog=function(){this.ID=null;this.Width=null;this.Height=null;this.URL=null;this.OnLoad=null;this.InnerHtml="";this.InvokeElementId="";this.Top="50%";this.Left="50%";this.Title="　";this.OKEvent=null;this.CancelEvent=null;this.ShowButtonRow=false;this.MessageIcon="window.gif";this.MessageTitle="";this.Message="";this.ShowMessageRow=false;this.Modal=true;this.Drag=true;this.AutoClose=null;this.ShowCloseButton=true;this.Animator=true;this.MsgForESC="";this.dialogDiv=null;this.bgDiv=null;this.opener=null;this.innerFrame=null;this.innerWin=null;this.innerDoc=null;this.zindex=900;this.cancelButton=null;this.okButton=null;if(arguments.length>0&&typeof(arguments[0])=="string"){this.ID=arguments[0]}else{if(arguments.length>0&&typeof(arguments[0])=="object"){Dialog.setOptions(this,arguments[0])}}if(!this.ID){this.ID=topWin.Dialog._Array.length+""}};Dialog._Array=[];Dialog.bgDiv=null;Dialog.setOptions=function(c,b){if(!b){return}for(var a in b){c[a]=b[a]}};Dialog.attachBehaviors=function(){if(isIE){document.attachEvent("onkeydown",Dialog.onKeyDown);window.attachEvent("onresize",Dialog.resetPosition);if(!HideScrollbar&&ielt7){window.attachEvent("onscroll",Dialog.resetPosition)}}else{document.addEventListener("keydown",Dialog.onKeyDown,false);window.addEventListener("resize",Dialog.resetPosition,false);if(!HideScrollbar&&ielt7){window.addEventListener("scroll",Dialog.resetPosition,false)}}};Dialog.prototype.attachBehaviors=function(){if(this.Drag&&topWin.Drag){topWin.Drag.init(topWin.$id("_Draghandle_"+this.ID),topWin.$id("_DialogDiv_"+this.ID))}if(!isIE&&this.URL){var a=this;topWin.$id("_DialogDiv_"+this.ID).onDragStart=function(){topWin.$id("_Covering_"+a.ID).style.display=""};topWin.$id("_DialogDiv_"+this.ID).onDragEnd=function(){topWin.$id("_Covering_"+a.ID).style.display="none"}}};Dialog.prototype.displacePath=function(){if(this.URL.substr(0,7)=="http://"||this.URL.substr(0,1)=="/"||this.URL.substr(0,11)=="javascript:"){return this.URL}else{var a=this.URL;var b=window.location.href;b=b.substring(0,b.lastIndexOf("/"));while(a.indexOf("../")>=0){a=a.substring(3);b=b.substring(0,b.lastIndexOf("/"))}return b+"/"+a}};Dialog.prototype.setPosition=function(){var d=$bodyDimensions(topWin);var g=this.Top,b=this.Left,c=this.getDialogDiv();if(typeof this.Top=="string"&&this.Top.substring(this.Top.length-1,this.Top.length)=="%"){var f=this.Top.substring(0,this.Top.length-1)*0.01;g=ielt7?d.clientHeight*f-c.scrollHeight*f+d.scrollTop:d.clientHeight*f-c.scrollHeight*f}if(typeof this.Left=="string"&&this.Left.substring(this.Left.length-1,this.Left.length)=="%"){var a=this.Left.substring(0,this.Left.length-1)*0.01;b=ielt7?d.clientWidth*a-c.scrollWidth*a+d.scrollLeft:d.clientWidth*a-c.scrollWidth*a}c.style.top=Math.round(g)+"px";c.style.left=Math.round(b)+"px"};Dialog.setBgDivSize=function(){var a=$bodyDimensions(topWin);if(Dialog.bgDiv){if(ielt7){Dialog.bgDiv.style.height=a.clientHeight+"px";Dialog.bgDiv.style.top=a.scrollTop+"px";Dialog.bgDiv.childNodes[0].style.display="none";Dialog.bgDiv.childNodes[0].style.display=""}else{Dialog.bgDiv.style.height=a.scrollHeight+"px"}}};Dialog.resetPosition=function(){Dialog.setBgDivSize();for(var b=0,a=topWin.Dialog._Array.length;b<a;b++){topWin.Dialog._Array[b].setPosition()}};Dialog.prototype.create=function(){var h=$bodyDimensions(topWin);if(typeof(this.OKEvent)=="function"){this.ShowButtonRow=true}if(!this.Width){this.Width=Math.round(h.clientWidth*4/10)}if(!this.Height){this.Height=Math.round(this.Width/2)}if(this.MessageTitle||this.Message){this.ShowMessageRow=true}var c=this.Width+13+13;var g=this.Height+33+13+(this.ShowButtonRow?40:0)+(this.ShowMessageRow?50:0);if(c>h.clientWidth){this.Width=Math.round(h.clientWidth-26)}if(g>h.clientHeight){this.Height=Math.round(h.clientHeight-46-(this.ShowButtonRow?40:0)-(this.ShowMessageRow?50:0))}var f='  <table id="_DialogTable_'+this.ID+'" width="'+(this.Width+26)+'" cellspacing="0" cellpadding="0" border="0" onselectstart="return false;" style="-moz-user-select: -moz-none; font-size:12px; line-height:1.4;border-collapse: collapse;">    <tr id="_Draghandle_'+this.ID+'" style="'+(this.Drag?"cursor: move;":"")+'">      <td width="13" height="33" style="background-image: url('+IMAGESPATH+"dialog_lt.png) !important;background: url("+IMAGESPATH+'dialog_lt.gif) no-repeat 0 0;"><div style="width: 13px;"></div></td>      <td height="33" style="background-image:url('+IMAGESPATH+"dialog_ct.png) !important;background: url("+IMAGESPATH+'dialog_ct.gif) repeat-x top;"><div style="padding: 9px 0 0 4px; float: left; font-weight: bold; color:#fff;"><img align="absmiddle" src="'+IMAGESPATH+'icon_dialog.gif"/><span id="_Title_'+this.ID+'">'+this.Title+"</span></div>        <div onclick=\"Dialog.getInstance('"+this.ID+"').cancelButton.onclick.apply(Dialog.getInstance('"+this.ID+"').cancelButton,[]);\" onmouseout=\"this.style.backgroundImage='url("+IMAGESPATH+"dialog_closebtn.gif)'\" onmouseover=\"this.style.backgroundImage='url("+IMAGESPATH+'dialog_closebtn_over.gif)\'" style="margin: 4px 0 0;*margin-top: 5px; position: relative;top:auto; cursor: pointer; float: right; height: 17px; width: 28px; background: url('+IMAGESPATH+"dialog_closebtn.gif) 0 0;"+(ielt7?"margin-top: 3px;":"")+(this.ShowCloseButton?"":"display:none;")+'"></div></td>      <td width="13" height="33" style="background-image: url('+IMAGESPATH+"dialog_rt.png) !important;background: url("+IMAGESPATH+'dialog_rt.gif) no-repeat right 0;"><div style="width: 13px;"><a id="_forTab_'+this.ID+'" href="#;"></a></div></td>    </tr>    <tr valign="top">      <td width="13" style="background-image: url('+IMAGESPATH+"dialog_mlm.png) !important;background: url("+IMAGESPATH+'dialog_mlm.gif) repeat-y left;"></td>      <td align="center"><table width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff">          <tr id="_MessageRow_'+this.ID+'" style="'+(this.ShowMessageRow?"":"display:none")+'">            <td valign="top" height="50"><table width="100%" cellspacing="0" cellpadding="0" border="0" style="background:#eaece9 url('+IMAGESPATH+'dialog_bg.jpg) no-repeat scroll right top;" id="_MessageTable_'+this.ID+'">                <tr>                  <td width="50" height="50" align="center"><img width="32" height="32" src="'+IMAGESPATH+this.MessageIcon+'" id="_MessageIcon_'+this.ID+'"/></td>                  <td align="left" style="line-height: 16px;"><div id="_MessageTitle_'+this.ID+'" style="font-weight:bold">'+this.MessageTitle+'</div>                    <div id="_Message_'+this.ID+'">'+this.Message+'</div></td>                </tr>              </table></td>          </tr>          <tr>            <td valign="top" align="center"><div id="_Container_'+this.ID+'" style="position: relative; width: '+this.Width+"px; height: "+this.Height+'px;">                <div style="position: absolute; height: 100%; width: 100%; display: none; background-color:#fff; opacity: 0.5;" id="_Covering_'+this.ID+'">&nbsp;</div>	'+(function(j){if(j.InnerHtml){return j.InnerHtml}if(j.URL){return'<iframe width="100%" height="100%" frameborder="0" style="border:none 0;" allowtransparency="true" id="_DialogFrame_'+j.ID+'" src="'+j.displacePath()+'"></iframe>'}return""})(this)+'              </div></td>          </tr>          <tr id="_ButtonRow_'+this.ID+'" style="'+(this.ShowButtonRow?"":"display:none")+'">            <td height="36"><div id="_DialogButtons_'+this.ID+'" style="border-top: 1px solid #DADEE5; padding: 8px 20px; text-align: center; background-color:#f6f6f6;">                <input type="button" value="确 定"  class="_ButtonCancel_" id="_ButtonOK_'+this.ID+'"/>                <input type="button" value="取 消" onclick="Dialog.getInstance(\''+this.ID+'\').close();" id="_ButtonCancel_'+this.ID+'"/>              </div></td>          </tr>        </table></td>      <td width="13" style="background-image: url('+IMAGESPATH+"dialog_mrm.png) !important;background: url("+IMAGESPATH+'dialog_mrm.gif) repeat-y right;"></td>    </tr>    <tr>      <td width="13" height="13" style="background-image: url('+IMAGESPATH+"dialog_lb.png) !important;background: url("+IMAGESPATH+'dialog_lb.gif) no-repeat 0 bottom;"></td>      <td style="background-image: url('+IMAGESPATH+"dialog_cb.png) !important;background: url("+IMAGESPATH+'dialog_cb.gif) repeat-x bottom;"></td>      <td width="13" height="13" style="background-image: url('+IMAGESPATH+"dialog_rb.png) !important;background: url("+IMAGESPATH+'dialog_rb.gif) no-repeat right bottom;"><a onfocus=\'$id("_forTab_'+this.ID+'").focus();\' href="#;"></a></td>    </tr>  </table></div>';var i=topWin.$id("_DialogDiv_"+this.ID);if(!i){i=topDoc.createElement("div");i.id="_DialogDiv_"+this.ID;topDoc.getElementsByTagName("BODY")[0].appendChild(i)}i.style.position=ielt7?"absolute":"fixed";i.style.left="-9999px";i.style.top="-9999px";i.innerHTML=f;if(this.InvokeElementId){var d=$id(this.InvokeElementId);d.style.position="";d.style.display="";if(isIE){var b=topDoc.createElement("div");b.innerHTML=d.outerHTML;d.outerHTML="";topWin.$id("_Covering_"+this.ID).parentNode.appendChild(b)}else{topWin.$id("_Covering_"+this.ID).parentNode.appendChild(d)}}this.opener=window;if(this.URL){if(topWin.$id("_DialogFrame_"+this.ID)){this.innerFrame=topWin.$id("_DialogFrame_"+this.ID)}var a=this;innerFrameOnload=function(){try{a.innerWin=a.innerFrame.contentWindow;a.innerWin.ownerDialog=a;a.innerDoc=a.innerWin.document;if(a.Title=="　"&&a.innerDoc&&a.innerDoc.title){if(a.innerDoc.title){topWin.$id("_Title_"+a.ID).innerHTML=a.innerDoc.title}}}catch(j){if(window.console&&window.console.log){console.log("可能存在访问限制，不能获取到弹出窗中的文档对象。")}}if(typeof(a.OnLoad)=="function"){a.OnLoad()}};if(this.innerFrame.attachEvent){this.innerFrame.attachEvent("onreadystatechange",function(){if((/loaded|complete/).test(a.innerFrame.readyState)){innerFrameOnload()}})}else{this.innerFrame.contentWindow.addEventListener("load",function(){innerFrameOnload()},false)}}topWin.$id("_DialogDiv_"+this.ID).dialogId=this.ID;topWin.$id("_DialogDiv_"+this.ID).dialogInstance=this;this.attachBehaviors();this.okButton=topWin.$id("_ButtonOK_"+this.ID);this.cancelButton=topWin.$id("_ButtonCancel_"+this.ID);i=null};Dialog.prototype.setSize=function(a,b){if(a&&+a>20){this.Width=+a;topWin.$id("_DialogTable_"+this.ID).width=this.Width+26;topWin.$id("_Container_"+this.ID).style.width=this.Width+"px"}if(b&&+b>10){this.Height=+b;topWin.$id("_Container_"+this.ID).style.height=this.Height+"px"}this.setPosition()};Dialog.prototype.show=function(){this.create();var b=Dialog.getBgdiv(),d=this.getDialogDiv();this.zindex=d.style.zIndex=Dialog.bgDiv.style.zIndex+1;if(topWin.Dialog._Array.length>0){this.zindex=d.style.zIndex=topWin.Dialog._Array[topWin.Dialog._Array.length-1].zindex+2}else{b.style.display="none";if(HideScrollbar){var c=topDoc.getElementsByTagName(topDoc.compatMode=="BackCompat"?"BODY":"HTML")[0];c.styleOverflow=c.style.overflow;c.style.overflow="hidden"}}topWin.Dialog._Array.push(this);if(this.Modal){b.style.zIndex=topWin.Dialog._Array[topWin.Dialog._Array.length-1].zindex-1;Dialog.setBgDivSize();if(b.style.display=="none"){if(this.Animator){var a=topWin.$id("_DialogBGMask");a.style.opacity=0;a.style.filter="alpha(opacity=0)";b.style.display="";fadeEffect(a,0,40,ielt7?20:10);a=null}else{b.style.display=""}}}this.setPosition();if(this.CancelEvent){this.cancelButton.onclick=this.CancelEvent;if(this.ShowButtonRow){this.cancelButton.focus()}}if(this.OKEvent){this.okButton.onclick=this.OKEvent}if(this.AutoClose&&this.AutoClose>0){this.autoClose()}this.opened=true;b=null};Dialog.prototype.close=function(){var g=this.getDialogDiv();if(this==topWin.Dialog._Array[topWin.Dialog._Array.length-1]){var c=topWin.Dialog._Array.pop()}else{topWin.Dialog._Array.remove(this)}if(this.InvokeElementId){var f=topWin.$id(this.InvokeElementId);f.style.display="none";if(isIE){var b=document.createElement("div");b.innerHTML=f.outerHTML;f.outerHTML="";document.getElementsByTagName("BODY")[0].appendChild(b)}else{document.getElementsByTagName("BODY")[0].appendChild(f)}}if(topWin.Dialog._Array.length>0){if(this.Modal&&c){Dialog.bgDiv.style.zIndex=topWin.Dialog._Array[topWin.Dialog._Array.length-1].zindex-1}}else{Dialog.bgDiv.style.zIndex="900";Dialog.bgDiv.style.display="none";if(HideScrollbar){var d=topDoc.getElementsByTagName(topDoc.compatMode=="BackCompat"?"BODY":"HTML")[0];if(d.styleOverflow!=undefined){d.style.overflow=d.styleOverflow}}}this.opener.focus();if(isIE){g.dialogInstance=null;if(this.innerFrame){this.innerFrame.detachEvent("onload",innerFrameOnload)}this.innerFrame=null;this.bgDiv=null;if(this.CancelEvent){this.cancelButton.onclick=null}if(this.OKEvent){this.okButton.onclick=null}topWin.$id("_DialogDiv_"+this.ID).onDragStart=null;topWin.$id("_DialogDiv_"+this.ID).onDragEnd=null;topWin.$id("_Draghandle_"+this.ID).onmousedown=null;topWin.$id("_Draghandle_"+this.ID).root=null;g.outerHTML="";CollectGarbage()}else{var a=topWin.$id("_RycDiv");if(!a){a=topDoc.createElement("div");a.id="_RycDiv"}a.appendChild(g);a.innerHTML="";a=null}g=null;this.closed=true};Dialog.prototype.autoClose=function(){if(this.closed){clearTimeout(this._closeTimeoutId);return}this.AutoClose-=1;topWin.$id("_Title_"+this.ID).innerHTML=this.AutoClose+" 秒后自动关闭";if(this.AutoClose<=0){this.close()}else{var a=this;this._closeTimeoutId=setTimeout(function(){a.autoClose()},1000)}};Dialog.getInstance=function(b){var a=topWin.$id("_DialogDiv_"+b);if(!a){alert("没有取到对应ID的弹出框页面对象")}try{return a.dialogInstance}finally{a=null}};Dialog.prototype.addButton=function(f,a,d){topWin.$id("_ButtonRow_"+this.ID).style.display="";this.ShowButtonRow=true;var c=topDoc.createElement("input");c.id="_Button_"+this.ID+"_"+f;c.type="button";c.style.cssText="margin-right:5px";c.value=a;c.onclick=d;var b=topWin.$id("_DialogButtons_"+this.ID).getElementsByTagName("INPUT")[0];b.parentNode.insertBefore(c,b);return c};Dialog.prototype.removeButton=function(b){var a=topWin.$id("_DialogButtons_"+this.ID).getElementsByTagName("INPUT")[0];a.parentNode.removeChild(b)};Dialog.getBgdiv=function(){if(Dialog.bgDiv){return Dialog.bgDiv}var d=topWin.$id("_DialogBGDiv");if(!d){d=topDoc.createElement("div");d.id="_DialogBGDiv";d.style.cssText="position:absolute;left:0px;top:0px;width:100%;height:100%;z-index:900";var a='<div style="position:relative;width:100%;height:100%;">';var c='<div id="_DialogBGMask" style="position:absolute;background-color:#333;opacity:0.4;filter:alpha(opacity=40);width:100%;height:100%;"></div>';var f=ielt7?'<iframe src="about:blank" style="filter:alpha(opacity=0);" width="100%" height="100%"></iframe>':"";d.innerHTML=a+c+f+"</div>";topDoc.getElementsByTagName("BODY")[0].appendChild(d);if(ielt7){var b=d.getElementsByTagName("IFRAME")[0].contentWindow.document;b.open();b.write("<body style='background-color:#333' oncontextmenu='return false;'></body>");b.close();b=null}}Dialog.bgDiv=d;d=null;return Dialog.bgDiv};Dialog.prototype.getDialogDiv=function(){var a=topWin.$id("_DialogDiv_"+this.ID);if(!a){alert("获取弹出层页面对象出错！")}try{return a}finally{a=null}};Dialog.onKeyDown=function(a){if(a.shiftKey&&a.keyCode==9){if(topWin.Dialog._Array.length>0){stopEvent(a);return false}}if(a.keyCode==27){Dialog.close()}};Dialog.close=function(b){if(topWin.Dialog._Array.length>0){var a=topWin.Dialog._Array[topWin.Dialog._Array.length-1];if(a.MsgForESC){Dialog.confirm(a.MsgForESC,function(){a.cancelButton.onclick.apply(a.cancelButton,[])})}else{a.cancelButton.onclick.apply(a.cancelButton,[])}}};Dialog.alert=function(f,c,a,b){var a=a||300,b=b||110;var d=new Dialog({Width:a,Height:b});d.ShowButtonRow=true;d.Title="系统提示";d.CancelEvent=function(){d.close();if(c){c()}};d.InnerHtml='<table height="100%" border="0" align="center" cellpadding="10" cellspacing="0">		<tr><td align="right"><img id="Icon_'+this.ID+'" src="'+IMAGESPATH+'icon_alert.gif" width="34" height="34" align="absmiddle"></td>			<td align="left" id="Message_'+this.ID+'" style="font-size:9pt">'+f+"</td></tr>	</table>";d.show();d.okButton.parentNode.style.textAlign="center";d.okButton.style.display="none";d.cancelButton.value="确 定";d.cancelButton.focus()};Dialog.confirm=function(g,c,b,a,d){var a=a||300,d=d||110;var f=new Dialog({Width:a,Height:d});f.ShowButtonRow=true;f.Title="信息确认";f.CancelEvent=function(){f.close();if(b){b()}};f.OKEvent=function(){f.close();if(c){c()}};f.InnerHtml='<table height="100%" border="0" align="center" cellpadding="10" cellspacing="0">		<tr><td align="right"><img id="Icon_'+this.ID+'" src="'+IMAGESPATH+'icon_query.gif" width="34" height="34" align="absmiddle"></td>			<td align="left" id="Message_'+this.ID+'" style="font-size:9pt">'+g+"</td></tr>	</table>";f.show();f.okButton.parentNode.style.textAlign="center";f.okButton.focus()};Dialog.open=function(a){var b=new Dialog(a);b.show();return b};if(isIE){window.attachEvent("onload",Dialog.attachBehaviors)}else{window.addEventListener("load",Dialog.attachBehaviors,false)};
