var Window=Class.create();Window.keepMultiModalWindow=false;Window.hasEffectLib=(typeof Effect!="undefined");Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var id;var _1=0;if(arguments.length>0){if(typeof arguments[0]=="string"){id=arguments[0];_1=1;}else{id=arguments[0]?arguments[0].id:null;}}if(!id){id="window_"+new Date().getTime();}if($(id)){alert("Window "+id+" 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[_1]||{});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(id);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 _2=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(_3){_3.observe("mousedown",_2.eventMouseDown);_3.addClassName("top_draggable");});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function(_4){_4.observe("mousedown",_2.eventMouseDown);_4.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 _5=this.getContent();var _6=null;for(var i=0;i<_5.childNodes.length;i++){_6=_5.childNodes[i];if(_6.nodeType==1){break;}_6=null;}if(_6){this._oldParent.appendChild(_6);}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(_7){this.options.closeCallback=_7;},getContent:function(){return this.content;},setContent:function(id,_8,_9){var _a=$(id);if(null==_a){throw "Unable to find element '"+id+"' in DOM";}this._oldParent=_a.parentNode;var d=null;var p=null;if(_8){d=Element.getDimensions(_a);}if(_9){p=Position.cumulativeOffset(_a);}var _b=this.getContent();this.setHTMLContent("");_b=this.getContent();_b.appendChild(_a);_a.show();if(_8){this.setSize(d.width,d.height);}if(_9){this.setLocation(p[1]-this.heightN,p[0]-this.widthW);}},setHTMLContent:function(_c){if(this.options.url){this.content.src=null;this.options.url=null;var _d="<div id=\""+this.getId()+"_content\" class=\""+this.options.className+"_content\"> </div>";$(this.getId()+"_table_content").innerHTML=_d;this.content=$(this.element.id+"_content");}this.getContent().innerHTML=_c;},setAjaxContent:function(_e,_f,_10,_11){this.showFunction=_10?"showCenter":"show";this.showModal=_11||false;_f=_f||{};this.setHTMLContent("");this.onComplete=_f.onComplete;if(!this._onCompleteHandler){this._onCompleteHandler=this._setAjaxContent.bind(this);}_f.onComplete=this._onCompleteHandler;new Ajax.Request(_e,_f);_f.onComplete=this.onComplete;},_setAjaxContent:function(_12){Element.update(this.getContent(),_12.responseText);if(this.onComplete){this.onComplete(_12);}this.onComplete=null;this[this.showFunction](this.showModal);},setURL:function(url){if(this.options.url){this.content.src=null;}this.options.url=url;var _13="<iframe frameborder='0' name='"+this.getId()+"_content'  id='"+this.getId()+"_content' src='"+url+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=_13;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(_14,_15,_16,_17,_18){_14=_14||this.element.id;this.cookie=[_14,_15,_16,_17,_18];var _19=WindowUtilities.getCookie(_14);if(_19){var _1a=_19.split(",");var x=_1a[0].split(":");var y=_1a[1].split(":");var w=parseFloat(_1a[2]),h=parseFloat(_1a[3]);var _1b=_1a[4];var _1c=_1a[5];this.setSize(w,h);if(_1b=="true"){this.doMinimize=true;}else{if(_1c=="true"){this.doMaximize=true;}}this.useLeft=x[0]=="l";this.useTop=y[0]=="t";this.element.setStyle(this.useLeft?{left:x[1]}:{right:x[1]});this.element.setStyle(this.useTop?{top:y[1]}:{bottom:y[1]});}},getId:function(){return this.element.id;},setDestroyOnClose:function(){this.options.destroyOnClose=true;},setConstraint:function(_1d,_1e){this.constraint=_1d;this.constraintPad=Object.extend(this.constraintPad,_1e||{});if(this.useTop&&this.useLeft){this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left));}},_initDrag:function(_1f){if(Event.element(_1f)==this.sizer&&this.isMinimized()){return;}if(Event.element(_1f)!=this.sizer&&this.isMaximized()){return;}if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize();}this.pointer=[this._round(Event.pointerX(_1f),this.options.gridX),this._round(Event.pointerY(_1f),this.options.gridY)];if(this.options.wiredDrag){this.currentDrag=this._createWiredElement();}else{this.currentDrag=this.element;}if(Event.element(_1f)==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 _20=$(this.getId()+"_close");if(_20&&Position.within(_20,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(_1f);},_round:function(val,_21){return _21==1?val:val=Math.floor(val/_21)*_21;},_updateDrag:function(_22){var _23=[this._round(Event.pointerX(_22),this.options.gridX),this._round(Event.pointerY(_22),this.options.gridY)];var dx=_23[0]-this.pointer[0];var dy=_23[1]-this.pointer[1];if(this.doResize){var w=this.widthOrg+dx;var h=this.heightOrg+dy;dx=this.width-this.widthOrg;dy=this.height-this.heightOrg;if(this.useLeft){w=this._updateWidthConstraint(w);}else{this.currentDrag.setStyle({right:(this.rightOrg-dx)+"px"});}if(this.useTop){h=this._updateHeightConstraint(h);}else{this.currentDrag.setStyle({bottom:(this.bottomOrg-dy)+"px"});}this.setSize(w,h);this._notify("onResize");}else{this.pointer=_23;if(this.useLeft){var _24=parseFloat(this.currentDrag.getStyle("left"))+dx;var _25=this._updateLeftConstraint(_24);this.pointer[0]+=_25-_24;this.currentDrag.setStyle({left:_25+"px"});}else{this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle("right"))-dx+"px"});}if(this.useTop){var top=parseFloat(this.currentDrag.getStyle("top"))+dy;var _26=this._updateTopConstraint(top);this.pointer[1]+=_26-top;this.currentDrag.setStyle({top:_26+"px"});}else{this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle("bottom"))-dy+"px"});}this._notify("onMove");}if(this.iefix){this._fixIEOverlapping();}this._removeStoreLocation();Event.stop(_22);},_endDrag:function(_27){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(_27);this._hideWiredElement();this._saveCookie();document.body.ondrag=null;document.body.onselectstart=null;},_updateLeftConstraint:function(_28){if(this.constraint&&this.useLeft&&this.useTop){var _29=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(_28<this.constraintPad.left){_28=this.constraintPad.left;}if(_28+this.width+this.widthE+this.widthW>_29-this.constraintPad.right){_28=_29-this.constraintPad.right-this.width-this.widthE-this.widthW;}}return _28;},_updateTopConstraint:function(top){if(this.constraint&&this.useLeft&&this.useTop){var _2a=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var h=this.height+this.heightN+this.heightS;if(top<this.constraintPad.top){top=this.constraintPad.top;}if(top+h>_2a-this.constraintPad.bottom){top=_2a-this.constraintPad.bottom-h;}}return top;},_updateWidthConstraint:function(w){if(this.constraint&&this.useLeft&&this.useTop){var _2b=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;var _2c=parseFloat(this.element.getStyle("left"));if(_2c+w+this.widthE+this.widthW>_2b-this.constraintPad.right){w=_2b-this.constraintPad.right-_2c-this.widthE-this.widthW;}}return w;},_updateHeightConstraint:function(h){if(this.constraint&&this.useLeft&&this.useTop){var _2d=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var top=parseFloat(this.element.getStyle("top"));if(top+h+this.heightN+this.heightS>_2d-this.constraintPad.bottom){h=_2d-this.constraintPad.bottom-top-this.heightN-this.heightS;}}return h;},_createWindow:function(id){var _2e=this.options.className;var win=document.createElement("div");win.setAttribute("id",id);win.className="dialog";var _2f;if(this.options.url){_2f="<iframe frameborder=\"0\" name=\""+id+"_content\"  id=\""+id+"_content\" src=\""+this.options.url+"\"> </iframe>";}else{_2f="<div id=\""+id+"_content\" class=\""+_2e+"_content\"> </div>";}var _30=this.options.closable?"<div class='"+_2e+"_close' id='"+id+"_close' onclick='Windows.close(\""+id+"\", event)'> </div>":"";var _31=this.options.minimizable?"<div class='"+_2e+"_minimize' id='"+id+"_minimize' onclick='Windows.minimize(\""+id+"\", event)'> </div>":"";var _32=this.options.maximizable?"<div class='"+_2e+"_maximize' id='"+id+"_maximize' onclick='Windows.maximize(\""+id+"\", event)'> </div>":"";var _33=this.options.resizable?"class='"+_2e+"_sizer' id='"+id+"_sizer'":"class='"+_2e+"_se'";var _34="../themes/default/blank.gif";win.innerHTML=_30+_31+_32+"      <table id='"+id+"_row1' class=\"top table_window\">        <tr>          <td class='"+_2e+"_nw'></td>          <td class='"+_2e+"_n'><div id='"+id+"_top' class='"+_2e+"_title title_window'>"+this.options.title+"</div></td>          <td class='"+_2e+"_ne'></td>        </tr>      </table>      <table id='"+id+"_row2' class=\"mid table_window\">        <tr>          <td class='"+_2e+"_w'></td>            <td id='"+id+"_table_content' class='"+_2e+"_content' valign='top'>"+_2f+"</td>          <td class='"+_2e+"_e'></td>        </tr>      </table>        <table id='"+id+"_row3' class=\"bot table_window\">        <tr>          <td class='"+_2e+"_sw'></td>            <td class='"+_2e+"_s'><div id='"+id+"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>            <td "+_33+"></td>        </tr>      </table>    ";Element.hide(win);this.options.parent.insertBefore(win,this.options.parent.firstChild);Event.observe($(id+"_content"),"load",this.options.onload);return win;},changeClassName:function(_35){var _36=this.options.className;var id=this.getId();$A(["_close","_minimize","_maximize","_sizer","_content"]).each(function(_37){this._toggleClassName($(id+_37),_36+_37,_35+_37);}.bind(this));this._toggleClassName($(id+"_top"),_36+"_title",_35+"_title");$$("#"+id+" td").each(function(td){td.className=td.className.sub(_36,_35);});this.options.className=_35;},_toggleClassName:function(_38,_39,_3a){if(_38){_38.removeClassName(_39);_38.addClassName(_3a);}},setLocation:function(top,_3b){top=this._updateTopConstraint(top);_3b=this._updateLeftConstraint(_3b);var e=this.currentDrag||this.element;e.setStyle({top:top+"px"});e.setStyle({left:_3b+"px"});this.useLeft=true;this.useTop=true;},getLocation:function(){var _3c={};if(this.useTop){_3c=Object.extend(_3c,{top:this.element.getStyle("top")});}else{_3c=Object.extend(_3c,{bottom:this.element.getStyle("bottom")});}if(this.useLeft){_3c=Object.extend(_3c,{left:this.element.getStyle("left")});}else{_3c=Object.extend(_3c,{right:this.element.getStyle("right")});}return _3c;},getSize:function(){return {width:this.width,height:this.height};},setSize:function(_3d,_3e,_3f){_3d=parseFloat(_3d);_3e=parseFloat(_3e);if(!this.minimized&&_3d<this.options.minWidth){_3d=this.options.minWidth;}if(!this.minimized&&_3e<this.options.minHeight){_3e=this.options.minHeight;}if(this.options.maxHeight&&_3e>this.options.maxHeight){_3e=this.options.maxHeight;}if(this.options.maxWidth&&_3d>this.options.maxWidth){_3d=this.options.maxWidth;}if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&_3f){new Effect.ResizeWindow(this,null,null,_3d,_3e,{duration:Window.resizeEffectDuration});}else{this.width=_3d;this.height=_3e;var e=this.currentDrag?this.currentDrag:this.element;e.setStyle({width:_3d+this.widthW+this.widthE+"px"});e.setStyle({height:_3e+this.heightN+this.heightS+"px"});if(!this.currentDrag||this.currentDrag==this.element){var _40=$(this.element.id+"_content");_40.setStyle({height:_3e+"px"});_40.setStyle({width:_3d+"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(_41){if(!this.width||!this.height||!this.visible){this.computeBounds();}var w=this.width;var h=this.height;if(!_41){w+=this.widthW+this.widthE;h+=this.heightN+this.heightS;}var _42=Object.extend(this.getLocation(),{width:w+"px",height:h+"px"});return _42;},computeBounds:function(){if(!this.width||!this.height){var _43=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className);if(this.height){this.width=_43+5;}else{this.height=_43+5;}}this.setSize(this.width,this.height);if(this.centered){this._center(this.centerTop,this.centerLeft);}},show:function(_44){this.visible=true;if(_44){if(typeof this.overlayOpacity=="undefined"){var _45=this;setTimeout(function(){_45.show(_44);},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(_46,top,_47){this.centered=true;this.centerTop=top;this.centerLeft=_47;this.show(_46);},isVisible:function(){return this.visible;},_center:function(top,_48){var _49=WindowUtilities.getWindowScroll(this.options.parent);var _4a=WindowUtilities.getPageSize(this.options.parent);if(typeof top=="undefined"){top=(_4a.windowHeight-(this.height+this.heightN+this.heightS))/2;}top+=_49.top;if(typeof _48=="undefined"){_48=(_4a.windowWidth-(this.width+this.widthW+this.widthE))/2;}_48+=_49.left;this.setLocation(top,_48);this.toFront();},_recenter:function(_4b){if(this.centered){var _4c=WindowUtilities.getPageSize(this.options.parent);var _4d=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==_4c.windowWidth&&this.pageSize.windowHeight==_4c.windowHeight&&this.windowScroll.left==_4d.left&&this.windowScroll.top==_4d.top){return;}this.pageSize=_4c;this.windowScroll=_4d;if($("overlay_modal")){$("overlay_modal").setStyle({height:(_4c.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.getContent().setStyle({overflow:"hidden"});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 _4e=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var _4f=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){_4f();_4e();};}else{this.options.hideEffectOptions.afterFinish=function(){_4e();};}}Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose");}},minimize:function(){if(this.resizing){return;}var r2=$(this.getId()+"_row2");if(!this.minimized){this.minimized=true;var dh=r2.getDimensions().height;this.r2Height=dh;var h=this.element.getHeight()-dh;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height-dh,{duration:Window.resizeEffectDuration});}else{this.height-=dh;this.element.setStyle({height:h+"px"});r2.hide();}if(!this.useTop){var _50=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(_50+dh)+"px"});}}else{this.minimized=false;var dh=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height+dh,{duration:Window.resizeEffectDuration});}else{var h=this.element.getHeight()+dh;this.height+=dh;this.element.setStyle({height:h+"px"});r2.show();}if(!this.useTop){var _50=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(_50-dh)+"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 _51=WindowUtilities.getWindowScroll(this.options.parent);var _52=WindowUtilities.getPageSize(this.options.parent);var _53=_51.left;var top=_51.top;if(this.options.parent!=document.body){_51={top:0,left:0,bottom:0,right:0};var dim=this.options.parent.getDimensions();_52.windowWidth=dim.width;_52.windowHeight=dim.height;top=0;_53=0;}if(this.constraint){_52.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);_52.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);_53+=Math.max(0,this.constraintPad.left);top+=Math.max(0,this.constraintPad.top);}var _54=_52.windowWidth-this.widthW-this.widthE;var _55=_52.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,top,_53,_54,_55,{duration:Window.resizeEffectDuration});}else{this.setSize(_54,_55);this.element.setStyle(this.useLeft?{left:_53}:{right:_53});this.element.setStyle(this.useTop?{top:top}:{bottom:top});}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(_56){if(Element.setOpacity){Element.setOpacity(this.element,_56);}},setZIndex:function(_57){this.element.setStyle({zIndex:_57});Windows.updateZindex(_57,this);},setTitle:function(_58){if(!_58||_58==""){_58="&nbsp;";}Element.update(this.element.id+"_top",_58);},getTitle:function(){return $(this.element.id+"_top").innerHTML;},setStatusBar:function(_59){var _5a=$(this.getId()+"_bottom");if(typeof (_59)=="object"){if(this.bottombar.firstChild){this.bottombar.replaceChild(_59,this.bottombar.firstChild);}else{this.bottombar.appendChild(_59);}}else{this.bottombar.innerHTML=_59;}},_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(_5b){var div=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(div).height;div.parentNode.removeChild(div);var div=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(div).height;div.parentNode.removeChild(div);var div=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(div).width;div.parentNode.removeChild(div);var div=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(div).width;div.parentNode.removeChild(div);var div=document.createElement("div");div.className="overlay_"+this.options.className;document.body.appendChild(div);var _5c=this;setTimeout(function(){_5c.overlayOpacity=($(div).getStyle("opacity"));div.parentNode.removeChild(div);},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(_5d){var _5e=document.body;var win=document.createElement("div");win.setAttribute("id",this.element.id+"_tmp");win.className=_5d;win.style.display="none";win.innerHTML="";_5e.insertBefore(win,_5e.firstChild);return win;},_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 _5f="";if(this.useLeft){_5f+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle("left"));}else{_5f+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle("right"));}if(this.useTop){_5f+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle("top"));}else{_5f+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle("bottom"));}_5f+=","+(this.storedLocation?this.storedLocation.width:this.width);_5f+=","+(this.storedLocation?this.storedLocation.height:this.height);_5f+=","+this.isMinimized();_5f+=","+this.isMaximized();WindowUtilities.setCookie(_5f,this.cookie);}},_createWiredElement:function(){if(!this.wiredElement){if(Prototype.Browser.IE){this._getWindowBorderSize();}var div=document.createElement("div");div.className="wired_frame "+this.options.className+"_wired_frame";div.style.position="absolute";this.options.parent.insertBefore(div,this.options.parent.firstChild);this.wiredElement=$(div);}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 dim=this.element.getDimensions();this.wiredElement.setStyle({width:dim.width+"px",height:dim.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(_60){if(this.options[_60]){this.options[_60](this);}else{Windows.notify(_60,this);}}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},addObserver:function(_61){this.removeObserver(_61);this.observers.push(_61);},removeObserver:function(_62){this.observers=this.observers.reject(function(o){return o==_62;});},notify:function(_63,win){this.observers.each(function(o){if(o[_63]){o[_63](_63,win);}});},getWindow:function(id){return this.windows.detect(function(d){return d.getId()==id;});},getFocusedWindow:function(){return this.focusedWindow;},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null;},register:function(win){this.windows.push(win);},addModalWindow:function(win){if(this.modalWindows.length==0){WindowUtilities.disableScreen(win.options.className,"overlay_modal",win.overlayOpacity,win.getId(),win.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(win.getId());}this.modalWindows.push(win);},removeModalWindow:function(win){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(win){this.windows.push(win);},unregister:function(win){this.windows=this.windows.reject(function(d){return d==win;});},closeAll:function(){this.windows.each(function(w){Windows.close(w.getId());});},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(win){if(win){win.close();}});},minimize:function(id,_64){var win=this.getWindow(id);if(win&&win.visible){win.minimize();}Event.stop(_64);},maximize:function(id,_65){var win=this.getWindow(id);if(win&&win.visible){win.maximize();}Event.stop(_65);},close:function(id,_66){var win=this.getWindow(id);if(win){win.close();}if(_66){Event.stop(_66);}},blur:function(id){var win=this.getWindow(id);if(!win){return;}if(win.options.blurClassName){win.changeClassName(win.options.blurClassName);}if(this.focusedWindow==win){this.focusedWindow=null;}win._notify("onBlur");},focus:function(id){var win=this.getWindow(id);if(!win){return;}if(this.focusedWindow){this.blur(this.focusedWindow.getId());}if(win.options.focusClassName){win.changeClassName(win.options.focusClassName);}this.focusedWindow=win;win._notify("onFocus");},unsetOverflow:function(_67){this.windows.each(function(d){d.oldOverflow=d.getContent().getStyle("overflow")||"auto";d.getContent().setStyle({overflow:"hidden"});});if(_67&&_67.oldOverflow){_67.getContent().setStyle({overflow:_67.oldOverflow});}},resetOverflow:function(){this.windows.each(function(d){if(d.oldOverflow){d.getContent().setStyle({overflow:d.oldOverflow});}});},updateZindex:function(_68,win){if(_68>this.maxZIndex){this.maxZIndex=_68;if(this.focusedWindow){this.blur(this.focusedWindow.getId());}}this.focusedWindow=win;if(this.focusedWindow){this.focus(this.focusedWindow.getId());}}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(_69,_6a){if(_69&&typeof _69!="string"){Dialog._runAjaxRequest(_69,_6a,Dialog.confirm);return;}_69=_69||"";_6a=_6a||{};var _6b=_6a.okLabel?_6a.okLabel:"Ok";var _6c=_6a.cancelLabel?_6a.cancelLabel:"Cancel";_6a=Object.extend(_6a,_6a.windowParameters||{});_6a.windowParameters=_6a.windowParameters||{};_6a.className=_6a.className||"alert";var _6d="class ='"+(_6a.buttonClass?_6a.buttonClass+" ":"")+" ok_button'";var _6e="class ='"+(_6a.buttonClass?_6a.buttonClass+" ":"")+" cancel_button'";var _69="      <div class='"+_6a.className+"_message'>"+_69+"</div>        <div class='"+_6a.className+"_buttons'>          <input type='button' value='"+_6b+"' onclick='Dialog.okCallback()' "+_6d+"/>          <input type='button' value='"+_6c+"' onclick='Dialog.cancelCallback()' "+_6e+"/>        </div>    ";return this._openDialog(_69,_6a);},alert:function(_6f,_70){if(_6f&&typeof _6f!="string"){Dialog._runAjaxRequest(_6f,_70,Dialog.alert);return;}_6f=_6f||"";_70=_70||{};var _71=_70.okLabel?_70.okLabel:"Ok";_70=Object.extend(_70,_70.windowParameters||{});_70.windowParameters=_70.windowParameters||{};_70.className=_70.className||"alert";var _72="class ='"+(_70.buttonClass?_70.buttonClass+" ":"")+" ok_button'";var _6f="      <div class='"+_70.className+"_message'>"+_6f+"</div>        <div class='"+_70.className+"_buttons'>          <input type='button' value='"+_71+"' onclick='Dialog.okCallback()' "+_72+"/>        </div>";return this._openDialog(_6f,_70);},info:function(_73,_74){if(_73&&typeof _73!="string"){Dialog._runAjaxRequest(_73,_74,Dialog.info);return;}_73=_73||"";_74=_74||{};_74=Object.extend(_74,_74.windowParameters||{});_74.windowParameters=_74.windowParameters||{};_74.className=_74.className||"alert";var _73="<div id='modal_dialog_message' class='"+_74.className+"_message'>"+_73+"</div>";if(_74.showProgress){_73+="<div id='modal_dialog_progress' class='"+_74.className+"_progress'>  </div>";}_74.ok=null;_74.cancel=null;return this._openDialog(_73,_74);},setInfoMessage:function(_75){$("modal_dialog_message").update(_75);},closeInfo:function(){Windows.close(this.dialogId);},_openDialog:function(_76,_77){var _78=_77.className;if(!_77.height&&!_77.width){_77.width=WindowUtilities.getPageSize(_77.options.parent||document.body).pageWidth/2;}if(_77.id){this.dialogId=_77.id;}else{var t=new Date();this.dialogId="modal_dialog_"+t.getTime();_77.id=this.dialogId;}if(!_77.height||!_77.width){var _79=WindowUtilities._computeSize(_76,this.dialogId,_77.width,_77.height,5,_78);if(_77.height){_77.width=_79+5;}else{_77.height=_79+5;}}_77.effectOptions=_77.effectOptions;_77.resizable=_77.resizable||false;_77.minimizable=_77.minimizable||false;_77.maximizable=_77.maximizable||false;_77.draggable=_77.draggable||false;_77.closable=_77.closable||false;var win=new Window(_77);win.getContent().innerHTML=_76;win.showCenter(true,_77.top,_77.left);win.setDestroyOnClose();win.cancelCallback=_77.onCancel||_77.cancel;win.okCallback=_77.onOk||_77.ok;return win;},_getAjaxContent:function(_7a){Dialog.callFunc(_7a.responseText,Dialog.parameters);},_runAjaxRequest:function(_7b,_7c,_7d){if(_7b.options==null){_7b.options={};}Dialog.onCompleteFunc=_7b.options.onComplete;Dialog.parameters=_7c;Dialog.callFunc=_7d;_7b.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(_7b.url,_7b.options);},okCallback:function(){var win=Windows.focusedWindow;if(!win.okCallback||win.okCallback(win)){$$("#"+win.getId()+" input").each(function(_7e){_7e.onclick=null;});win.close();}},cancelCallback:function(){var win=Windows.focusedWindow;$$("#"+win.getId()+" input").each(function(_7f){_7f.onclick=null;});win.close();if(win.cancelCallback){win.cancelCallback(win);}}};if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1]);}var WindowUtilities={getWindowScroll:function(_80){var T,L,W,H;_80=_80||document.body;if(_80!=document.body){T=_80.scrollTop;L=_80.scrollLeft;W=_80.scrollWidth;H=_80.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(_81){_81=_81||document.body;var _82,_83;var _84,_85;if(_81!=document.body){_82=_81.getWidth();_83=_81.getHeight();_85=_81.scrollWidth;_84=_81.scrollHeight;}else{var _86,_87;if(window.innerHeight&&window.scrollMaxY){_86=document.body.scrollWidth;_87=window.innerHeight+window.scrollMaxY;}else{if(document.body.scrollHeight>document.body.offsetHeight){_86=document.body.scrollWidth;_87=document.body.scrollHeight;}else{_86=document.body.offsetWidth;_87=document.body.offsetHeight;}}if(self.innerHeight){_82=self.innerWidth;_83=self.innerHeight;}else{if(document.documentElement&&document.documentElement.clientHeight){_82=document.documentElement.clientWidth;_83=document.documentElement.clientHeight;}else{if(document.body){_82=document.body.clientWidth;_83=document.body.clientHeight;}}}if(_87<_83){_84=_83;}else{_84=_87;}if(_86<_82){_85=_82;}else{_85=_86;}}return {pageWidth:_85,pageHeight:_84,windowWidth:_82,windowHeight:_83};},disableScreen:function(_88,_89,_8a,_8b,_8c){WindowUtilities.initLightbox(_89,_88,function(){this._disableScreen(_88,_89,_8a,_8b);}.bind(this),_8c||document.body);},_disableScreen:function(_8d,_8e,_8f,_90){var _91=$(_8e);var _92=WindowUtilities.getPageSize(_91.parentNode);if(_90&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(_90);}_91.style.height=(_92.pageHeight+"px");_91.style.display="none";if(_8e=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){_91.overlayOpacity=_8f;new Effect.Appear(_91,Object.extend({from:0,to:_8f},Windows.overlayShowEffectOptions));}else{_91.style.display="block";}},enableScreen:function(id){id=id||"overlay_modal";var _93=$(id);if(_93){if(id=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions){new Effect.Fade(_93,Object.extend({from:_93.overlayOpacity,to:0},Windows.overlayHideEffectOptions));}else{_93.style.display="none";_93.parentNode.removeChild(_93);}if(id!="__invisible__"){WindowUtilities._showSelect();}}},_hideSelect:function(id){if(Prototype.Browser.IE){id=id==null?"":"#"+id+" ";$$(id+"select").each(function(_94){if(!WindowUtilities.isDefined(_94.oldVisibility)){_94.oldVisibility=_94.style.visibility?_94.style.visibility:"visible";_94.style.visibility="hidden";}});}},_showSelect:function(id){if(Prototype.Browser.IE){id=id==null?"":"#"+id+" ";$$(id+"select").each(function(_95){if(WindowUtilities.isDefined(_95.oldVisibility)){try{_95.style.visibility=_95.oldVisibility;}catch(e){_95.style.visibility="visible";}_95.oldVisibility=null;}else{if(_95.style.visibility){_95.style.visibility="visible";}}});}},isDefined:function(_96){return typeof (_96)!="undefined"&&_96!=null;},initLightbox:function(id,_97,_98,_99){if($(id)){Element.setStyle(id,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;_98();}else{var _9a=document.createElement("div");_9a.setAttribute("id",id);_9a.className="overlay_"+_97;_9a.style.display="none";_9a.style.position="absolute";_9a.style.top="0";_9a.style.left="0";_9a.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;_9a.style.width="100%";_99.insertBefore(_9a,_99.firstChild);if(Prototype.Browser.WebKit&&id=="overlay_modal"){setTimeout(function(){_98();},10);}else{_98();}}},setCookie:function(_9b,_9c){document.cookie=_9c[0]+"="+escape(_9b)+((_9c[1])?"; expires="+_9c[1].toGMTString():"")+((_9c[2])?"; path="+_9c[2]:"")+((_9c[3])?"; domain="+_9c[3]:"")+((_9c[4])?"; secure":"");},getCookie:function(_9d){var dc=document.cookie;var _9e=_9d+"=";var _9f=dc.indexOf("; "+_9e);if(_9f==-1){_9f=dc.indexOf(_9e);if(_9f!=0){return null;}}else{_9f+=2;}var end=document.cookie.indexOf(";",_9f);if(end==-1){end=dc.length;}return unescape(dc.substring(_9f+_9e.length,end));},_computeSize:function(_a0,id,_a1,_a2,_a3,_a4){var _a5=document.body;var _a6=document.createElement("div");_a6.setAttribute("id",id);_a6.className=_a4+"_content";if(_a2){_a6.style.height=_a2+"px";}else{_a6.style.width=_a1+"px";}_a6.style.position="absolute";_a6.style.top="0";_a6.style.left="0";_a6.style.display="none";_a6.innerHTML=_a0;_a5.insertBefore(_a6,_a5.firstChild);var _a7;if(_a2){_a7=$(_a6).getDimensions().width+_a3;}else{_a7=$(_a6).getDimensions().height+_a3;}_a5.removeChild(_a6);return _a7;}};
