var Window=Class.create();Window.prototype={initialize:function(id){if($(id)) alert("Window "+id+" 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.getElementsByTagName("body").item(0),title:" ",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1},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.hideEffect==Element.hide) this.options.hideEffect=function(){Element.hide(this.element);if(this.destroyOnClose)this.destroy();}.bind(this) this.element=this._createWindow(id);this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventKeyPress=this._keyPress.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);if(this.options.draggable){this.bottombar.addClassName("bottom_draggable");this.topbar.addClassName("top_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;if(this.width&&this.height) this.setSize(this.options.width,this.options.height);this.setTitle(this.options.title) Windows.register(this);},destroy:function(){Windows.notify("onDestroy",this);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.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(delegate){this.delegate=delegate},getDelegate:function(){return this.delegate;},getContent:function(){return this.content;},setContent:function(id,autoresize,autoposition){var d=null;var p=null;if(autoresize) d=Element.getDimensions(id);if(autoposition) p=Position.cumulativeOffset($(id));var content=this.getContent() content.appendChild($(id));$(id).show();if(autoresize) this.setSize(d.width,d.height);if(autoposition) this.setLocation(p[1]-this.heightN,p[0]-this.widthW);},setAjaxContent:function(url,options,showCentered,showModal){this.showFunction=showCentered?"showCenter":"show";this.showModal=showModal||false;if(options==null) options={} this.onComplete=options.onComplete;options.onComplete=this._setAjaxContent.bind(this);new Ajax.Request(url,options);},_setAjaxContent:function(originalRequest){this.getContent().innerHTML=originalRequest.responseText;if(this.onComplete) this.onComplete(originalRequest);this[this.showFunction](this.showModal)},setCookie:function(name,expires,path,domain,secure){name=name||this.element.id;this.cookie=[name,expires,path,domain,secure];var value=WindowUtilities.getCookie(name) if(value){var values=value.split(',');var x=values[0].split(':');var y=values[1].split(':');var w=parseFloat(values[2]),h=parseFloat(values[3]);var mini=values[4];var maxi=values[5];this.setSize(w,h);if(mini=="true") this.doMinimize=true;else if(maxi=="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(){var destroyFunc=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var func=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){func();destroyFunc()}} else this.options.hideEffectOptions.afterFinish=function(){destroyFunc()} this.destroyOnClose=true;},_initDrag:function(event){this.pointer=[Event.pointerX(event),Event.pointerY(event)];if(Event.element(event)==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 closeButton=$(this.getId()+'_close');if(closeButton&&Position.within(closeButton,this.pointer[0],this.pointer[1])) 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;};Event.stop(event);},_updateDrag:function(event){var pointer=[Event.pointerX(event),Event.pointerY(event)];var dx=pointer[0]-this.pointer[0];var dy=pointer[1]-this.pointer[1];if(this.doResize){this.setSize(this.widthOrg+dx,this.heightOrg+dy);dx=this.width-this.widthOrg dy=this.height-this.heightOrg if(!this.useLeft) this.element.setStyle({right:(this.rightOrg-dx)+'px'});if(!this.useTop) this.element.setStyle({bottom:(this.bottomOrg-dy)+'px'});} else{this.pointer=pointer;if(this.useLeft) this.element.setStyle({left:parseFloat(this.element.getStyle('left'))+dx+'px'});else this.element.setStyle({right:parseFloat(this.element.getStyle('right'))-dx+'px'});if(this.useTop) this.element.setStyle({top:parseFloat(this.element.getStyle('top'))+dy+'px'});else this.element.setStyle({bottom:parseFloat(this.element.getStyle('bottom'))-dy+'px'});} if(this.iefix) this._fixIEOverlapping();this._removeStoreLocation();Event.stop(event);},_endDrag:function(event){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);this._saveCookie() Event.stop(event);document.body.ondrag=null;document.body.onselectstart=null;},_keyPress:function(event){},_createWindow:function(id){var className=this.options.className;var win=document.createElement("div");win.setAttribute('id',id);win.className="dialog "+className+"_window";var content;if(this.options.url) content="";else content="
";var closeDiv=this.options.closable?"
":"";var minDiv=this.options.minimizable?"
":"";var maxDiv=this.options.maximizable?"
":"";var seAttributes=this.options.resizable?"class='"+className+"_sizer' id='"+id+"_sizer'":"class='"+className+"_se'";win.innerHTML=closeDiv+minDiv+maxDiv+"\ \ \ \ \ \ \
 
"+this.options.title+"
 
\ \ \ \ \ \ \
"+content+"
\ \ \ \ \ \ \
 
 
 
\ ";Element.hide(win);this.options.parent.insertBefore(win,this.options.parent.firstChild);Event.observe($(id+"_content"),"load",this.options.onload);return win;},setLocation:function(top,left){if(top<0) top=0;if(left<0) left=0 this.element.setStyle({top:top+'px'});this.element.setStyle({left:left+'px'});this.useLeft=true;this.useTop=true;},getLocation:function(){var location={};if(this.useTop) location=Object.extend(location,{top:this.element.getStyle("top")});else location=Object.extend(location,{bottom:this.element.getStyle("bottom")});if(this.useLeft) location=Object.extend(location,{left:this.element.getStyle("left")});else location=Object.extend(location,{right:this.element.getStyle("right")});return location;},getSize:function(){return{width:this.width,height:this.height};},setSize:function(width,height){width=parseFloat(width);height=parseFloat(height);if(widththis.options.maxHeight) height=this.options.maxHeight;if(this.options.maxWidth&&width>this.options.maxWidth) width=this.options.maxWidth;this.width=width;this.height=height;this.element.setStyle({width:width+this.widthW+this.widthE+"px"}) this.element.setStyle({height:height+this.heightN+this.heightS+"px"}) var content=$(this.element.id+'_content') content.setStyle({height:height+'px'});content.setStyle({width:width+'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(modal){if(modal){WindowUtilities.disableScreen(this.options.className,'overlay_modal',this.getId());this.modal=true;this.setZIndex(Windows.maxZIndex+20);Windows.unsetOverflow(this);Event.observe(document,"keypress",this.eventKeyPress);} if(this.oldStyle) this.getContent().setStyle({overflow:this.oldStyle});if(!this.width||!this.height){var size=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0) if(this.height) this.width=size+5 else this.height=size+5} this.setSize(this.width,this.height);if(this.centered) this._center(this.centerTop,this.centerLeft);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();Windows.notify("onShow",this);},showCenter:function(modal,top,left){this.centered=true;this.centerTop=top;this.centerLeft=left;this.show(modal);},isVisible:function(){return this.element.visible();},_center:function(top,left){var windowScroll=WindowUtilities.getWindowScroll();var pageSize=WindowUtilities.getPageSize();if(!top) top=(pageSize.windowHeight-(this.height+this.heightN+this.heightS))/2;top+=windowScroll.top if(!left) left=(pageSize.windowWidth-(this.width+this.widthW+this.widthE))/2;left+=windowScroll.left this.setLocation(top,left);this.toFront();},_recenter:function(event){if(this.modal){var pageSize=WindowUtilities.getPageSize();if($('overlay_modal')){$('overlay_modal').style.height=(pageSize.pageHeight+'px');$('overlay_modal').style.width=(pageSize.pageWidth+'px');} if(this.centered) this._center(this.centerTop,this.centerLeft);}},hide:function(){if(this.modal){WindowUtilities.enableScreen();Windows.resetOverflow();Event.stopObserving(document,"keypress",this.eventKeyPress);} 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 r2=$(this.getId()+"_row2");var dh=r2.getDimensions().height;if(r2.visible()){var h=this.element.getHeight()-dh r2.hide() this.element.setStyle({height:h+"px"}) if(!this.useTop){var bottom=parseFloat(this.element.getStyle('bottom'));this.element.setStyle({bottom:(bottom+dh)+'px'});}} else{var h=this.element.getHeight()+dh;this.element.setStyle({height:h+"px"}) if(!this.useTop){var bottom=parseFloat(this.element.getStyle('bottom'));this.element.setStyle({bottom:(bottom-dh)+'px'});} r2.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 windowScroll=WindowUtilities.getWindowScroll();var pageSize=WindowUtilities.getPageSize();this.element.setStyle(this.useLeft?{left:windowScroll.left}:{right:windowScroll.left});this.element.setStyle(this.useTop?{top:windowScroll.top}:{bottom:windowScroll.top});this.setSize(pageSize.windowWidth-this.widthW-this.widthE,pageSize.windowHeight-this.heightN-this.heightS) this.toFront();if(this.iefix) this._fixIEOverlapping();} Windows.notify("onMaximize",this);this._saveCookie()},isMinimized:function(){var r2=$(this.getId()+"_row2");return!r2.visible();},isMaximized:function(){return(this.storedLocation!=null);},setOpacity:function(opacity){if(Element.setOpacity) Element.setOpacity(this.element,opacity);},setZIndex:function(zindex){this.element.setStyle({zIndex:zindex});Windows.updateZindex(zindex,this);},setTitle:function(newTitle){if(!newTitle||newTitle=="") newTitle=" ";Element.update(this.element.id+'_top',newTitle);},setStatusBar:function(element){var statusBar=$(this.getId()+"_bottom");if(typeof(element)=="object"){if(this.bottombar.firstChild) this.bottombar.replaceChild(element,this.bottombar.firstChild);else this.bottombar.appendChild(element);} else this.bottombar.innerHTML=element;},_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,'');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(event){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);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(className){var objBody=document.getElementsByTagName("body").item(0);var win=document.createElement("div");win.setAttribute('id',this.element.id+"_tmp");win.className=className;win.style.display='none';win.innerHTML='';objBody.insertBefore(win,objBody.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;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 value="";if(this.useLeft) value+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle('left')) else value+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle('right')) if(this.useTop) value+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle('top')) else value+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle('bottom')) value+=","+(this.storedLocation?this.storedLocation.width:this.width);value+=","+(this.storedLocation?this.storedLocation.height:this.height);value+=","+this.isMinimized();value+=","+this.isMaximized();WindowUtilities.setCookie(value,this.cookie)}}};var Windows={windows:[],observers:[],focusedWindow:null,maxZIndex:0,addObserver:function(observer){this.removeObserver(observer);this.observers.push(observer);},removeObserver:function(observer){this.observers=this.observers.reject(function(o){return o==observer});},notify:function(eventName,win){this.observers.each(function(o){if(o[eventName])o[eventName](eventName,win);});},getWindow:function(id){return this.windows.detect(function(d){return d.getId()==id});},getFocusedWindow:function(){return this.focusedWindow;},register:function(win){this.windows.push(win);},unregister:function(win){this.windows=this.windows.reject(function(d){return d==win});},close:function(event,id){var win=this.getWindow(id);if(win){if(win.getDelegate()&&!win.getDelegate().canClose(win)) return;this.notify("onClose",win);win.hide();} if(event) Event.stop(event);},closeAll:function(){this.windows.each(function(w){Windows.close(w.getId())});},minimize:function(event,id){var win=this.getWindow(id) if(win) win.minimize();Event.stop(event);},maximize:function(event,id){var win=this.getWindow(id) if(win) win.maximize();Event.stop(event);},unsetOverflow:function(except){this.windows.each(function(d){d.oldOverflow=d.getContent().getStyle("overflow")||"auto";d.getContent().setStyle({overflow:"hidden"})});if(except&&except.oldOverflow) except.getContent().setStyle({overflow:except.oldOverflow});},resetOverflow:function(){this.windows.each(function(d){if(d.oldOverflow)d.getContent().setStyle({overflow:d.oldOverflow})});},updateZindex:function(zindex,win){if(zindex>this.maxZIndex) this.maxZIndex=zindex;this.focusedWindow=win;}};var Dialog={dialogId:null,win:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(content,parameters){if(typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.confirm);return} parameters=parameters||{};var okLabel=parameters.okLabel?parameters.okLabel:"Ok";var cancelLabel=parameters.cancelLabel?parameters.cancelLabel:"Cancel";var windowParam=parameters.windowParameters||{};windowParam.className=windowParam.className||"alert";okButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" ok_button'" cancelButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" cancel_button'" var content="\
"+content+"
\
\ \ \
\ ";this._openDialog(content,parameters) return this.win},alert:function(content,parameters){if(typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.alert);return} parameters=parameters||{};var okLabel=parameters.okLabel?parameters.okLabel:"Ok";var windowParam=parameters.windowParameters||{};windowParam.className=windowParam.className||"alert";okButtonClass="class ='"+(parameters.buttonClass?parameters.buttonClass+" ":"")+" ok_button'" var content="\
"+content+"
\
\ \
";return this._openDialog(content,parameters)},info:function(content,parameters){if(typeof content!="string"){Dialog._runAjaxRequest(content,parameters,Dialog.info);return} parameters=parameters||{};parameters.windowParameters=parameters.windowParameters||{};var className=parameters.windowParameters.className||"alert";var content="";if(parameters.showProgress) content+="";parameters.windowParameters.ok=null;parameters.windowParameters.cancel=null;parameters.windowParameters.className=className;return this._openDialog(content,parameters)},setInfoMessage:function(message){$('modal_dialog_message').update(message);},closeInfo:function(){Windows.close(null,this.dialogId);},_openDialog:function(content,parameters){if(!parameters.windowParameters.height&&!parameters.windowParameters.width){parameters.windowParameters.width=WindowUtilities.getPageSize().pageWidth/2;} this.dialogId=parameters.id?parameters.id:'modal_dialog';if(!parameters.windowParameters.height||!parameters.windowParameters.width){var size=WindowUtilities._computeSize(content,this.dialogId,parameters.windowParameters.width,parameters.windowParameters.height) if(parameters.windowParameters.height) parameters.windowParameters.width=size+5 else parameters.windowParameters.height=size+5} var windowParam=parameters&¶meters.windowParameters?parameters.windowParameters:{};windowParam.resizable=windowParam.resizable||false;windowParam.effectOptions=windowParam.effectOptions||{duration:1};windowParam.minimizable=false;windowParam.maximizable=false;windowParam.closable=false;this.win=new Window(this.dialogId,windowParam);this.win.getContent().innerHTML=content;this.win.showCenter(true,parameters.top,parameters.left);this.win.setDestroyOnClose();this.win.cancelCallback=parameters.cancel;this.win.okCallback=parameters.ok;return this.win;},_getAjaxContent:function(originalRequest){Dialog.callFunc(originalRequest.responseText,Dialog.parameters)},_runAjaxRequest:function(message,parameters,callFunc){if(message.options==null) message.options={} Dialog.onCompleteFunc=message.options.onComplete;Dialog.parameters=parameters;Dialog.callFunc=callFunc;message.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(message.url,message.options);},okCallback:function(){if(!this.win.okCallback||this.win.okCallback(this.win)) this.win.hide();},cancelCallback:function(){this.win.hide();if(this.win.cancelCallback) this.win.cancelCallback(this.win);}} 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 xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;} var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;} var pageHeight,pageWidth;if(yScroll');w.document.writeln('');w.document.writeln(' Debugging window');w.document.writeln(' ');w.document.writeln('');w.document.writeln('');w.document.writeln('
');w.document.writeln('
');w.document.writeln('

');w.document.writeln('');w.document.writeln('    ');w.document.writeln('    ');w.document.writeln('
');w.document.writeln('
');w.document.writeln('
');w.document.writeln('
');w.document.writeln('
');w.document.writeln('');w.document.writeln('');w.document.close();} w.debugHandler=this;if(this.focusOnNewMessages=null||this.maxShownMessages==null){this.focusOnNewMessages=w.document.getElementById('focusOnNewMessages').checked;this.maxShownMessages=w.document.getElementById('maxShownMessages').value;} var messagesString="";messagesString=messagesString+'';if(this.debugMessages.length>0){var firstTime=this.debugTimes[0].getTime();var prevTime=this.debugTimes[0].getTime();var nrOfMessages=this.debugMessages.length;var maxMessages=this.maxShownMessages;if(maxMessages==""||maxMessages<=0){maxMessages=nrOfMessages;} var firstMessage=nrOfMessages-maxMessages;if(firstMessage<0){firstMessage=0;} for(var i=firstMessage;i';messagesString=messagesString+'';messagesString=messagesString+'';messagesString=messagesString+'';messagesString=messagesString+'';messagesString=messagesString+'';}}else{messagesString=messagesString+'';} messagesString=messagesString+'
TimeDurationDescription
'+(this.debugTimes[i].getTime()-firstTime)+''+relativeTime+' '+message+'
No messages
';w.document.getElementById('messages').innerHTML=messagesString;if(this.focusOnNewMessages){w.focus();} var messageBuffer=2*maxMessages;if(this.debugMessages.length>3*messageBuffer){this.cleanupArrays(messageBuffer);}} function cleanupArraysImpl(nrOfKeptMessages){var begin=this.debugMessages.length-nrOfKeptMessages;if(begin<0||this.debugMessages.length<100){return;} var newMessages=new Array();var newTimes=new Array();var newIndex=0;for(var i=begin;imaxWidth){winWidth=maxWidth;} if(winHeight>maxHeight){winHeight=maxHeight;} var step=Math.round(0.05*dimensions.height);if(step>maxStep){step=maxStep;} if(name=='information')Rietveld.windows['information']=new Window('win1',{url:"about:blank",className:"nuncio",width:winWidth,height:winHeight,top:0.5*step,left:1*step,title:Rietveld.subhomeTitle['information']});if(name=='study')Rietveld.windows['study']=new Window('win2',{url:"about:blank",className:"blue",width:winWidth,height:winHeight,top:1.5*step,left:2*step,title:Rietveld.subhomeTitle['study']});if(name=='service')Rietveld.windows['service']=new Window('win3',{url:"about:blank",className:"yellow",width:winWidth,height:winHeight,top:2.5*step,left:3*step,title:Rietveld.subhomeTitle['service']});if(name=='links')Rietveld.windows['links']=new Window('win4',{url:"about:blank",className:"gragrey_new",width:winWidth,height:winHeight,top:3.5*step,left:4*step,title:Rietveld.subhomeTitle['links']});if(name=='information')Event.observe($('win1'),'click',function(){Rietveld.showWindow('information');},false);if(name=='study')Event.observe($('win2'),'click',function(){Rietveld.showWindow('study');},false);if(name=='service')Event.observe($('win3'),'click',function(){Rietveld.showWindow('service');},false);if(name=='links')Event.observe($('win4'),'click',function(){Rietveld.showWindow('links');},false);} return Rietveld.windows[name];} Rietveld.openPage=function(url,target){if(!Rietveld.enabled){return;} if(Debug.on)debug('Rietveld.openPage() '+target+'\n'+url) var subhome=this.getSubhome(target);subhome.loadContent(url);this.showWindow(target);} Rietveld.getSubhome=function(name){if(!this.subhomes[name]){this.subhomes[name]=new Rietveld.Subhome(name);} return this.subhomes[name];} Rietveld.linkClickHandler=function(evt){try{var el=Event.findElement(evt,'A');var windowName=Rietveld.getDOMDocument(el).category;if(Debug.on)debug('linkClickHandler() in '+windowName);if(el.tagName=='A'&&!el.target&&el.href.match(/^http:|file:/i)&&!(Element.hasClassName(el,'nofollow')||el.href.match(/#\w*$/))){var target=el.className.match(Rietveld.windowIdRegExp);if(target==null){if(!windowName){if(Debug.on)debug('No target in class, so not handling this click');return;}else{target=['',windowName];}} if(Element.hasClassName(el,'is-mainnav')&&Rietveld.subhomes[target[1]]!=null){Rietveld.showWindow(target[1]);}else{Rietveld.openPage(el.href,target[1]);} Event.stop(evt);}else{if(Debug.on)debug('Not handling this click');}}catch(e){if(Debug.on)debug("Exception in linkClickHandler()\n"+e.message);}} Rietveld.windowClickHandler=function(evt){try{var el=Event.element(evt);if(Debug.on)debug('Rietveld.windowClickHandler on '+Rietveld.getDOMDocument(el).category);var win=Rietveld.getSubhome(Rietveld.getDOMDocument(el).category).getWindow();win.toFront();}catch(e){if(Debug.on)debug("Exception in windowClickHandler()\n"+e.message);}} Rietveld.homeClickHandler=function(evt){try{var el=Event.element(evt);var link=Event.findElement(evt,'A');var form=Event.findElement(evt,'FORM');if(Debug.on)debug('homeClickHandler(). Link or form clicked? '+link+' '+form);if((link!=null&&link.tagName=='A')||(form!=null&&form.tagName=='FORM'&&!Rietveld.windowsVisible)){return;} while(el!=document.body&&el!=document){if(Element.hasClassName(el,'dialog')){return;} el=el.parentNode;} if(Rietveld.windowsVisible){if(Debug.on)debug('Windows are visible, so now hide them all.');Rietveld.hideWindows();}else if(Rietveld.hiddenWindowIds.length>0){for(var i=0;i]+>\s*([\w\W]*?)\s*<\/body>[\w\W]*$/i,'$1');var contentElement=this.getDOMWindow().$('content');if(contentElement==null){if(this.retryCount>5){this.retryCount=0;Element.hide('indicator');alert("Could not load this page correctly, please try again.");return;}else{this.retryCount++;} if(Debug.on)debug('contentElement is null (subhome probably not loaded completely), so doing a reload until satisfied!');this.loadContentByAjax(this.currentlyLoadingUrl);return;} if(window.opera){Element.hide('indicator');contentElement.innerHTML=newContent;contentElement.style.display='block';}else{Effect.Fade(contentElement,{duration:0.2,afterFinish:function(){contentElement.innerHTML=newContent;Effect.Appear(contentElement,{duration:0.2,afterFinish:function(){Element.hide('indicator');}});this.getWindow().toFront();this.getDOMWindow().ShowHide.initShowHideContent();}.bind(this)});} if(this.getDOMWindow().TreeMenu&&this.currentlyLoadingUrl){this.getDOMWindow().TreeMenu.expandToNode('tree',this.currentlyLoadingUrl);this.currentlyLoadingUrl=null;}} Rietveld.Subhome.prototype.getWindow=function(){if(Debug.on)debug('Subhome.getWindow() for '+this.name);if(!this.DHTMLWindow){this.DHTMLWindow=Rietveld.getWindow(this.name);} return this.DHTMLWindow;} Rietveld.Subhome.prototype.getDOMWindow=function(){if(Debug.on)debug('Subhome.getDOMWindow()');if(this.DOMWindow&&this.DOMWindow.document.category){return this.DOMWindow;} return null;} Rietveld.Subhome.prototype.isLoaded=function(){if(Debug.on)debug('Subhome.isLoaded() '+((this.DOMWindow&&this.DOMWindow.page&&this.DOMWindow.page.isSubhome==true)?'true':'false'));return(this.DOMWindow&&this.DOMWindow.page&&this.DOMWindow.page.isSubhome==true);} Rietveld.Subhome.prototype.isHomeUrl=function(url){if(Debug.on)debug('Subhome.isHomeUrl:\n'+url+'\n'+this.getDOMWindow().location.href);var firstPart=url;if(url.indexOf('#')!=-1){firstPart=url.substring(0,url.indexOf('#'));} var currentFirstPart=this.getDOMWindow().location.href;if(currentFirstPart.indexOf('#')!=-1){currentFirstPart=currentFirstPart.substring(0,currentFirstPart.indexOf('#'));} if(Debug.on)debug('Subhome.isHomeUrl: '+(firstPart==currentFirstPart));return(firstPart==currentFirstPart);} Rietveld.Subhome.prototype.isSameUrl=function(url1,url2){if(Debug.on)debug('isSameUrl: '+url1+'\n'+url2);url1=url1.toLowerCase();url1=url1.replace(/http:\/\/[^\/]+/,'');url1=url1.replace(/#.*/,'');if(Debug.on)debug('url1: '+url1);url2=url2.toLowerCase();url2=url2.replace(/http:\/\/[^\/]+/,'');url2=url2.replace(/#.*/,'');if(Debug.on)debug('url2: '+url2);if(Debug.on)debug('isSameUrl: '+(url1==url2));return(url1==url2);} function Utils(){} Utils.lastInspectId=0;Utils.inspect=function(thing,thingname,indent,references){if(thingname==null){thingname=typeof(thing);} if(indent==null){indent="";} var report="";try{if(thing==null){report+=indent+thingname+": null\n";}else if(typeof thing=="function"){report+=indent+thingname+"()\n";}else if(thing.nodeType){report+=indent+thingname+": XML Object\n";}else if(typeof thing=="object"){if(!thing.__inspectId){thing.__inspectId=Utils.lastInspectId++;} if(references==null){references=new Array();} var alreadyInReferences=(references[thing.__inspectId]==true);if(alreadyInReferences){return report+indent+thingname+": {circular reference}\n";}else{references[thing.__inspectId]=true;} report+=indent+thingname+": {\n";var comma="";try{for(var name in thing){if(name=='__inspectId'){continue;} report+=comma+this.inspect(thing[name],name,indent+" ",references);comma=",";}}catch(e){report+=indent+" "+"Error inspecting "+thingname+": Could not loop through its children. "+e.message+"\n";} report+=indent+"}\n";if(!alreadyInReferences){references[thing.__inspectId]=false;delete thing.__inspectId;}}else if(typeof thing=="string"){report+=indent+thingname+": `"+thing+"`\n";}else{report+=indent+thingname+": "+thing+"\n";}}catch(e){report=indent+thingname+": Error inspecting "+thing+". "+e.message+"\n";} return report;} function rietveldLoadContent(){if(top.Rietveld&&location.hash&&location.hash.indexOf('page=')>-1){var pairs=location.hash.substring(1).split('&');var params={};for(var i=0;i0)?pairs[i].substring(0,splitIndex):pairs[i]);var value=((splitIndex>0&&splitIndex