var myWins=new Array(); /********************************************* * Utility function *********************************************/ // Create new object PopUp function addPopUp(objName,url,specs,width,height,left,top,parentDependent) { eval(objName + " = new PopUp(objName,url,specs,width,height,left,top,parentDependent);"); } // Set offset of windows left edge from screen. function setLeft(left,width) { var ret; if (typeof(left)== "string") { switch(left) { case "left": ret = 0; break; case "center": ret = (screen.width - width)/2; break; case "right": ret = screen.width - width; break; default: ret = 0; } } else ret = left; return(ret) } // Set offset of windows top edge from screen. function setTop(top,height) { var ret; if (typeof(top)== "string") { switch(top) { case "top": ret = 0; break; case "center": ret = (screen.height - height)/2; break; case "bottom": ret = screen.height - height; break; default: ret = 0; } } else ret = top; return(ret); } /********************************************* * Object PopUp *********************************************/ function PopUp(objName,url,sp,w,h,l,t,parentDependent) { this.obj = objName+""; if (w) this.width = (w == "max") ? screen.width : w; else this.width = 500; if (h) this.height = (h == "max") ? screen.height : h; else this.height = 550; if (l) this.left = setLeft(l,this.width); else this.left = setLeft("center",this.width); if (t) this.top = setTop(t,this.height); else this.top = setTop("center",this.height); if (sp == "all") { this.specs = "toolbar=yes,"; this.specs += "location=yes,"; this.specs += "directories=yes,"; this.specs += "status=yes,"; this.specs += "menubar=yes,"; this.specs += "resizable=yes,"; this.specs += "scrollbars=yes,"; this.specs += "titlebar=yes,"; this.specs += "dependent=no,"; this.specs += "maximize=yes,"; } else if (!sp) { this.specs = "toolbar=no,"; this.specs += "location=no,"; this.specs += "directories=no,"; this.specs += "status=no,"; this.specs += "menubar=no,"; this.specs += "resizable=no,"; this.specs += "scrollbars=no,"; this.specs += "titlebar=no,"; this.specs += "dependent=no,"; this.specs += "maximize=no,"; } else { if (sp == "gloveDebug") { this.specs = "toolbar=yes,"; this.specs += "location=yes,"; this.specs += "directories=yes,"; this.specs += "status=yes,"; this.specs += "menubar=yes,"; this.specs += "resizable=yes,"; this.specs += "scrollbars=yes,"; this.specs += "titlebar=yes,"; this.specs += "dependent=no,"; this.specs += "maximize=no,"; } else { if (sp == "gloveNormal") { // Deny resize for NS 4.x because cause the frameset reload if (document.layers) this.specs = "resizable=no,"; else this.specs = "resizable=yes,"; this.specs += "scrollbars=yes,"; this.specs += "titlebar=yes,"; this.specs += "maximize=no,"; this.specs += "dependent=yes,"; } else { if (sp.indexOf("toolbar") != -1) this.specs = "toolbar=yes,"; else this.specs = "toolbar=no,"; if (sp.indexOf("location") != -1) this.specs += "location=yes,"; else this.specs += "location=no,"; if (sp.indexOf("directories") != -1) this.specs += "directories=yes,"; else this.specs += "directories=no,"; if (sp.indexOf("status") != -1) this.specs += "status=yes,"; else this.specs += "status=no,"; if (sp.indexOf("menubar") != -1) this.specs += "menubar=yes,"; else this.specs += "menubar=no,"; if ( (sp.indexOf("resizeable") != -1) || (sp.indexOf("resizable") != -1) ) this.specs += "resizable=yes,"; else this.specs += "resizable=no,"; if (sp.indexOf("scrollbars") != -1) this.specs += "scrollbars=yes,"; else this.specs += "scrollbars=no,"; if (sp.indexOf("titlebar") != -1) this.specs += "titlebar=yes,"; else this.specs += "titlebar=no,"; if (sp.indexOf("maximize") != -1) this.specs += "maximize=yes,"; else this.specs += "maximize=no,"; if (sp.indexOf("dependent") != -1) this.specs += "dependent=yes,"; else this.specs += "dependent=no,"; } } } this.specs += "width=" + this.width + ","; this.specs += "height=" + this.height + ","; this.specs += "left=" + this.left + ","; this.specs += "top=" + this.top; this.parDep = parentDependent; var logFromPackager = false; var checkWord = url; if (logFromPackager) { checkWord = "xp_"+url; } if (!myWins[checkWord] || myWins[checkWord].closed || (isOpera && (myWins[checkWord].closed+"" == "undefined"))) { // The window is not opened myWins[checkWord] = window.open(url,this.obj,this.specs); this.popup = myWins[checkWord]; } myWins[checkWord].focus(); if (this.parDep+"" == "true" || (this.parDep+"" == "undefined")) //if is "undefined" means nothing is specified by user, by defalut popup is parent dependent { var validOpener = window; var opener = window.top.opener; while (opener) { validOpener = opener; opener = opener.top.opener; } if (validOpener.top.childWindows) //windows opened form packager will not have childWindows array { validOpener.top.childWindows.push(this.popup); } //GLOVE popup management var validOpener = window; var opener = window.top.opener; while (opener && validOpener.name != "menu") { validOpener = opener; opener = opener.top.opener; } if (validOpener.top.openedPopups) { validOpener.top.openedPopups.push(this.popup); } } } // Close popup window function closePopUp() { this.popup.close(); } PopUp.prototype.close = closePopUp;