var Window=Class.create();Window.keepMultiModalWindow=false;Window.hasEffectLib=(typeof Effect!="undefined");Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var C;var B=0;if(arguments.length>0){if(typeof arguments[0]=="string"){C=arguments[0];B=1}else{C=arguments[0]?arguments[0].id:null}}if(!C){C="window_"+new Date().getTime()}if($(C)){alert("Window "+C+" is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor")}this.options=Object.extend({className:"dialog",blurClassName:null,minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(Window.hasEffectLib?Effect.Appear:Element.show),hideEffect:(Window.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,wiredDrag:false,closeCallback:null,destroyOnClose:false,gridX:1,gridY:1},arguments[B]||{});if(this.options.blurClassName){this.options.focusClassName=this.options.className}if(typeof this.options.top=="undefined"&&typeof this.options.bottom=="undefined"){this.options.top=this._round(Math.random()*500,this.options.gridY)}if(typeof this.options.left=="undefined"&&typeof this.options.right=="undefined"){this.options.left=this._round(Math.random()*500,this.options.gridX)}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(Window.hasEffectLib){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.options.destroyOnClose){this.destroy()}}.bind(this)}if(this.options.parent!=document.body){this.options.parent=$(this.options.parent)}this.element=this._createWindow(C);this.element.win=this;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);this.topbar=$(this.element.id+"_top");this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.topbar,"mousedown",this.eventMouseDown);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);Event.observe(window,"scroll",this.eventResize);Event.observe(this.options.parent,"scroll",this.eventResize);if(this.options.draggable){var A=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(D){D.observe("mousedown",A.eventMouseDown);D.addClassName("top_draggable")});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function(D){D.observe("mousedown",A.eventMouseDown);D.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(typeof this.options.left!="undefined"){this.element.setStyle({left:parseFloat(this.options.left)+"px"});this.useLeft=true}else{this.element.setStyle({right:parseFloat(this.options.right)+"px"});this.useLeft=false}if(typeof this.options.top!="undefined"){this.element.setStyle({top:parseFloat(this.options.top)+"px"});this.useTop=true}else{this.element.setStyle({bottom:parseFloat(this.options.bottom)+"px"});this.useTop=false}this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex){this.setZIndex(this.options.zIndex)}if(this.options.destroyOnClose){this.setDestroyOnClose(true)}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)}this.setTitle(this.options.title);Windows.register(this)},destroy:function(){this._notify("onDestroy");Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);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(window,"scroll",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)},setCloseCallback:function(A){this.options.closeCallback=A},getContent:function(){return this.content},setContent:function(C,B,E){var D=$(C);if(null==D){throw"Unable to find element '"+C+"' in DOM"}this._oldParent=D.parentNode;var A=null;var G=null;if(B){A=Element.getDimensions(D)}if(E){G=Position.cumulativeOffset(D)}var F=this.getContent();this.setHTMLContent("");F=this.getContent();F.appendChild(D);D.show();if(B){this.setSize(A.width,A.height)}if(E){this.setLocation(G[1]-this.heightN,G[0]-this.widthW)}},setHTMLContent:function(B){if(this.options.url){this.content.src=null;this.options.url=null;var A='<div id="'+this.getId()+'_content" class="'+this.options.className+'_content"> </div>';$(this.getId()+"_table_content").innerHTML=A;this.content=$(this.element.id+"_content")}this.getContent().innerHTML=B},setAjaxContent:function(C,B,A,D){this.showFunction=A?"showCenter":"show";this.showModal=D||false;B=B||{};this.setHTMLContent("");this.onComplete=B.onComplete;if(!this._onCompleteHandler){this._onCompleteHandler=this._setAjaxContent.bind(this)}B.onComplete=this._onCompleteHandler;new Ajax.Request(C,B);B.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.content.src=null}this.options.url=B;var A="<iframe frameborder='0' name='"+this.getId()+"_content'  id='"+this.getId()+"_content' src='"+B+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=A;this.content=$(this.element.id+"_content")},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(K,L,I,A,J){K=K||this.element.id;this.cookie=[K,L,I,A,J];var G=WindowUtilities.getCookie(K);if(G){var H=G.split(",");var E=H[0].split(":");var D=H[1].split(":");var F=parseFloat(H[2]),B=parseFloat(H[3]);var C=H[4];var M=H[5];this.setSize(F,B);if(C=="true"){this.doMinimize=true}else{if(M=="true"){this.doMaximize=true}}this.useLeft=E[0]=="l";this.useTop=D[0]=="t";this.element.setStyle(this.useLeft?{left:E[1]}:{right:E[1]});this.element.setStyle(this.useTop?{top:D[1]}:{bottom:D[1]})}},getId:function(){return this.element.id},setDestroyOnClose:function(){this.options.destroyOnClose=true},setConstraint:function(B,A){this.constraint=B;this.constraintPad=Object.extend(this.constraintPad,A||{});if(this.useTop&&this.useLeft){this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left))}},_initDrag:function(A){if(Event.element(A)==this.sizer&&this.isMinimized()){return }if(Event.element(A)!=this.sizer&&this.isMaximized()){return }if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize()}this.pointer=[this._round(Event.pointerX(A),this.options.gridX),this._round(Event.pointerY(A),this.options.gridY)];if(this.options.wiredDrag){this.currentDrag=this._createWiredElement()}else{this.currentDrag=this.element}if(Event.element(A)==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"));this._notify("onStartResize")}else{this.doResize=false;var B=$(this.getId()+"_close");if(B&&Position.within(B,this.pointer[0],this.pointer[1])){this.currentDrag=null;return }this.toFront();if(!this.options.draggable){return }this._notify("onStartMove")}Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen("__invisible__","__invisible__",this.overlayOpacity);document.body.ondrag=function(){return false};document.body.onselectstart=function(){return false};this.currentDrag.show();Event.stop(A)},_round:function(A,B){return B==1?A:A=Math.floor(A/B)*B},_updateDrag:function(D){var C=[this._round(Event.pointerX(D),this.options.gridX),this._round(Event.pointerY(D),this.options.gridY)];var B=C[0]-this.pointer[0];var A=C[1]-this.pointer[1];if(this.doResize){var J=this.widthOrg+B;var F=this.heightOrg+A;B=this.width-this.widthOrg;A=this.height-this.heightOrg;if(this.useLeft){J=this._updateWidthConstraint(J)}else{this.currentDrag.setStyle({right:(this.rightOrg-B)+"px"})}if(this.useTop){F=this._updateHeightConstraint(F)}else{this.currentDrag.setStyle({bottom:(this.bottomOrg-A)+"px"})}this.setSize(J,F);this._notify("onResize")}else{this.pointer=C;if(this.useLeft){var E=parseFloat(this.currentDrag.getStyle("left"))+B;var I=this._updateLeftConstraint(E);this.pointer[0]+=I-E;this.currentDrag.setStyle({left:I+"px"})}else{this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle("right"))-B+"px"})}if(this.useTop){var H=parseFloat(this.currentDrag.getStyle("top"))+A;var G=this._updateTopConstraint(H);this.pointer[1]+=G-H;this.currentDrag.setStyle({top:G+"px"})}else{this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle("bottom"))-A+"px"})}this._notify("onMove")}if(this.iefix){this._fixIEOverlapping()}this._removeStoreLocation();Event.stop(D)},_endDrag:function(A){WindowUtilities.enableScreen("__invisible__");if(this.doResize){this._notify("onEndResize")}else{this._notify("onEndMove")}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(A){if(this.constraint&&this.useLeft&&this.useTop){var B=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(A<this.constraintPad.left){A=this.constraintPad.left}if(A+this.width+this.widthE+this.widthW>B-this.constraintPad.right){A=B-this.constraintPad.right-this.width-this.widthE-this.widthW}}return A},_updateTopConstraint:function(C){if(this.constraint&&this.useLeft&&this.useTop){var A=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var B=this.height+this.heightN+this.heightS;if(C<this.constraintPad.top){C=this.constraintPad.top}if(C+B>A-this.constraintPad.bottom){C=A-this.constraintPad.bottom-B}}return C},_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 B="../themes/default/blank.gif";D.innerHTML=G+H+I+"      <table id='"+A+"_row1' class=\"top table_window\">        <tr>          <td class='"+F+"_nw'></td>          <td class='"+F+"_n'><div id='"+A+"_top' class='"+F+"_title title_window'>"+this.options.title+"</div></td>          <td class='"+F+"_ne'></td>        </tr>      </table>      <table id='"+A+"_row2' class=\"mid table_window\">        <tr>          <td class='"+F+"_w'></td>            <td id='"+A+"_table_content' class='"+F+"_content' valign='top'>"+E+"</td>          <td class='"+F+"_e'></td>        </tr>      </table>        <table id='"+A+"_row3' class=\"bot table_window\">        <tr>          <td class='"+F+"_sw'></td>            <td class='"+F+"_s'><div id='"+A+"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>            <td "+C+"></td>        </tr>      </table>    ";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 C=this.getId();$A(["_close","_minimize","_maximize","_sizer","_content"]).each(function(D){this._toggleClassName($(C+D),B+D,A+D)}.bind(this));this._toggleClassName($(C+"_top"),B+"_title",A+"_title");$$("#"+C+" td").each(function(D){D.className=D.className.sub(B,A)});this.options.className=A},_toggleClassName:function(C,B,A){if(C){C.removeClassName(B);C.addClassName(A)}},setLocation:function(C,B){C=this._updateTopConstraint(C);B=this._updateLeftConstraint(B);var A=this.currentDrag||this.element;A.setStyle({top:C+"px"});A.setStyle({left:B+"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(A,E,D){A=parseFloat(A);E=parseFloat(E);if(!this.minimized&&A<this.options.minWidth){A=this.options.minWidth}if(!this.minimized&&E<this.options.minHeight){E=this.options.minHeight}if(this.options.maxHeight&&E>this.options.maxHeight){E=this.options.maxHeight}if(this.options.maxWidth&&A>this.options.maxWidth){A=this.options.maxWidth}if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&D){new Effect.ResizeWindow(this,null,null,A,E,{duration:Window.resizeEffectDuration})}else{this.width=A;this.height=E;var C=this.currentDrag?this.currentDrag:this.element;C.setStyle({width:A+this.widthW+this.widthE+"px"});C.setStyle({height:E+this.heightN+this.heightS+"px"});if(!this.currentDrag||this.currentDrag==this.element){var B=$(this.element.id+"_content");B.setStyle({height:E+"px"});B.setStyle({width:A+"px"})}}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight,true)},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height,true)},toFront:function(){if(this.element.style.zIndex<Windows.maxZIndex){this.setZIndex(Windows.maxZIndex+1)}if(this.iefix){this._fixIEOverlapping()}},getBounds:function(C){if(!this.width||!this.height||!this.visible){this.computeBounds()}var B=this.width;var D=this.height;if(!C){B+=this.widthW+this.widthE;D+=this.heightN+this.heightS}var A=Object.extend(this.getLocation(),{width:B+"px",height:D+"px"});return A},computeBounds:function(){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)}},show:function(A){this.visible=true;if(A){if(typeof this.overlayOpacity=="undefined"){var B=this;setTimeout(function(){B.show(A)},10);return }Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+1);Windows.unsetOverflow(this)}else{if(!this.element.style.zIndex){this.setZIndex(Windows.maxZIndex+1)}}if(this.oldStyle){this.getContent().setStyle({overflow:this.oldStyle})}this.computeBounds();this._notify("onBeforeShow");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();WindowUtilities.focusedWindow=this;this._notify("onShow")},showCenter:function(A,C,B){this.centered=true;this.centerTop=C;this.centerLeft=B;this.show(A)},isVisible:function(){return this.visible},_center:function(D,C){var A=WindowUtilities.getWindowScroll(this.options.parent);var B=WindowUtilities.getPageSize(this.options.parent);if(typeof D=="undefined"){D=(B.windowHeight-(this.height+this.heightN+this.heightS))/2}D+=A.top;if(typeof C=="undefined"){C=(B.windowWidth-(this.width+this.widthW+this.widthE))/2}C+=A.left;this.setLocation(D,C);this.toFront()},_recenter:function(B){if(this.centered){var A=WindowUtilities.getPageSize(this.options.parent);var C=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==A.windowWidth&&this.pageSize.windowHeight==A.windowHeight&&this.windowScroll.left==C.left&&this.windowScroll.top==C.top){return }this.pageSize=A;this.windowScroll=C;if($("overlay_modal")){$("overlay_modal").setStyle({height:(A.pageHeight+"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.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix){this.iefix.hide()}if(!this.doNotNotifyHide){this._notify("onHide")}},close:function(){if(this.visible){if(this.options.closeCallback&&!this.options.closeCallback(this)){return }if(this.options.destroyOnClose){var B=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var A=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){A();B()}}else{this.options.hideEffectOptions.afterFinish=function(){B()}}}Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose")}},minimize:function(){if(this.resizing){return }var B=$(this.getId()+"_row2");if(!this.minimized){this.minimized=true;var A=B.getDimensions().height;this.r2Height=A;var D=this.element.getHeight()-A;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height-A,{duration:Window.resizeEffectDuration})}else{this.height-=A;this.element.setStyle({height:D+"px"});B.hide()}if(!this.useTop){var C=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(C+A)+"px"})}}else{this.minimized=false;var A=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height+A,{duration:Window.resizeEffectDuration})}else{var D=this.element.getHeight()+A;this.height+=A;this.element.setStyle({height:D+"px"});B.show()}if(!this.useTop){var C=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(C-A)+"px"})}this.toFront()}this._notify("onMinimize");this._saveCookie()},maximize:function(){if(this.isMinimized()||this.resizing){return }if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize()}if(this.storedLocation!=null){this._restoreLocation();if(this.iefix){this.iefix.hide()}}else{this._storeLocation();Windows.unsetOverflow(this);var C=WindowUtilities.getWindowScroll(this.options.parent);var E=WindowUtilities.getPageSize(this.options.parent);var B=C.left;var A=C.top;if(this.options.parent!=document.body){C={top:0,left:0,bottom:0,right:0};var G=this.options.parent.getDimensions();E.windowWidth=G.width;E.windowHeight=G.height;A=0;B=0}if(this.constraint){E.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);E.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);B+=Math.max(0,this.constraintPad.left);A+=Math.max(0,this.constraintPad.top)}var F=E.windowWidth-this.widthW-this.widthE;var D=E.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,A,B,F,D,{duration:Window.resizeEffectDuration})}else{this.setSize(F,D);this.element.setStyle(this.useLeft?{left:B}:{right:B});this.element.setStyle(this.useTop?{top:A}:{bottom:A})}this.toFront();if(this.iefix){this._fixIEOverlapping()}}this._notify("onMaximize");this._saveCookie()},isMinimized:function(){return this.minimized},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)},getTitle:function(){return $(this.element.id+"_top").innerHTML},setStatusBar:function(A){var B=$(this.getId()+"_bottom");if(typeof (A)=="object"){if(this.bottombar.firstChild){this.bottombar.replaceChild(A,this.bottombar.firstChild)}else{this.bottombar.appendChild(A)}}else{this.bottombar.innerHTML=A}},_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(B){var C=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(C).height;C.parentNode.removeChild(C);var C=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(C).height;C.parentNode.removeChild(C);var C=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(C).width;C.parentNode.removeChild(C);var C=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(C).width;C.parentNode.removeChild(C);var C=document.createElement("div");C.className="overlay_"+this.options.className;document.body.appendChild(C);var A=this;setTimeout(function(){A.overlayOpacity=($(C).getStyle("opacity"));C.parentNode.removeChild(C)},10);if(Prototype.Browser.IE){this.heightS=$(this.getId()+"_row3").getDimensions().height;this.heightN=$(this.getId()+"_row1").getDimensions().height}if(Prototype.Browser.WebKit&&Prototype.Browser.WebKitVersion<420){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;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,this.storedLocation.top,this.storedLocation.left,this.storedLocation.width,this.storedLocation.height,{duration:Window.resizeEffectDuration})}else{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(Prototype.Browser.IE){this._getWindowBorderSize()}var A=document.createElement("div");A.className="wired_frame "+this.options.className+"_wired_frame";A.style.position="absolute";this.options.parent.insertBefore(A,this.options.parent.firstChild);this.wiredElement=$(A)}if(this.useLeft){this.wiredElement.setStyle({left:this.element.getStyle("left")})}else{this.wiredElement.setStyle({right:this.element.getStyle("right")})}if(this.useTop){this.wiredElement.setStyle({top:this.element.getStyle("top")})}else{this.wiredElement.setStyle({bottom:this.element.getStyle("bottom")})}var B=this.element.getDimensions();this.wiredElement.setStyle({width:B.width+"px",height:B.height+"px"});this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement},_hideWiredElement:function(){if(!this.wiredElement||!this.currentDrag){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;if(this.doResize){this.setSize(this.width,this.height)}}},_notify:function(A){if(this.options[A]){this.options[A](this)}else{Windows.notify(A,this)}}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},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(B,A){this.observers.each(function(C){if(C[B]){C[B](B,A)}})},getWindow:function(A){return this.windows.detect(function(B){return B.getId()==A})},getFocusedWindow:function(){return this.focusedWindow},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null},register:function(A){this.windows.push(A)},addModalWindow:function(A){if(this.modalWindows.length==0){WindowUtilities.disableScreen(A.options.className,"overlay_modal",A.overlayOpacity,A.getId(),A.options.parent)}else{if(Window.keepMultiModalWindow){$("overlay_modal").style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex+=1;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})},closeAll:function(){this.windows.each(function(A){Windows.close(A.getId())})},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(A){if(A){A.close()}})},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)},close:function(C,A){var B=this.getWindow(C);if(B){B.close()}if(A){Event.stop(A)}},blur:function(A){var B=this.getWindow(A);if(!B){return }if(B.options.blurClassName){B.changeClassName(B.options.blurClassName)}if(this.focusedWindow==B){this.focusedWindow=null}B._notify("onBlur")},focus:function(A){var B=this.getWindow(A);if(!B){return }if(this.focusedWindow){this.blur(this.focusedWindow.getId())}if(B.options.focusClassName){B.changeClassName(B.options.focusClassName)}this.focusedWindow=B;B._notify("onFocus")},unsetOverflow:function(A){this.windows.each(function(B){B.oldOverflow=B.getContent().getStyle("overflow")||"auto"});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(B,A){if(B>this.maxZIndex){this.maxZIndex=B;if(this.focusedWindow){this.blur(this.focusedWindow.getId())}}this.focusedWindow=A;if(this.focusedWindow){this.focus(this.focusedWindow.getId())}}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(A,F){if(A&&typeof A!="string"){Dialog._runAjaxRequest(A,F,Dialog.confirm);return }A=A||"";F=F||{};var C=F.okLabel?F.okLabel:"Ok";var D=F.cancelLabel?F.cancelLabel:"Cancel";F=Object.extend(F,F.windowParameters||{});F.windowParameters=F.windowParameters||{};F.className=F.className||"alert";var E="class ='"+(F.buttonClass?F.buttonClass+" ":"")+" ok_button'";var B="class ='"+(F.buttonClass?F.buttonClass+" ":"")+" cancel_button'";var A="      <div class='"+F.className+"_message'>"+A+"</div>        <div class='"+F.className+"_buttons'>          <input type='button' value='"+C+"' onclick='Dialog.okCallback()' "+E+"/>          <input type='button' value='"+D+"' onclick='Dialog.cancelCallback()' "+B+"/>        </div>    ";return this._openDialog(A,F)},alert:function(D,C){if(D&&typeof D!="string"){Dialog._runAjaxRequest(D,C,Dialog.alert);return }D=D||"";C=C||{};var A=C.okLabel?C.okLabel:"Ok";C=Object.extend(C,C.windowParameters||{});C.windowParameters=C.windowParameters||{};C.className=C.className||"alert";var B="class ='"+(C.buttonClass?C.buttonClass+" ":"")+" ok_button'";var D="      <div class='"+C.className+"_message'>"+D+"</div>        <div class='"+C.className+"_buttons'>          <input type='button' value='"+A+"' onclick='Dialog.okCallback()' "+B+"/>        </div>";return this._openDialog(D,C)},info:function(A,B){if(A&&typeof A!="string"){Dialog._runAjaxRequest(A,B,Dialog.info);return }A=A||"";B=B||{};B=Object.extend(B,B.windowParameters||{});B.windowParameters=B.windowParameters||{};B.className=B.className||"alert";var A="<div id='modal_dialog_message' class='"+B.className+"_message'>"+A+"</div>";if(B.showProgress){A+="<div id='modal_dialog_progress' class='"+B.className+"_progress'>  </div>"}B.ok=null;B.cancel=null;return this._openDialog(A,B)},setInfoMessage:function(A){$("modal_dialog_message").update(A)},closeInfo:function(){Windows.close(this.dialogId)},_openDialog:function(B,A){var F=A.className;if(!A.height&&!A.width){A.width=WindowUtilities.getPageSize(A.options.parent||document.body).pageWidth/2}if(A.id){this.dialogId=A.id}else{var E=new Date();this.dialogId="modal_dialog_"+E.getTime();A.id=this.dialogId}if(!A.height||!A.width){var D=WindowUtilities._computeSize(B,this.dialogId,A.width,A.height,5,F);if(A.height){A.width=D+5}else{A.height=D+5}}A.effectOptions=A.effectOptions;A.resizable=A.resizable||false;A.minimizable=A.minimizable||false;A.maximizable=A.maximizable||false;A.draggable=A.draggable||false;A.closable=A.closable||false;var C=new Window(A);C.getContent().innerHTML=B;C.showCenter(true,A.top,A.left);C.setDestroyOnClose();C.cancelCallback=A.onCancel||A.cancel;C.okCallback=A.onOk||A.ok;return C},_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.close()}},cancelCallback:function(){var A=Windows.focusedWindow;$$("#"+A.getId()+" input").each(function(B){B.onclick=null});A.close();if(A.cancelCallback){A.cancelCallback(A)}}};if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1])}var WindowUtilities={getWindowScroll:function(parent){var T,L,W,H;parent=parent||document.body;if(parent!=document.body){T=parent.scrollTop;L=parent.scrollLeft;W=parent.scrollWidth;H=parent.scrollHeight}else{var w=window;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(G){G=G||document.body;var F,C;var A,E;if(G!=document.body){F=G.getWidth();C=G.getHeight();E=G.scrollWidth;A=G.scrollHeight}else{var B,D;if(window.innerHeight&&window.scrollMaxY){B=document.body.scrollWidth;D=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){B=document.body.scrollWidth;D=document.body.scrollHeight}else{B=document.body.offsetWidth;D=document.body.offsetHeight}}if(self.innerHeight){F=self.innerWidth;C=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){F=document.documentElement.clientWidth;C=document.documentElement.clientHeight}else{if(document.body){F=document.body.clientWidth;C=document.body.clientHeight}}}if(D<C){A=C}else{A=D}if(B<F){E=F}else{E=B}}return{pageWidth:E,pageHeight:A,windowWidth:F,windowHeight:C}},disableScreen:function(A,D,B,C,E){WindowUtilities.initLightbox(D,A,function(){this._disableScreen(A,D,B,C)}.bind(this),E||document.body)},_disableScreen:function(F,E,B,C){var A=$(E);var D=WindowUtilities.getPageSize(A.parentNode);if(C&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(C)}A.style.height=(D.pageHeight+"px");A.style.display="none";if(E=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){A.overlayOpacity=B;new Effect.Appear(A,Object.extend({from:0,to:B},Windows.overlayShowEffectOptions))}else{A.style.display="block"}},enableScreen:function(A){A=A||"overlay_modal";var B=$(A);if(B){if(A=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions){new Effect.Fade(B,Object.extend({from:B.overlayOpacity,to:0},Windows.overlayHideEffectOptions))}else{B.style.display="none";B.parentNode.removeChild(B)}if(A!="__invisible__"){WindowUtilities._showSelect()}}},_hideSelect:function(A){if(Prototype.Browser.IE){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(Prototype.Browser.IE){A=A==null?"":"#"+A+" ";$$(A+"select").each(function(C){if(WindowUtilities.isDefined(C.oldVisibility)){try{C.style.visibility=C.oldVisibility}catch(B){C.style.visibility="visible"}C.oldVisibility=null}else{if(C.style.visibility){C.style.visibility="visible"}}})}},isDefined:function(A){return typeof (A)!="undefined"&&A!=null},initLightbox:function(C,A,D,E){if($(C)){Element.setStyle(C,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;D()}else{var B=document.createElement("div");B.setAttribute("id",C);B.className="overlay_"+A;B.style.display="none";B.style.position="absolute";B.style.top="0";B.style.left="0";B.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;B.style.width="100%";E.insertBefore(B,E.firstChild);if(Prototype.Browser.WebKit&&C=="overlay_modal"){setTimeout(function(){D()},10)}else{D()}}},setCookie:function(A,B){document.cookie=B[0]+"="+escape(A)+((B[1])?"; expires="+B[1].toGMTString():"")+((B[2])?"; path="+B[2]:"")+((B[3])?"; domain="+B[3]:"")+((B[4])?"; secure":"")},getCookie:function(A){var E=document.cookie;var C=A+"=";var B=E.indexOf("; "+C);if(B==-1){B=E.indexOf(C);if(B!=0){return null}}else{B+=2}var D=document.cookie.indexOf(";",B);if(D==-1){D=E.length}return unescape(E.substring(B+C.length,D))},_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=$(C).getDimensions().width+D}else{H=$(C).getDimensions().height+D}I.removeChild(C);return H}};