Zapatec.Window=function(config){this.moving=false;this.winDiv=null;this.titleArea=null;this.titleText=null;this.minButton=null;this.maxButton=null;this.closeButton=null;this.contentArea=null;this.statusArea=null;this.resizeArea=null;this.winNumber=0;this.config={};this.config.showTitle=true;this.config.showRestoreButton=false;this.config.minWidth=700;this.config.minHeight=70;this.config.state="simple";this.config.titleWidth=0;this.config.contentWidth=0;this.config.statusWidth=0;this.config.heightDiff=0;this.config.left=0;this.config.top=0;this.config.width=0;this.config.height=0;this.setConfig(config);};Zapatec.Window.prototype.setConfig=function(config){this.config.showMinButton=(typeof config.showMinButton!="undefined")?config.showMinButton:true;this.config.showMaxButton=(typeof config.showMaxButton!="undefined")?config.showMaxButton:true;this.config.showCloseButton=(typeof config.showCloseButton!="undefined")?config.showCloseButton:true;this.config.showStatus=(typeof config.showStatus!="undefined")?config.showStatus:true;this.config.canResize=(typeof config.showResize!="undefined")?config.showResize:true;this.config.raiseOnlyOnTitle=(typeof config.raiseOnlyOnTitle!="undefined")?config.raiseOnlyOnTitle:true;this.config.canDrag=(typeof config.canDrag!="undefined")?config.canDrag:true;this.config.modal=(typeof config.modal!="undefined")?config.modal:false;this.onContentLoad=(typeof config.onLoad!="undefined")?config.onLoad:function(){};};Zapatec.Window.setup=function(config){if(!config)config={};if(config.popup){var win=new Zapatec.Window(config);if(typeof config.popup=="string"){config.popup=document.getElementById(config.popup);}if(!config.popup){alert("You specified wrong trigger element!");win.destroy();return;}if(!config.triggerEvent){config.triggerEvent="click";}if(!config.align){config.align=null;}el=config.popup;el["on"+config.triggerEvent]=function(ev){if(!win.winDiv){win.create(0,0,config.width||win.config.minWidth,config.height||win.config.minHeight);if(config.title){win.setTitle(config.title);}if(config.content){win.setContent(config.content);}if(config.divContent){win.setDivContent(config.divContent);}if(config.urlContent){win.setContentUrl(config.urlContent);}}if(!win.config.visible){win.showAtElement(this,config.align);}return false;};return;}else{var win=new Zapatec.Window(config);win.create(config.left||0,config.top||0,config.width||win.config.minWidth,config.height||win.config.minHeight);if(config.title){win.setTitle(config.title);}if(config.content){win.setContent(config.content);}if(config.divContent){win.setDivContent(config.divContent);}if(config.urlContent){win.setContentUrl(config.urlContent);}win.show();}return win;};Zapatec.Window.mouseDown=function(ev,win,target){if(!win.config.raiseOnlyOnTitle){win.raise();}else{if(target&&((target.buttonType=="move")||(target.buttonType=="min")||(target.buttonType=="max")||(target.buttonType=="close")||(target.buttonType=="restore"))){win.raise();}}if(target){switch(target.buttonType){case "move":{this.moving=true;if(!target.customMouseDown){if(win.config.canDrag&&win.config.state!="min"&&win.config.state!="max"){win.showStatus('Drag the window','temp');var posX=ev.pageX||ev.clientX+window.document.body.scrollLeft||0;var posY=ev.pageY||ev.clientY+window.document.body.scrollTop||0;var L=parseInt(win.winDiv.style.left)||0;var T=parseInt(win.winDiv.style.top)||0;win.winDiv.xOffs=(posX-L);win.winDiv.yOffs=(posY-T);}}else{target.customMouseDown(ev,win,target);}break;}case "resize":{if(!target.customMouseDown){if(win.config.canResize&&win.config.state!="min"&&win.config.state!="max"){win.showStatus('resize the window','temp');win.winDiv.xOffs=parseInt(win.winDiv.style.left)||0;win.winDiv.yOffs=parseInt(win.winDiv.style.top)||0;}}else{target.customMouseDown(ev,win,target);}break;}case "close":{if(!target.customMouseDown){}else{target.customMouseDown(ev,win,target);}break;}case "min":{if(!target.customMouseDown){}else{target.customMouseDown(ev,win,target);}break;}case "max":{if(!target.customMouseDown){}else{target.customMouseDown(ev,win,target);}break;}case "restore":{if(!target.customMouseDown){}else{target.customMouseDown(ev,win,target);}break;}}}};Zapatec.Window.mouseMove=function(ev,win,target){if(target){switch(target.buttonType){case "move":{if(this.moving==true){if(!target.customMouseMove){if(win.config.canDrag&&win.config.state!="min"&&win.config.state!="max"){var posX=ev.pageX||ev.clientX+window.document.body.scrollLeft||0;var posY=ev.pageY||ev.clientY+window.document.body.scrollTop||0;var L=posX-win.winDiv.xOffs,T=posY-win.winDiv.yOffs;win.setPos(L,T);}}else{target.customMouseMove(ev,win,target);}if(tip_visible==true){tip_show(tip_anchor,tip_id,true);}}break;}case "resize":{if(!target.customMouseMove){if(win.config.canResize&&win.config.state!="min"&&win.config.state!="max"){var posX=ev.pageX||ev.clientX+window.document.body.scrollLeft||0;var posY=ev.pageY||ev.clientY+window.document.body.scrollTop||0;var style=win.winDiv.style;var newWidth=posX-win.winDiv.xOffs;if(newWidth<win.config.minWidth){newWidth=win.config.minWidth;}var newHeight=posY-win.winDiv.yOffs-win.config.heightDiff;if(newHeight<win.config.minHeight){newHeight=win.config.minHeight;}win.setSize(newWidth,newHeight);}}else{target.customMouseMove(ev,win,target);}break;}}}};Zapatec.Window.mouseUp=function(ev,win,target){if(target){switch(target.buttonType){case "move":{this.moving=false;if(!target.customMouseUp){if(win.config.canDrag){win.showStatus('','restore');}}else{target.customMouseUp(ev,win,target);}break;}case "resize":{if(!target.customMouseUp){if(win.config.canResize){win.showStatus('','resize');}}else{target.customMouseUp(ev,win,target);}break;}case "close":{if(!target.customMouseUp){win.close();}else{target.customMouseUp(ev,win,target);}break;}case "min":{if(!target.customMouseUp){if(win.config.showMinButton&&win.state!="min"&&target==(ev.srcElement||ev.target)){if(win.contentArea){var style=win.titleArea.nextSibling.style;style.display="none";}if(win.statusArea||win.resizeArea){style=win.titleArea.nextSibling.nextSibling.style;style.display="none";}target.buttonType="restore";target.className="zpWinRestoreButton";win.winDiv.style.width=Zapatec.Window.minWinWidth+"px";if(win.titleText)win.titleText.style.width=(Zapatec.Window.minWinWidth-(win.config.width-win.config.titleWidth))+"px";win.winDiv.style.left=Zapatec.Window.minimizeLeft+"px";win.winDiv.style.top="";win.winDiv.style.bottom="0px";win.config.showMinButton=false;if(win.config.state=="max"){win.config.showMaxButton=true;win.maxButton.className="zpWinMaxButton";win.maxButton.buttonType="max";}else{win.config.showRestoreButton=true;}win.config.state="min";if(Zapatec.Window.lastActive){Zapatec.Window.lastActive.setCurrent();}Zapatec.Utils.setupWCH(win.WCH,Zapatec.Window.minimizeLeft,0,Zapatec.Window.minWinWidth,win.config.minHeight);if(win.WCH){win.WCH.style.top="";win.WCH.style.bottom="0px";}Zapatec.Window.minimizeLeft+=Zapatec.Window.minWinWidth+5;}}else{target.customMouseUp(ev,win,target);}break;}case "max":{if(!target.customMouseUp){if(win.config.showMaxButton&&win.state!="max"&&target==(ev.srcElement||ev.target)){var sizes=Zapatec.Utils.getWindowSize();var windowWidth=sizes.width;var windowHeight=sizes.height;var style=win.winDiv.style;style.left="0px";style.top="0px";var diff=win.config.width-windowWidth;style.width=windowWidth+"px";if(win.titleText)win.titleText.style.width=(win.config.titleWidth-diff)+"px";if(win.contentArea)win.contentArea.style.width=(win.config.contentWidth-diff)+"px";if(win.statusArea)win.statusArea.style.width=(win.config.statusWidth-diff)+"px";win.contentArea.style.height=(windowHeight-win.config.heightDiff)+"px";Zapatec.Utils.setupWCH(win.WCH,0,0,windowWidth,windowHeight);if(win.config.state=="min"){if(win.contentArea){var style=win.titleArea.nextSibling.style;if(!Zapatec.is_ie){if(style.display!="table-row"){style.display="table-row";}}else{if(style.display!="block"){style.display="block";}}}if(win.statusArea||win.resizeArea){var style=win.titleArea.nextSibling.nextSibling.style;if(!Zapatec.is_ie){if(style.display!="table-row"){style.display="table-row";}}else{if(style.display!="block"){style.display="block";}}}win.winDiv.style.bottom="";win.config.showMinButton=true;win.minButton.className="zpWinMinButton";win.minButton.buttonType="min";Zapatec.Window.sortMin(win);}else{win.config.showRestoreButton=true;}win.config.showMaxButton=false;win.config.state="max";target.buttonType="restore";target.className="zpWinRestoreButton";}}else{target.customMouseUp(ev,win,target);}break;}case "restore":{if(!target.customMouseUp){if(win.config.showRestoreButton&&win.state!="simple"&&target==(ev.srcElement||ev.target)){if(win.contentArea){var style=win.titleArea.nextSibling.style;if(!Zapatec.is_ie){if(style.display!="table-row"){style.display="table-row";}}else{if(style.display!="block"){style.display="block";}}}if(win.statusArea||win.resizeArea){var style=win.titleArea.nextSibling.nextSibling.style;if(!Zapatec.is_ie){if(style.display!="table-row"){style.display="table-row";}}else{if(style.display!="block"){style.display="block";}}}win.winDiv.style.bottom="";win.config.showRestoreButton=false;if(win.config.state=="min"){win.config.showMinButton=true;target.buttonType="min";target.className="zpWinMinButton";Zapatec.Window.sortMin(win);}else if(win.config.state=="max"){win.config.showMaxButton=true;target.buttonType="max";target.className="zpWinMaxButton";}win.config.state="simple";win.setPosAndSize(win.config.left,win.config.top,win.config.width,win.config.height);}}else{target.customMouseUp(ev,win,target);}break;}}}};Zapatec.Window.prototype.addEvents=function(){var self=this,target=null;Zapatec.Utils.addEvent(this.winDiv,"mousedown",function(ev){ev=ev||window.event;target=Zapatec.Utils.getTargetElement(ev);while(!target.buttonType&&(target!=self.winDiv)){target=target.parentNode;}if(!target.buttonType)target=null;Zapatec.Window.mouseDown(ev,self,target);if(target)return Zapatec.Utils.stopEvent(ev);});Zapatec.Utils.addEvent(window.document,"mousemove",function(ev){ev=ev||window.event;Zapatec.Window.mouseMove(ev,self,target);if(target)return Zapatec.Utils.stopEvent(ev);});Zapatec.Utils.addEvent(window.document,"mouseup",function(ev){ev=ev||window.event;Zapatec.Window.mouseUp(ev,self,target);target=null;if(target)return Zapatec.Utils.stopEvent(ev);});};Zapatec.Window.prototype.calculateSizes=function(){this.winDiv.style.display="block";if(this.titleArea){this.config.titleWidth=this.config.width-(this.winDiv.offsetWidth-this.titleText.offsetWidth);}if(this.contentArea){this.config.contentWidth=this.config.width-(this.winDiv.offsetWidth-this.contentArea.offsetWidth);}if(this.statusArea){this.config.statusWidth=this.config.width-(this.winDiv.offsetWidth-this.statusArea.offsetWidth);}this.config.heightDiff=this.winDiv.offsetHeight-this.config.height;this.winDiv.style.display="none";};Zapatec.Window.prototype.create=function(x,y,width,height){var noButtons= !((this.config.showMinButton==true)||(this.config.showMaxButton)||(this.config.showCloseButton));var config=this.config;var div=this.winDiv=Zapatec.Utils.createElement("div",null,true);div.style.position="absolute";div.style.width=(this.config.width=width)+(width=="auto"?"":"px");div.style.display="none";this.config.visible=false;this.addEvents();div=Zapatec.Utils.createElement("div",div,true);div.className="zpWin";div.id="zpWin";div.innerHTML=theDialogInnerHTML;var table=Zapatec.Utils.createElement("table",div,true);table.style.display='none';table.border=0;table.cellPadding="0";table.cellSpacing="0";var tbody=Zapatec.Utils.createElement("tbody",table,true);if(config.showTitle==true){var tr=this.titleArea=Zapatec.Utils.createElement("tr",tbody);tr.buttonType="move";tr.className="zpWinTitleArea";var td=Zapatec.Utils.createElement("td",tr);div=Zapatec.Utils.createElement("div",td);div.innerHTML="&nbsp;";td=Zapatec.Utils.createElement("td",tr);td.style.width="100%";div=this.titleText=Zapatec.Utils.createElement("div",td);div.className="zpWinTitleText";div.style.overflow="hidden";div.style.width="100%";div.style.height="100%";div.appendChild(document.createTextNode(""));td=Zapatec.Utils.createElement("td",tr);if(config.showMinButton==true){div=this.minButton=Zapatec.Utils.createElement("div",td);div.style.overflow="hidden";div.buttonType="min";div.className="zpWinMinButton";}td=Zapatec.Utils.createElement("td",tr);if(config.showMaxButton==true){div=this.maxButton=Zapatec.Utils.createElement("div",td);div.style.overflow="hidden";div.buttonType="max";div.className="zpWinMaxButton";}td=Zapatec.Utils.createElement("td",tr);if(config.showCloseButton==true){div=this.closeButton=Zapatec.Utils.createElement("div",td);div.style.overflow="hidden";div.buttonType="close";div.className="zpWinCloseButton";}else if(!Zapatec.is_ie&&noButtons){div=Zapatec.Utils.createElement("div",td);div.innerHTML="&nbsp;";}tr.firstChild.id="titleFirstCell";tr.lastChild.id="titleLastCell";}tr=Zapatec.Utils.createElement("tr",tbody,true);td=Zapatec.Utils.createElement("td",tr,true);td.colSpan=5;div=this.contentArea=document.createElement("div");td.appendChild(div);div.style.height=(this.config.height=height)+(height=="auto"?"":"px");div.style.width="100%";div.style.overflow="auto";div.className="zpWinContent";div.appendChild(document.createTextNode(""));if((config.showStatus==true)||(config.canResize==true)){tr=Zapatec.Utils.createElement("tr",tbody);td=Zapatec.Utils.createElement("td",tr);td.colSpan=5;td.id="statusCell";table=Zapatec.Utils.createElement("table",td);table.height="100%";table.cellPadding="0";table.cellSpacing="0";tbody=Zapatec.Utils.createElement("tbody",table);tr=Zapatec.Utils.createElement("tr",tbody);td=Zapatec.Utils.createElement("td",tr);td.style.verticalAlign="bottom";td.style.width="100%";if(config.showStatus==true){div=this.statusArea=Zapatec.Utils.createElement("div",td);div.style.overflow="hidden";div.style.width="100%";div.className="zpWinStatus";div.appendChild(document.createTextNode(""));}if(config.canResize==true){td=Zapatec.Utils.createElement("td",tr);td.style.verticalAlign="bottom";div=this.resizeArea=Zapatec.Utils.createElement("div",td);div.style.overflow="hidden";div.buttonType="resize";div.className="zpWinResize";}}window.document.body.appendChild(this.winDiv);this.calculateSizes();var size=Zapatec.Utils.getWindowSize();var br={};if(Zapatec.is_ie){br.y=window.document.body.scrollTop;br.x=window.document.body.scrollLeft;}else{br.y=window.scrollY;br.x=window.scrollX;}if(x=='center'){if(screen.width){x=(size.width-this.config.width)/2+br.x;}}if(y=='center'){if(screen.height){y=(size.height-(this.config.height+this.config.heightDiff))/2+br.y;}}this.winDiv.style.left=(this.config.left=x)+"px";this.winDiv.style.top=(this.config.top=y)+"px";if(this.titleText)this.titleText.style.width=this.config.titleWidth+"px";if(this.contentArea)this.contentArea.style.width=this.config.contentWidth+"px";if(this.statusArea)this.statusArea.style.width=this.config.statusWidth+"px";this.WCH=Zapatec.Utils.createWCH();if(this.config.modal==true){this.modalLayer=Zapatec.Utils.createElement("DIV",document.body);this.modalLayer.onclick=function(){win.hide();};var st=this.modalLayer.style;st.display="none";st.position="absolute";st.top=br.y+"px";st.top="0px";st.left=br.x+"px";var dim=Zapatec.Utils.getWindowSize();st.width=dim.width+"px";st.height=dim.height+"px";st.zIndex=Zapatec.Window.maxNumber++;this.modalLayer.className="zpWinModal";}this.setNumber();this.winDiv.style.zIndex=Zapatec.Window.maxNumber;Zapatec.Window.winArray.push(this);this.setCurrent();};Zapatec.Window.winArray=[];Zapatec.Window.maxNumber=0;Zapatec.Window.currentWindow=null;Zapatec.Window.minimizeLeft=0;Zapatec.Window.minWinWidth=120;Zapatec.Window.lastActive=null;Zapatec.Window.sortMin=function(raised){var place=parseInt(raised.winDiv.style.left,10),win;for(var i in Zapatec.Window.winArray){win=Zapatec.Window.winArray[i];if(win&&win.config.state=="min"){var left=parseInt(win.winDiv.style.left,10);if(left>place){left-=Zapatec.Window.minWinWidth+5;win.winDiv.style.left=left+"px";if(win.WCH)win.WCH.style.left=win.winDiv.style.left;}}}Zapatec.Window.minimizeLeft-=Zapatec.Window.minWinWidth+5;};Zapatec.Window.prototype.setNumber=function(){this.winNumber= ++Zapatec.Window.maxNumber;};Zapatec.Window.prototype.setCurrent=function(deb){var win=this;if(Zapatec.Window.currentWindow&&win!=Zapatec.Window.currentWindow){if(Zapatec.Window.currentWindow.winDiv){Zapatec.Utils.removeClass(Zapatec.Window.currentWindow.winDiv,'zpWinFront');Zapatec.Utils.addClass(Zapatec.Window.currentWindow.winDiv,'zpWinBack');}if(Zapatec.Window.currentWindow.winDiv&&Zapatec.Window.currentWindow.config.state!="min"){Zapatec.Window.lastActive=Zapatec.Window.currentWindow;}else{var zIndex=0;Zapatec.Window.lastActive=null;for(i in Zapatec.Window.winArray){if(Zapatec.Window.winArray[i]&&(parseInt(Zapatec.Window.winArray[i].winDiv.style.zIndex,10)>zIndex)&&(Zapatec.Window.winArray[i].config.state!="min")&&(Zapatec.Window.winArray[i]!=win)){zIndex=parseInt(Zapatec.Window.winArray[i].winDiv.style.zIndex,10);Zapatec.Window.lastActive=Zapatec.Window.winArray[i];}}}}Zapatec.Window.currentWindow=win;Zapatec.Utils.removeClass(win.winDiv,'zpWinBack');Zapatec.Utils.addClass(win.winDiv,'zpWinFront');};Zapatec.Window.prototype.setContent=function(text){$('dialog_content').innerHTML=text;};Zapatec.Window.prototype.setDivContent=function(div){if(typeof div=="string"){div=document.getElementById(div);}if(typeof div=="object"){this.contentArea.appendChild(div);}};Zapatec.Window.prototype.setContentUrl=function(url){var self=this;Zapatec.Transport.fetch({url:url,onLoad:function(result){var text=result.responseText,script,scripts=[],attrs;while(script=text.match(/<script([^>]*)>([^<]*)<\/script>/)){text=text.replace(/<script[^>]*>[^<]*<\/script>/,"");scripts.push(script);}self.setContent(text);for(i in scripts){setTimeout(scripts[i][2],0);}self.onContentLoad();},onError:function(){alert('Error while fetching data from the server');}});};Zapatec.Window.prototype.setTitle=function(text){$('dialog_title').innerHTML=text;};Zapatec.Window.prototype.updateWCH=function(){if(this.WCH&&this.WCH.style.bottom!=""){this.WCH.style.bottom="";}Zapatec.Utils.setupWCH(this.WCH,this.config.left,this.config.top,this.config.width,this.config.height+this.config.heightDiff-2);};Zapatec.Window.prototype.doCenter=function(){var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}popwid=this.winDiv.offsetWidth;theleft=myWidth/2-popwid/2+scrOfX;if(theleft<0)theleft=0;this.winDiv.style.left=(this.config.left=theleft)+"px";pophei=this.winDiv.offsetHeight;thetop=myHeight/2-pophei/2+scrOfY;if(thetop<0)thetop=0;this.winDiv.style.top=(this.config.top=thetop)+"px";};Zapatec.Window.prototype.setLeft=function(left){this.winDiv.style.left=(this.config.left=left)+"px";this.updateWCH();};Zapatec.Window.prototype.setTop=function(top){this.winDiv.style.top=(this.config.top=top)+"px";this.updateWCH();};Zapatec.Window.prototype.setWidth=function(width){$('dialog_holder').style.width=width+"px";var diff=this.config.width-width;if(Zapatec.is_gecko){}this.winDiv.style.width=(this.config.width=width)+"px";this.updateWCH();};Zapatec.Window.prototype.setHeight=function(height){this.contentArea.style.height=(this.config.height=height)+"px";this.updateWCH();};Zapatec.Window.prototype.setPos=function(left,top){this.setLeft(left);this.setTop(top);};Zapatec.Window.prototype.setSize=function(width,height){this.setWidth(width);this.setHeight(height);};Zapatec.Window.prototype.setPosAndSize=function(left,top,width,height){this.setPos(left,top);this.setSize(width,height);};Zapatec.Window.prototype.raise=function(){Zapatec.Window.maxNumber++;this.winDiv.style.zIndex=Zapatec.Window.maxNumber;this.setCurrent(this);};Zapatec.Window.prototype.showStatus=function(message,mode){if(this.config.showStatus){switch(mode){case "temp":{this.config.statusText=this.statusArea.innerHTML;break;}case "restore":{message=this.config.statusText;break;}}this.statusArea.innerHTML=message;}};function pleaseResizeModal(){var st=win.modalLayer.style;var dim=Zapatec.Utils.getWindowSize();st.width=dim.width+"px";st.height=dim.height+"px";};Zapatec.Window.prototype.show=function(){if(this.config.visible==false){if(this.config.modal==true&&this.modalLayer){this.modalresizingintervalid=setInterval('pleaseResizeModal()',200);new Effect.Parallel([new Effect.Appear(this.modalLayer,{sync:true,from:0.0,to:0.6,duration:0.4}),new Effect.Appear(this.winDiv,{sync:true,from:0.0,to:1.0,duration:0.4})],{afterUpdate:function(effect){if(effect.currentFrame==0){win.doCenter();}}});}else{new Effect.Appear(this.winDiv,{from:0.0,to:1.0,duration:0.4});}}this.updateWCH();this.config.visible=true;};Zapatec.Window.prototype.hide=function(){if(this.config.modal==true&&this.modalLayer){if(this.modalresizingintervalid)clearInterval(this.modalresizingintervalid);new Effect.Parallel([new Effect.Fade(this.modalLayer,{sync:true,duration:0.4}),new Effect.Fade(this.winDiv,{sync:true,duration:0.4})],{afterFinish:function(){win.setContent('');}});}else{new Effect.Fade(this.winDiv,{sync:true,duration:0.4})}Zapatec.Utils.hideWCH(this.WCH);this.config.visible=false;tip_hide(true);};Zapatec.Window.prototype.close=function(){alert("ruben says: please don't use win.close()");Zapatec.Utils.destroy(this.winDiv);Zapatec.Utils.destroy(this.WCH);if(this.config.modal==true&&this.modalLayer){Zapatec.Utils.destroy(this.modalLayer);}delete this.winDiv;for(i in Zapatec.Window.winArray){if(Zapatec.Window.winArray[i]==this){Zapatec.Window.winArray[i]=null;}}if(Zapatec.Window.lastActive){Zapatec.Window.lastActive.setCurrent();}};Zapatec.Window.prototype.destroy=function(){this.close();};Zapatec.Window.prototype.showAtElement=function(el,opts){var self=this;var p=Zapatec.Utils.getAbsolutePos(el);if(!opts||typeof opts!="string"){this.showAt(p.x,p.y+el.offsetHeight);return true;}this.winDiv.style.display="block";var w=self.winDiv.offsetWidth;var h=self.winDiv.offsetHeight;self.winDiv.style.display="none";var valign=opts.substr(0,1);var halign="l";if(opts.length>1){halign=opts.substr(1,1);}switch(valign){case "T":p.y-=h;break;case "B":p.y+=el.offsetHeight;break;case "C":p.y+=(el.offsetHeight-h)/2;break;case "t":p.y+=el.offsetHeight-h;break;case "b":break;}switch(halign){case "L":p.x-=w;break;case "R":p.x+=el.offsetWidth;break;case "C":p.x+=(el.offsetWidth-w)/2;break;case "l":p.x+=el.offsetWidth-w;break;case "r":break;}p.width=w;p.height=h;Zapatec.Utils.fixBoxPosition(p);self.showAt(p.x,p.y);};Zapatec.Window.prototype.showAt=function(x,y){this.setPos(x,y);this.show();} 