/** Copyright Mihai Bazon, 2003 * Sponsored by SamWare.net [ http://samware.net ] * * This code was developed by Mihai Bazon for SamWare * [ http://students.infoiasi.ro/~mishoo ] * * You may use it under the GNU LGPL. * ( http://www.gnu.org/licenses/lgpl.html ) * * You are not allowed to remove or alter this notice. **/ var is_ie=((navigator.userAgent.toLowerCase().indexOf("msie")!=-1)&&(navigator.userAgent.toLowerCase().indexOf("opera")==-1)); var is_compat=(document.compatMode=="BackCompat"); function PopupDiv(titleText,content_id,handler){ var self=this; this.handler=handler; var el=document.getElementById(content_id); var popup=document.createElement("div"); popup.className="popupdiv"; this.element=popup; popup.style.position="absolute"; popup.style.left="0px"; popup.style.top="0px"; var title=document.createElement("div"); title.className="title"; this.title=title; popup.appendChild(title); PopupDiv.addEvent(title,"mousedown",function(ev){self._dragStart(is_ie?window.event:ev);}); var button=document.createElement("div"); button.className="button"; title.appendChild(button); button.innerHTML="×"; title.appendChild(document.createTextNode(titleText)); this.titleText=titleText; button.onmouseover=function(){this.className+=" button-hilite";}; button.onmouseout=function(){this.className=this.className.replace(/\s*button-hilite\s*/g," ");}; button.onclick=function(){self.close();}; button.title="Close"; el.style.position="absolute"; var clone=el.cloneNode(true); clone.className+=" content"; clone.style.display="block"; popup.appendChild(clone); this.clone=clone; document.body.appendChild(popup); var cs=popup.currentStyle; var addX=(is_ie&&is_compat)?(parseInt(cs.borderLeftWidth)+parseInt(cs.borderRightWidth)+parseInt(cs.paddingLeft)+parseInt(cs.paddingRight)):0; var addY=(is_ie&&is_compat)?(parseInt(cs.borderTopWidth)+parseInt(cs.borderBottomWidth)+parseInt(cs.paddingTop)+parseInt(cs.paddingBottom)):0; popup.style.width=(clone.offsetWidth+addX)+"px"; popup.style.height=(clone.offsetHeight+title.offsetHeight)+"px"; popup.style.display="none"; this.dragging=false; this.onShow=null; this.onClose=null; this.modal=false; }; PopupDiv.currentPopup=null; PopupDiv.prototype.showAtElement=function(el,mode){var pos,ew,eh;var popup=this.element;popup.style.display="block";var w=popup.offsetWidth;var h=popup.offsetHeight;if(el!=window){pos=PopupDiv.getAbsolutePos(el);ew=el.offsetWidth;eh=el.offsetHeight;}else{pos={x:0,y:0};var size=PopupDiv.getWindowSize();ew=size.x;eh=size.y;}if(mode.indexOf("l")!=-1){pos.x-=w;}if(mode.indexOf("r")!=-1){pos.x+=ew;}if(mode.indexOf("t")!=-1){pos.y-=h;}if(mode.indexOf("b")!=-1){pos.y+=eh;}if(mode.indexOf("c")!=-1){if(is_ie){pos.y+=document.body.scrollTop;pos.x+=document.body.scrollLeft;}else{pos.y+=window.scrollY;pos.x+=window.scrollX;}pos.x+=Math.round((ew-w)/2);pos.y+=Math.round((eh-h)/2);}this.showAt(pos.x,pos.y);}; PopupDiv.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px";s.top=y+"px";s.display="block";this.hideShowCovered();PopupDiv.currentPopup=this;PopupDiv.addEvent(document.body,["mousedown","click"],PopupDiv.checkPopup);if(is_ie&&this.modal){document.body.setCapture(false);document.body.onlosecapture=function(){(PopupDiv.currentPopup)&&(document.body.setCapture(false));};}window.event&&PopupDiv.stopEvent(window.event);if(typeof this.onShow=="function"){this.onShow();}else if(typeof this.onShow=="string"){eval(this.onShow);}}; PopupDiv.prototype.close=function(){this.element.style.display="none";PopupDiv.currentPopup=null;this.hideShowCovered();PopupDiv.removeEvent(document.body,["mousedown","click"],PopupDiv.checkPopup);is_ie&&this.modal&&document.body.releaseCapture();if(typeof this.onClose=="function"){this.onClose();}else if(typeof this.onClose=="string"){eval(this.onClose);}}; PopupDiv.prototype.getForm=function(){var forms=this.clone.getElementsByTagName("form");return(forms.length>0)?forms[0]:null;}; PopupDiv.prototype.callHandler=function(){var tags=["input","textarea","select"];var params=new Object();for(var ti in tags){var tag=tags[ti];var els=this.clone.getElementsByTagName(tag);for(var j=0;j0;){var ar=document.getElementsByTagName(tags[--k]);var cc=null;for(var i=ar.length;i>0;){cc=ar[--i];if(isContained(cc)){cc.style.visibility="visible";continue;}p=PopupDiv.getAbsolutePos(cc);var CX1=p.x;var CX2=cc.offsetWidth+CX1;var CY1=p.y;var CY2=cc.offsetHeight+CY1;if((CX1>EX2)||(CX2EY2)||(CY2