function showModalDialog(a,b,c,e,l,h){c=c||{};var f=c.closeIcon||"../image/close.gif";f=absolutePath(f);a=absolutePath(a);var k=frame_check(window),g=k.document.body,d=function(){};g.popParent=window;(function(){var m=$("<div>").addClass("popcover").appendTo(g);var q=function(){$("input").first().trigger("focus").trigger("blur");null!=getPopParent()&&(e?e.focus():getPopParent().focus());0==arguments.length&&d();null!=p&&($(p.contentWindow).empty(),p.attr("src","about:blank"),p.empty(),p.remove(),
p=null);n.remove();m.remove();g.popParent=null};var n=$("<div>").addClass("popdialog").css({width:c.width||"85%",height:c.height||"85%",left:c.left||"5%",top:c.top||"5%",display:"none"}).appendTo(g);var t=$("<div>").addClass("popresize").css({position:"absolute",bottom:"0px",right:"0px",padding:"0",margin:"0",cursor:"nw-resize"}).appendTo(n);$("<div>").addClass("pophead").css({position:"absolute",top:"0px",right:"0px"}).on("click",function(){q()}).on("mousedown",function(){return!1}).appendTo(n);
var p=$("<iframe>").appendTo(n).attr("src",a).on("load",function(){n.css({display:"block"})});$("<div>").addClass("closeButton").css({width:"100%",left:"0px",top:"0px"}).appendTo(m).on("click",function(){q()}).append('<img src="'+f+'" style="left:'+n.css("left")+';"/>');showModalDialog.dialogArguments=b;showModalDialog.returnValue=function(r){q(r);ogPchangeData(r,e,l,h)};showModalDialog.cancel=function(){q()};showModalDialog.setCallback=function(r){d=r};showModalDialog.getPopParent=function(){return g.popParent};
$(g.popParent).on("unload",function(){q(1)});hybsDraggable(n,k);hybsResizable(t,g)})()}function getPopParent(){return parent.document.body.popParent?parent.document.body.popParent:parent.parent.document.body.popParent?parent.parent.document.body.popParent:parent.parent.parent.document.body.popParent?parent.parent.parent.document.body.popParent:null}
function getPopArgs(){if("undefined"!=typeof window.dialogArguments)return window.dialogArguments;var a=getPopParent();if(null!=a)return a.showModalDialog.dialogArguments}function setPopCallback(a){var b=getPopParent();null!=b&&b.showModalDialog.setCallback(a)}function popClose(){var a=getPopParent();null!=a&&a.showModalDialog.cancel()}
function frame_check(a){if(a.parent.document.URL==a.document.URL)return a;try{$(a.parent.document.body);var b=frame_check(a.parent);return 0<b.document.body.getElementsByTagName("frame").length?a:0<$(b.document.body).find(".popcover").length?a:b}catch(c){return a}}function absolutePath(a){var b=document.createElement("span");b.innerHTML='<a href="'+a+'" />';return b.firstChild.href}
function ogPchangeData(a,b,c,e){null!=a&&"object"!==typeof a&&(a=Array(a));var l=function(d){d.focus();if(void 0!=document.selection){var m=document.selection.createRange();m.moveStart("character",-d.value.length);return m.text.length}return d.selectionStart},h=[];if(null!=a&&null!=c)for(j=0;j<c.length&&j<a.length;j++)if(""!=c[j]&&(tmp=$(b).closest("form").get(0).elements[c[j]],null!=tmp))if(0==c[j].indexOf("h_")&&tmp.length)for(var f=0;f<tmp.length;f++){var k=tmp[f].value;if("true"==e){var g=l(tmp[f]);
tmp[f].value=tmp[f].value.substring(0,g)+a[j]+tmp[f].value.substring(g,tmp[f].value.length)}else tmp[f].value=a[j];k!=a[j]&&(h[h.length]=tmp[f])}else k=tmp.value,"true"==e?(g=l(tmp),tmp.value=tmp.value.substring(0,g)+a[j]+tmp.value.substring(g,tmp.value.length)):tmp.value=a[j],k!=a[j]&&(h[h.length]=tmp);for(i=0;i<h.length;i++)$(h[i]).trigger("change");null!=a&&"_RENEW"==a[0]&&(0<a[1].indexOf("?")?location.href=a[1]+"&command=RENEW":location.href=a[1]+"?command=RENEW")}
function hybsDraggable(a,b){var c=!1,e,l,h,f,k=b.document.body,g;$(a).on("mousedown",function(d){e=d.offsetX||d.layerX;l=d.offsetY||d.layerY;if(c)c=!1;else return c=!0,$(this).offset(),g=$("<div>").addClass("resizecover").css({width:"99%",height:"99%",left:"0px",top:"20px",position:"absolute",background:"transparent"}).appendTo(this).on("click",function(){$(this).remove()}),!1});$(k).on("mouseup",function(d){c&&(c=!1,d=$(a).offset(),0>d.left&&$(a).css("left","0px"),0>d.top&&$(a).css("top","0px"),
g.remove())});$(k).on("mousemove",function(d){if(c)return h=b.pageXOffset||b.document.documentElement.scrollLeft,f=b.pageYOffset||b.document.documentElement.scrollTop,$(a).css("left",d.clientX-e+h+"px"),$(a).css("top",d.clientY-l+f+"px"),!1})}
function hybsResizable(a,b){var c=!1,e,l,h,f,k,g;$(a).on("mousedown",function(d){h=d.clientX;f=d.clientY;e=this.parentNode;k=$(e).height();g=$(e).width();if(!c)return c=!0,l=$("<div>").addClass("resizecover").css({width:"99%",height:"99%",left:"0px",top:"0px",position:"absolute",background:"transparent"}).appendTo(e).on("click",function(){$(this).remove()}),d.stopPropagation(),!1;d.stopPropagation()});$(b).on("mouseup",function(d){c&&(c=!1,50>$(e).width()&&$(e).width("50px"),50>$(e).height()&&$(e).height("50px"),
l.remove())});$(b).on("mousemove",function(d){if(c){var m=h-d.clientX;d=f-d.clientY;$(e).width(g-m+"px");$(e).height(k-d+"px");return!1}})}function rtnPopup(a){window.returnValue=a;var b=getPopParent();null!=b&&b.showModalDialog.returnValue(a)}
function ogPopup(a,b,c,e,l,h,f,k,g){b=b?parseInt(b,10)+"px":"85%";c=c?parseInt(c,10)+"px":"85%";a=a+"?command="+(f?f:"NEW");f={};f.height=b;f.width=c;if(null!=e)for(b=0;b<e.length;b+=2)a=a+"&"+e[b]+"="+encodeURIComponent(e[b+1]);e="";null!=h&&document.getElementById(h[0])&&(e=document.getElementById(h[0]).value);showModalDialog(a,e,f,l,h,k)};
