var Window=Class.create();Window.keepMultiModalWindow=false;Window.prototype={initialize:function(B){if($(B)){alert("Window "+B+" is already register is the DOM!!, be sure to use setDestroyOnClose()")}this.hasEffectLib=String.prototype.parseColor!=null;this.options=Object.extend({className:"dialog",minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(this.hasEffectLib?Effect.Appear:Element.show),hideEffect:(this.hasEffectLib?Effect.Fade:Element.hide),showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.body,title:"&nbsp;",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,recenterAuto:true,allowTransparency:false,rowHeader:true,rowFooter:true,wiredDrag:false},arguments[1]||{});if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions);if(this.options.showEffect==Element.Appear){this.options.showEffectOptions.to=this.options.opacity}}if(this.options.showEffect==Effect.Appear){this.options.showEffectOptions.to=this.options.opacity}if(this.options.hideEffect==Effect.Fade){this.options.hideEffectOptions.from=this.options.opacity}if(this.options.hideEffect==Element.hide){this.options.hideEffect=function(){Element.hide(this.element);if(this.destroyOnClose){this.destroy()}}.bind(this)}this.element=this._createWindow(B);this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventOnLoad=this._getWindowBorderSize.bindAsEventListener(this);this.eventMouseDownContent=this.toFront.bindAsEventListener(this);this.eventResize=this._recenter.bindAsEventListener(this);if(this.options.rowHeader){this.topbar=$(this.element.id+"_top")}if(this.options.rowFooter){this.bottombar=$(this.element.id+"_bottom")}this.content=$(this.element.id+"_content");if(this.options.rowHeader){Event.observe(this.topbar,"mousedown",this.eventMouseDown)}if(this.options.rowFooter){Event.observe(this.bottombar,"mousedown",this.eventMouseDown)}Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);Event.observe(window,"resize",this.eventResize);if(this.options.draggable){var A=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(C){C.observe("mousedown",A.eventMouseDown);C.addClassName("top_draggable")});[this.bottombar,this.bottombar.up().previous(),this.bottombar.up().next()].each(function(C){C.observe("mousedown",A.eventMouseDown);C.addClassName("bottom_draggable")})}if(this.options.resizable){this.sizer=$(this.element.id+"_sizer");Event.observe(this.sizer,"mousedown",this.eventMouseDown)}this.useLeft=null;this.useTop=null;if(arguments[1].left!=null){this.element.setStyle({left:parseFloat(arguments[1].left)+"px"});this.useLeft=true}if(arguments[1].right!=null){this.element.setStyle({right:parseFloat(arguments[1].right)+"px"});this.useLeft=false}if(this.useLeft==null){this.element.setStyle({left:"0px"});this.useLeft=true}if(arguments[1].top!=null){this.element.setStyle({top:parseFloat(arguments[1].top)+"px"});this.useTop=true}if(arguments[1].bottom!=null){this.element.setStyle({bottom:parseFloat(arguments[1].bottom)+"px"});this.useTop=false}if(this.useTop==null){this.element.setStyle({top:"0px"});this.useTop=true}this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex){this.setZIndex(this.options.zIndex)}this.destroyOnClose=false;this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;this.constraint=false;this.constraintPad={top:0,left:0,bottom:0,right:0};if(this.width&&this.height){this.setSize(this.options.width,this.options.height)}if(this.options.rowHeader){this.setTitle(this.options.title)}Windows.register(this)},destroy:function(){Windows.notify("onDestroy",this);if(this.options.rowHeader){Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown)}if(this.options.rowFooter){Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown)}Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);Event.stopObserving(window,"resize",this.eventResize);Event.stopObserving(this.content,"load",this.options.onload);if(this._oldParent){var C=this.getContent();var A=null;for(var B=0;B<C.childNodes.length;B++){A=C.childNodes[B];if(A.nodeType==1){break}A=null}if(A){this._oldParent.appendChild(A)}this._oldParent=null}if(this.sizer){Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown)}if(this.options.url){this.content.src=null}if(this.iefix){Element.remove(this.iefix)}Element.remove(this.element);Windows.unregister(this)},setDelegate:function(A){this.delegate=A},getDelegate:function(){return this.delegate},getContent:function(){return this.content},setContent:function(G,F,B){var A=$(G);if(null==A){throw"Unable to find element '"+G+"' in DOM"}this._oldParent=A.parentNode;var E=null;var D=null;if(F){E=Element.getDimensions(A)}if(B){D=Position.cumulativeOffset(A)}var C=this.getContent();C.appendChild(A);A.show();if(F){this.setSize(E.width,E.height)}if(B){this.setLocation(D[1]-this.heightN,D[0]-this.widthW)}},setHTMLContent:function(A){if(this.options.url){this.content.src=null;this.options.url=null;var B='<div id="'+this.getId()+'_content" class="'+this.options.className+'_content"> </div>';$(this.getId()+"_table_content").innerHTML=B;this.content=$(this.element.id+"_content")}this.getContent().innerHTML=A},setAjaxContent:function(B,A,D,C){this.showFunction=D?"showCenter":"show";this.showModal=C||false;if(A==null){A={}}this.onComplete=A.onComplete;if(!this._onCompleteHandler){this._onCompleteHandler=this._setAjaxContent.bind(this)}A.onComplete=this._onCompleteHandler;new Ajax.Request(B,A);A.onComplete=this.onComplete},_setAjaxContent:function(A){Element.update(this.getContent(),A.responseText);if(this.onComplete){this.onComplete(A)}this.onComplete=null;this[this.showFunction](this.showModal)},setURL:function(B){if(!this.options.url){this.options.url=B;var A;if(this.options.allowTransparency){A='allowTransparency="true"'}var C='<iframe frameborder="0" name="'+this.getId()+'_content"  id="'+this.getId()+'_content" src="'+B+'" '+A+"> </iframe>";$(this.getId()+"_table_content").innerHTML=C;this.content=$(this.element.id+"_content")}else{this.options.url=B;$(this.element.getAttribute("id")+"_content").src=B}},getURL:function(){return this.options.url?this.options.url:null},refresh:function(){if(this.options.url){$(this.element.getAttribute("id")+"_content").src=this.options.url}},setCookie:function(B,C,M,E,A){B=B||this.element.id;this.cookie=[B,C,M,E,A];var K=WindowUtilities.getCookie(B);if(K){var L=K.split(",");var I=L[0].split(":");var H=L[1].split(":");var J=parseFloat(L[2]),F=parseFloat(L[3]);var G=L[4];var D=L[5];this.setSize(J,F);if(G=="true"){this.doMinimize=true}else{if(D=="true"){this.doMaximize=true}}this.useLeft=I[0]=="l";this.useTop=H[0]=="t";this.element.setStyle(this.useLeft?{left:I[1]}:{right:I[1]});this.element.setStyle(this.useTop?{top:H[1]}:{bottom:H[1]})}},getId:function(){return this.element.id},setDestroyOnClose:function(){var A=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var B=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){B();A()}}else{this.options.hideEffectOptions.afterFinish=function(){A()}}this.destroyOnClose=true},setConstraint:function(A,B){this.constraint=A;this.constraintPad=Object.extend(this.constraintPad,B||{});if(this.useTop&&this.useLeft){this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left))}},_initDrag:function(B){if(isIE&&this.heightN==0){this._getWindowBorderSize()}this.pointer=[Event.pointerX(B),Event.pointerY(B)];if(this.options.wiredDrag){this.currentDrag=this._createWiredElement()}else{this.currentDrag=this.element}if(Event.element(B)==this.sizer){this.doResize=true;this.widthOrg=this.width;this.heightOrg=this.height;this.bottomOrg=parseFloat(this.element.getStyle("bottom"));this.rightOrg=parseFloat(this.element.getStyle("right"));Windows.notify("onStartResize",this)}else{this.doResize=false;var A=$(this.getId()+"_close");if(A&&Position.within(A,this.pointer[0],this.pointer[1])){this.currentDrag=null;return}this.toFront();if(!this.options.draggable){return}Windows.notify("onStartMove",this)}Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen("__invisible__","__invisible__");document.body.ondrag=function(){return false};document.body.onselectstart=function(){return false};this.currentDrag.show();Event.stop(B)},_updateDrag:function(B){var A=[Event.pointerX(B),Event.pointerY(B)];var J=A[0]-this.pointer[0];var I=A[1]-this.pointer[1];if(this.doResize){var H=this.widthOrg+J;var D=this.heightOrg+I;J=this.width-this.widthOrg;I=this.height-this.heightOrg;if(this.useLeft){H=this._updateWidthConstraint(H)}else{this.currentDrag.setStyle({right:(this.rightOrg-J)+"px"})}if(this.useTop){D=this._updateHeightConstraint(D)}else{this.currentDrag.setStyle({bottom:(this.bottomOrg-I)+"px"})}this.setSize(H,D);Windows.notify("onResize",this)}else{this.pointer=A;if(this.useLeft){var C=parseFloat(this.currentDrag.getStyle("left"))+J;var G=this._updateLeftConstraint(C);this.pointer[0]+=G-C;this.currentDrag.setStyle({left:G+"px"})}else{this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle("right"))-J+"px"})}if(this.useTop){var F=parseFloat(this.currentDrag.getStyle("top"))+I;var E=this._updateTopConstraint(F);this.pointer[1]+=E-F;this.currentDrag.setStyle({top:E+"px"})}else{this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle("bottom"))-I+"px"})}}if(this.iefix){this._fixIEOverlapping()}this._removeStoreLocation();Event.stop(B)},_endDrag:function(A){WindowUtilities.enableScreen("__invisible__");if(this.doResize){Windows.notify("onEndResize",this)}else{Windows.notify("onEndMove",this)}Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);Event.stop(A);this._hideWiredElement();this._saveCookie();document.body.ondrag=null;document.body.onselectstart=null},_updateLeftConstraint:function(B){if(this.constraint&&this.useLeft&&this.useTop){var A=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(B<this.constraintPad.left){B=this.constraintPad.left}if(B+this.width+this.widthE+this.widthW>A-this.constraintPad.right){B=A-this.constraintPad.right-this.width-this.widthE-this.widthW}}return B},_updateTopConstraint:function(B){if(this.constraint&&this.useLeft&&this.useTop){var A=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;if(B<this.constraintPad.top){B=this.constraintPad.top}if(B+this.height+this.heightN+this.heightS>A-this.constraintPad.bottom){B=A-this.constraintPad.bottom-this.height-this.heightS-this.heightN}}return B},_updateWidthConstraint:function(A){if(this.constraint&&this.useLeft&&this.useTop){var B=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;var C=parseFloat(this.element.getStyle("left"));if(C+A+this.widthE+this.widthW>B-this.constraintPad.right){A=B-this.constraintPad.right-C-this.widthE-this.widthW}}return A},_updateHeightConstraint:function(B){if(this.constraint&&this.useLeft&&this.useTop){var A=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var C=parseFloat(this.element.getStyle("top"));if(C+B+this.heightN+this.heightS>A-this.constraintPad.bottom){B=A-this.constraintPad.bottom-C-this.heightN-this.heightS}}return B},_createWindow:function(A){var F=this.options.className;var D=document.createElement("div");D.setAttribute("id",A);D.className="dialog";var E;if(this.options.url){E='<iframe frameborder="0" name="'+A+'_content"  id="'+A+'_content" src="'+this.options.url+'"> </iframe>'}else{E='<div id="'+A+'_content" class="'+F+'_content"> </div>'}var G=this.options.closable?"<div class='"+F+"_close' id='"+A+"_close' onclick='Windows.close(\""+A+"\", event)'> </div>":"";var H=this.options.minimizable?"<div class='"+F+"_minimize' id='"+A+"_minimize' onclick='Windows.minimize(\""+A+"\", event)'> </div>":"";var I=this.options.maximizable?"<div class='"+F+"_maximize' id='"+A+"_maximize' onclick='Windows.maximize(\""+A+"\", event)'> </div>":"";var C=this.options.resizable?"class='"+F+"_sizer' id='"+A+"_sizer'":"class='"+F+"_se'";var K=this.options.rowHeader?G+H+I+"      <table id='"+A+"_row1' class=\"top table_window\" cellspacing='0' cellpadding='0'>        <tr>          <td class='"+F+"_nw'>&nbsp;</td>          <td class='"+F+"_n'><div id='"+A+"_top' class='"+F+"_title title_window'>"+this.options.title+"</div></td>          <td class='"+F+"_ne'>&nbsp;</td>        </tr>      </table>      ":"";var J="<table id='"+A+"_row2' class=\"mid table_window\" border='0' cellspacing='0' cellpadding='0'>         <tr>          <td class='"+F+"_w'>&nbsp;</td>            <td id='"+A+"_table_content' class='"+F+"_content' valign='top'>"+E+"</td>          <td class='"+F+"_e'>&nbsp;</td>        </tr>      </table>    ";var B=this.options.rowFooter?"	<table id='"+A+"_row3' class=\"bot table_window\" cellspacing='0' cellpadding='0'>        <tr>          <td class='"+F+"_sw'>&nbsp;</td>            <td class='"+F+"_s'><div id='"+A+"_bottom' class='status_bar'>&nbsp;</div>aca</td>            <td "+C+">&nbsp;</td>        </tr>      </table>    ":"";D.innerHTML=K+J+B;Element.hide(D);this.options.parent.insertBefore(D,this.options.parent.firstChild);Event.observe($(A+"_content"),"load",this.options.onload);return D},changeClassName:function(A){var B=this.options.className;var D=this.getId();var C=this;$A(["_close","_minimize","_maximize","_sizer","_content"]).each(function(E){C._toggleClassName($(D+E),B+E,A+E)});$$("#"+D+" td").each(function(E){E.className=E.className.sub(B,A)});this.options.className=A},_toggleClassName:function(C,B,A){if(C){C.removeClassName(B);C.addClassName(A)}},setLocation:function(B,A){B=this._updateTopConstraint(B);A=this._updateLeftConstraint(A);this.element.setStyle({top:B+"px"});this.element.setStyle({left:A+"px"});this.useLeft=true;this.useTop=true},getLocation:function(){var A={};if(this.useTop){A=Object.extend(A,{top:this.element.getStyle("top")})}else{A=Object.extend(A,{bottom:this.element.getStyle("bottom")})}if(this.useLeft){A=Object.extend(A,{left:this.element.getStyle("left")})}else{A=Object.extend(A,{right:this.element.getStyle("right")})}return A},getSize:function(){return{width:this.width,height:this.height}},setSize:function(B,A){B=parseFloat(B);A=parseFloat(A);if(B<this.options.minWidth){B=this.options.minWidth}if(A<this.options.minHeight){A=this.options.minHeight}if(this.options.maxHeight&&A>this.options.maxHeight){A=this.options.maxHeight}if(this.options.maxWidth&&B>this.options.maxWidth){B=this.options.maxWidth}this.width=B;this.height=A;var D=this.currentDrag?this.currentDrag:this.element;D.setStyle({width:B+this.widthW+this.widthE+"px"});D.setStyle({height:A+this.heightN+this.heightS+"px"});if(!this.currentDrag||this.currentDrag==this.element){var C=$(this.element.id+"_content");C.setStyle({height:A+"px"});C.setStyle({width:B+"px"})}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight)},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height)},toFront:function(){if(Windows.focusedWindow==this){return}this.setZIndex(Windows.maxZIndex+20);Windows.notify("onFocus",this)},show:function(B){if(B){Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+20);Windows.unsetOverflow(this)}if(this.oldStyle){this.getContent().setStyle({overflow:this.oldStyle})}if(!this.width||!this.height){var A=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className);if(this.height){this.width=A+5}else{this.height=A+5}}this.setSize(this.width,this.height);if(this.centered){this._center(this.centerTop,this.centerLeft)}Windows.notify("onBeforeShow",this);if(this.options.showEffect!=Element.show&&this.options.showEffectOptions){this.options.showEffect(this.element,this.options.showEffectOptions)}else{this.options.showEffect(this.element)}this._checkIEOverlapping();this.visible=true;WindowUtilities.focusedWindow=this;Windows.notify("onShow",this)},showCenter:function(A,C,B){this.centered=true;this.centerTop=C;this.centerLeft=B;this.show(A)},isVisible:function(){return this.visible},_center:function(C,B){var D=WindowUtilities.getWindowScroll();var A=WindowUtilities.getPageSize();if(!C){C=(A.windowHeight-(this.height+this.heightN+this.heightS))/2}C+=D.top;if(!B){B=(A.windowWidth-(this.width+this.widthW+this.widthE))/2}B+=D.left;this.setLocation(C,B);this.toFront()},_recenter:function(B){if(this.modal&&this.centered){var A=WindowUtilities.getPageSize();if(this.pageSize&&this.pageSize.pageWidth==A.windowWidth&&this.pageSize.pageHeight==A.windowHeight){return}this.pageSize=A;if($("overlay_modal")){$("overlay_modal").style.height=(A.pageHeight+"px");$("overlay_modal").style.width=(A.pageWidth+"px")}if(this.options.recenterAuto){this._center(this.centerTop,this.centerLeft)}}},hide:function(){this.visible=false;if(this.modal){Windows.removeModalWindow(this);Windows.resetOverflow()}this.oldStyle=this.getContent().getStyle("overflow")||"auto";this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix){this.iefix.hide()}Windows.notify("onHide",this)},minimize:function(){var A=$(this.getId()+"_row2");var D=A.getDimensions().height;if(A.visible()){var C=this.element.getHeight()-D;A.hide();this.element.setStyle({height:C+"px"});if(!this.useTop){var B=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(B+D)+"px"})}}else{var C=this.element.getHeight()+D;this.element.setStyle({height:C+"px"});if(!this.useTop){var B=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(B-D)+"px"})}A.show();this.toFront()}Windows.notify("onMinimize",this);this._saveCookie()},maximize:function(){if(this.storedLocation!=null){this._restoreLocation();if(this.iefix){this.iefix.hide()}}else{this._storeLocation();Windows.unsetOverflow(this);var B=WindowUtilities.getWindowScroll();var A=WindowUtilities.getPageSize();this.element.setStyle(this.useLeft?{left:B.left}:{right:B.left});this.element.setStyle(this.useTop?{top:B.top}:{bottom:B.top});this.setSize(A.windowWidth-this.widthW-this.widthE,A.windowHeight-this.heightN-this.heightS);this.toFront();if(this.iefix){this._fixIEOverlapping()}}Windows.notify("onMaximize",this);this._saveCookie()},isMinimized:function(){var A=$(this.getId()+"_row2");return !A.visible()},isMaximized:function(){return(this.storedLocation!=null)},setOpacity:function(A){if(Element.setOpacity){Element.setOpacity(this.element,A)}},setZIndex:function(A){this.element.setStyle({zIndex:A});Windows.updateZindex(A,this)},setTitle:function(A){if(!A||A==""){A="&nbsp;"}Element.update(this.element.id+"_top",A)},setStatusBar:function(B){var A=$(this.getId()+"_bottom");if(typeof(B)=="object"){if(this.bottombar.firstChild){this.bottombar.replaceChild(B,this.bottombar.firstChild)}else{this.bottombar.appendChild(B)}}else{this.bottombar.innerHTML=B}},_checkIEOverlapping:function(){if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(this.element.getStyle("position")=="absolute")){new Insertion.After(this.element.id,'<iframe id="'+this.element.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.element.id+"_iefix")}if(this.iefix){setTimeout(this._fixIEOverlapping.bind(this),50)}},_fixIEOverlapping:function(){Position.clone(this.element,this.iefix);this.iefix.style.zIndex=this.element.style.zIndex-1;this.iefix.show()},_getWindowBorderSize:function(A){var B=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(B).height;B.parentNode.removeChild(B);var B=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(B).height;B.parentNode.removeChild(B);var B=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(B).width;B.parentNode.removeChild(B);var B=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(B).width;B.parentNode.removeChild(B);if(isIE){if(this.options.rowFooter){this.heightS=$(this.getId()+"_row3").getDimensions().height}if(this.options.rowHeader){this.heightN=$(this.getId()+"_row1").getDimensions().height}}if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){this.setSize(this.width,this.height)}if(this.doMaximize){this.maximize()}if(this.doMinimize){this.minimize()}},_createHiddenDiv:function(B){var A=document.body;var C=document.createElement("div");C.setAttribute("id",this.element.id+"_tmp");C.className=B;C.style.display="none";C.innerHTML="";A.insertBefore(C,A.firstChild);return C},_storeLocation:function(){if(this.storedLocation==null){this.storedLocation={useTop:this.useTop,useLeft:this.useLeft,top:this.element.getStyle("top"),bottom:this.element.getStyle("bottom"),left:this.element.getStyle("left"),right:this.element.getStyle("right"),width:this.width,height:this.height}}},_restoreLocation:function(){if(this.storedLocation!=null){this.useLeft=this.storedLocation.useLeft;this.useTop=this.storedLocation.useTop;this.element.setStyle(this.useLeft?{left:this.storedLocation.left}:{right:this.storedLocation.right});this.element.setStyle(this.useTop?{top:this.storedLocation.top}:{bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width,this.storedLocation.height);Windows.resetOverflow();this._removeStoreLocation()}},_removeStoreLocation:function(){this.storedLocation=null},_saveCookie:function(){if(this.cookie){var A="";if(this.useLeft){A+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle("left"))}else{A+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle("right"))}if(this.useTop){A+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle("top"))}else{A+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle("bottom"))}A+=","+(this.storedLocation?this.storedLocation.width:this.width);A+=","+(this.storedLocation?this.storedLocation.height:this.height);A+=","+this.isMinimized();A+=","+this.isMaximized();WindowUtilities.setCookie(A,this.cookie)}},_createWiredElement:function(){if(!this.wiredElement){if(isIE){this._getWindowBorderSize()}var B=document.createElement("div");B.className="wired_frame "+this.options.className+"_wired_frame";B.style.position="absolute";document.body.insertBefore(B,document.body.firstChild);B=$(B);var A=this.element.getDimensions();B.setStyle({width:A.width+"px",height:A.height+"px"});if(this.useLeft){B.setStyle({left:this.element.getStyle("left")})}else{B.setStyle({right:this.element.getStyle("right")})}if(this.useTop){B.setStyle({top:this.element.getStyle("top")})}else{B.setStyle({bottom:this.element.getStyle("bottom")})}this.wiredElement=B}this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement},_hideWiredElement:function(){if(!this.wiredElement){return}if(this.currentDrag==this.element){this.currentDrag=null}else{if(this.useLeft){this.element.setStyle({left:this.currentDrag.getStyle("left")})}else{this.element.setStyle({right:this.currentDrag.getStyle("right")})}if(this.useTop){this.element.setStyle({top:this.currentDrag.getStyle("top")})}else{this.element.setStyle({bottom:this.currentDrag.getStyle("bottom")})}this.currentDrag.hide();this.currentDrag=null;this.setSize(this.width,this.height)}}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,addObserver:function(A){this.removeObserver(A);this.observers.push(A)},removeObserver:function(A){this.observers=this.observers.reject(function(B){return B==A})},notify:function(A,B){this.observers.each(function(C){if(C[A]){C[A](A,B)}})},getWindow:function(A){return this.windows.detect(function(B){return B.getId()==A})},getFocusedWindow:function(){return this.focusedWindow},register:function(A){this.windows.push(A)},addModalWindow:function(A){if(this.modalWindows.length==0){WindowUtilities.disableScreen(A.options.className,"overlay_modal",A.getId())}else{if(Window.keepMultiModalWindow){$("overlay_modal").style.zIndex=Windows.maxZIndex+20;Windows.maxZIndex+=20;WindowUtilities._hideSelect(this.modalWindows.last().getId())}else{this.modalWindows.last().element.hide()}WindowUtilities._showSelect(A.getId())}this.modalWindows.push(A)},removeModalWindow:function(A){this.modalWindows.pop();if(this.modalWindows.length==0){WindowUtilities.enableScreen()}else{if(Window.keepMultiModalWindow){this.modalWindows.last().toFront();WindowUtilities._showSelect(this.modalWindows.last().getId())}else{this.modalWindows.last().element.show()}}},register:function(A){this.windows.push(A)},unregister:function(A){this.windows=this.windows.reject(function(B){return B==A})},close:function(C,A){var B=this.getWindow(C);if(B&&B.visible){if(B.getDelegate()&&!B.getDelegate().canClose(B)){return}this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null;this.notify("onClose",B);B.hide()}if(A){Event.stop(A)}},closeAll:function(){this.windows.each(function(A){Windows.close(A.getId())})},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(A){A.hide()})},minimize:function(C,A){var B=this.getWindow(C);if(B&&B.visible){B.minimize()}Event.stop(A)},maximize:function(C,A){var B=this.getWindow(C);if(B&&B.visible){B.maximize()}Event.stop(A)},unsetOverflow:function(A){this.windows.each(function(B){B.oldOverflow=B.getContent().getStyle("overflow")||"auto";B.getContent().setStyle({overflow:"hidden"})});if(A&&A.oldOverflow){A.getContent().setStyle({overflow:A.oldOverflow})}},resetOverflow:function(){this.windows.each(function(A){if(A.oldOverflow){A.getContent().setStyle({overflow:A.oldOverflow})}})},updateZindex:function(A,B){if(A>this.maxZIndex){this.maxZIndex=A}this.focusedWindow=B}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(D,C){if(typeof D!="string"){Dialog._runAjaxRequest(D,C,Dialog.confirm);return}C=C||{};var G=C.okLabel?C.okLabel:"Ok";var A=C.cancelLabel?C.cancelLabel:"Cancel";var F=C.windowParameters||{};F.className=F.className||"alert";var B="class ='"+(C.buttonClass?C.buttonClass+" ":"")+" ok_button'";var E="class ='"+(C.buttonClass?C.buttonClass+" ":"")+" cancel_button'";var D="      <div class='"+F.className+"_message'>"+D+"</div>        <div class='"+F.className+"_buttons'>          <input type='button' value='"+G+"' onclick='Dialog.okCallback()'"+B+"/>          <input type='button' value='"+A+"' onclick='Dialog.cancelCallback()' "+E+"/>        </div>    ";return this._openDialog(D,C,F.className)},alert:function(C,B){if(typeof C!="string"){Dialog._runAjaxRequest(C,B,Dialog.alert);return}B=B||{};var E=B.okLabel?B.okLabel:"Ok";var D=B.windowParameters||{};D.className=D.className||"alert";var A="class ='"+(B.buttonClass?B.buttonClass+" ":"")+" ok_button'";var C="      <div class='"+D.className+"_message'>"+C+"</div>        <div class='"+D.className+"_buttons'>          <input type='button' value='"+E+"' onclick='Dialog.okCallback()'"+A+"/>        </div>";return this._openDialog(C,B,D.className)},info:function(C,B){if(typeof C!="string"){Dialog._runAjaxRequest(C,B,Dialog.info);return}B=B||{};B.windowParameters=B.windowParameters||{};var A=B.windowParameters.className||"alert";var C="<div id='modal_dialog_message' class='"+A+"_message'>"+C+"</div>";if(B.showProgress){C+="<div id='modal_dialog_progress' class='"+A+"_progress'>  </div>"}B.windowParameters.ok=null;B.windowParameters.cancel=null;B.windowParameters.className=A;return this._openDialog(C,B,A)},setInfoMessage:function(A){$("modal_dialog_message").update(A)},closeInfo:function(){Windows.close(this.dialogId)},_openDialog:function(E,D,C){if(!D.windowParameters.height&&!D.windowParameters.width){D.windowParameters.width=WindowUtilities.getPageSize().pageWidth/2}if(D.id){this.dialogId=D.id}else{var B=new Date();this.dialogId="modal_dialog_"+B.getTime()}if(!D.windowParameters.height||!D.windowParameters.width){var A=WindowUtilities._computeSize(E,this.dialogId,D.windowParameters.width,D.windowParameters.height,5,C);if(D.windowParameters.height){D.windowParameters.width=A+5}else{D.windowParameters.height=A+5}}var G=D&&D.windowParameters?D.windowParameters:{};G.resizable=G.resizable||false;G.effectOptions=G.effectOptions||{duration:1};G.minimizable=false;G.maximizable=false;G.closable=false;G.draggable=false;G.rowHeader=false;G.rowFooter=false;var F=new Window(this.dialogId,G);F.getContent().innerHTML=E;F.showCenter(true,D.top,D.left);F.setDestroyOnClose();F.cancelCallback=D.cancel;F.okCallback=D.ok;return F},_getAjaxContent:function(A){Dialog.callFunc(A.responseText,Dialog.parameters)},_runAjaxRequest:function(C,B,A){if(C.options==null){C.options={}}Dialog.onCompleteFunc=C.options.onComplete;Dialog.parameters=B;Dialog.callFunc=A;C.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(C.url,C.options)},okCallback:function(){var A=Windows.focusedWindow;if(!A.okCallback||A.okCallback(A)){$$("#"+A.getId()+" input").each(function(B){B.onclick=null});A.hide()}},cancelCallback:function(){var A=Windows.focusedWindow;$$("#"+A.getId()+" input").each(function(B){B.onclick=null});A.hide();if(A.cancelCallback){A.cancelCallback(A)}}};var isIE=navigator.appVersion.match(/MSIE/)=="MSIE";var WindowUtilities={getWindowScroll:function(){var w=window;var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}return{top:T,left:L,width:W,height:H}},getPageSize:function(){var E,A;if(window.innerHeight&&window.scrollMaxY){E=document.body.scrollWidth;A=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){E=document.body.scrollWidth;A=document.body.scrollHeight}else{E=document.body.offsetWidth;A=document.body.offsetHeight}}var C,F;if(self.innerHeight){C=self.innerWidth;F=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){C=document.documentElement.clientWidth;F=document.documentElement.clientHeight}else{if(document.body){C=document.body.clientWidth;F=document.body.clientHeight}}}var D,B;if(A<F){D=F}else{D=A}if(E<C){B=C}else{B=E}return{pageWidth:B,pageHeight:D,windowWidth:C,windowHeight:F}},disableScreen:function(D,C,F){WindowUtilities.initLightbox(C,D);var B=document.body;var E=$(C);var A=WindowUtilities.getPageSize();if(F&&isIE){WindowUtilities._hideSelect();WindowUtilities._showSelect(F)}E.style.height=(A.pageHeight+"px");E.style.width=(A.windowWidth+"px");E.style.display="block"},enableScreen:function(B){B=B||"overlay_modal";var A=$(B);if(A){A.style.display="none";if(B!="__invisible__"){WindowUtilities._showSelect()}A.parentNode.removeChild(A)}},_hideSelect:function(A){if(isIE){A=A==null?"":"#"+A+" ";$$(A+"select").each(function(B){if(!WindowUtilities.isDefined(B.oldVisibility)){B.oldVisibility=B.style.visibility?B.style.visibility:"visible";B.style.visibility="hidden"}})}},_showSelect:function(A){if(isIE){A=A==null?"":"#"+A+" ";$$(A+"select").each(function(B){if(WindowUtilities.isDefined(B.oldVisibility)){try{B.style.visibility=B.oldVisibility}catch(C){B.style.visibility="visible"}B.oldVisibility=null}else{if(B.style.visibility){B.style.visibility="visible"}}})}},isDefined:function(A){return typeof(A)!="undefined"&&A!=null},initLightbox:function(D,B){if($(D)){Element.setStyle(D,{zIndex:Windows.maxZIndex+10})}else{var A=document.body;var C=document.createElement("div");C.setAttribute("id",D);C.className="overlay_"+B;C.style.display="none";C.style.position="absolute";C.style.top="0";C.style.left="0";C.style.zIndex=Windows.maxZIndex+10;C.style.width="100%";A.insertBefore(C,A.firstChild)}},setCookie:function(B,A){document.cookie=A[0]+"="+escape(B)+((A[1])?"; expires="+A[1].toGMTString():"")+((A[2])?"; path="+A[2]:"")+((A[3])?"; domain="+A[3]:"")+((A[4])?"; secure":"")},getCookie:function(C){var B=document.cookie;var E=C+"=";var D=B.indexOf("; "+E);if(D==-1){D=B.indexOf(E);if(D!=0){return null}}else{D+=2}var A=document.cookie.indexOf(";",D);if(A==-1){A=B.length}return unescape(B.substring(D+E.length,A))},_computeSize:function(E,A,B,G,D,F){var I=document.body;var C=document.createElement("div");C.setAttribute("id",A);C.className=F+"_content";if(G){C.style.height=G+"px"}else{C.style.width=B+"px"}C.style.position="absolute";C.style.top="0";C.style.left="0";C.style.display="none";C.innerHTML=E;I.insertBefore(C,I.firstChild);var H;if(G){H=$(A).getDimensions().width+D}else{H=$(A).getDimensions().height+D}I.removeChild(C);return H}};