// Popup code var gPopupMask = null; var gPopupContainer = null; var gPopFrame = null; var gReturnFunc; var gPopupIsShown = false; var gHideSelects = false; var gTabIndexes = new Array(); // Pre-defined list of tags we want to disable/enable tabbing into var gTabbableTags = new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME"); // If using Mozilla or Firefox, use Tab-key trap. if (!document.all) { document.onkeypress = keyDownHandler; } function initPopUp() { // Add the HTML to the body body = document.getElementsByTagName('body')[0]; popmask = document.createElement('div'); popmask.id = 'popupMask'; popcont = document.createElement('div'); popcont.id = 'popupContainer'; popcont.innerHTML = '' + '' + '' + '' + '
sdl.deluca.bizPopup Window
Loading, please wait...
'; body.appendChild(popmask); body.appendChild(popcont); gPopupMask = document.getElementById("popupMask"); gPopupContainer = document.getElementById("popupContainer"); gPopFrame = document.getElementById("popupFrame"); // Add onclick handlers to 'a' elements of class submodal or submodal-width-height var elms = document.getElementsByTagName('a'); for (i = 0; i < elms.length; i++) { if (elms[i].className.indexOf("submodal") == 0) { elms[i].onclick = function(){ // default width and height var width = 400; var height = 200; // Parse out optional width and height from className params = this.className.split('-'); if (params.length == 3) { width = parseInt(params[1]); height = parseInt(params[2]); } showPopWin(this.href,width,height,null); return false; } } } } addEvent(window, "load", initPopUp); function showPopWin(url, width, height, returnFunc) { gPopupIsShown = true; disableTabIndexes(); gPopupMask.style.display = "block"; gPopupContainer.style.display = "block"; // calculate where to place the window on screen centerPopWin(width, height); var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10); gPopupContainer.style.width = width + "px"; gPopupContainer.style.height = (height+titleBarHeight) + "px"; gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px"; gPopFrame.style.height = (height) + "px"; // set the url //gPopFrame.src = url; gPopFrame.innerHTML = url; gReturnFunc = returnFunc; // for IE //if (gHideSelects == true) { hideSelectBoxes(); //} window.setTimeout("setPopTitle();", 600); } // function getScrollXY() { var scrOfX = 0, scrOfY = 0; if( typeof( window.pageYOffset ) == 'number' ) { //Netscape compliant scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { //DOM compliant scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { //IE6 standards compliant mode scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } return [ scrOfX, scrOfY ]; } // var gi = 0; function centerPopWin(width, height) { if (gPopupIsShown == true) { if (width == null || isNaN(width)) { width = gPopupContainer.offsetWidth; } if (height == null) { height = gPopupContainer.offsetHeight; } var fullHeight = getViewportHeight(); var fullWidth = getViewportWidth(); var theBody = document.documentElement; var xy = getScrollXY(); var scTop = xy[1];//parseInt(theBody.scrollTop,10); var scLeft = xy[0];//parseInt(theBody.scrollLeft,10); gPopupMask.style.height = fullHeight + "px"; gPopupMask.style.width = fullWidth + "px"; gPopupMask.style.top = scTop + "px"; gPopupMask.style.left = scLeft + "px"; window.status = gPopupMask.style.top + " " + gPopupMask.style.left + " " + gi++; var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10); gPopupContainer.style.top = (scTop + ((fullHeight - (height+titleBarHeight)) / 2)) + "px"; gPopupContainer.style.left = (scLeft + ((fullWidth - width) / 2)) + "px"; //alert(fullWidth + " " + width + " " + gPopupContainer.style.left); } } addEvent(window, "resize", centerPopWin); //addEvent(window, "scroll", centerPopWin); window.onscroll = centerPopWin; function hidePopWin(callReturnFunc) { gPopupIsShown = false; restoreTabIndexes(); if (gPopupMask == null) { return; } gPopupMask.style.display = "none"; gPopupContainer.style.display = "none"; if (callReturnFunc == true && gReturnFunc != null) { gReturnFunc(window.frames["popupFrame"].returnVal); } gPopFrame.src = 'loading.php'; // display all select boxes //if (gHideSelects == true) { displaySelectBoxes(); //} } function setPopTitle() { if (window.frames["popupFrame"].document.title == null) { window.setTimeout("setPopTitle();", 10); } else { document.getElementById("popupTitle").innerHTML = window.frames["popupFrame"].document.title; } } function keyDownHandler(e) { if (gPopupIsShown && e.keyCode == 9) return false; } function disableTabIndexes() { if (document.all) { var i = 0; for (var j = 0; j < gTabbableTags.length; j++) { var tagElements = document.getElementsByTagName(gTabbableTags[j]); for (var k = 0 ; k < tagElements.length; k++) { gTabIndexes[i] = tagElements[k].tabIndex; tagElements[k].tabIndex="-1"; i++; } } } } function restoreTabIndexes() { if (document.all) { var i = 0; for (var j = 0; j < gTabbableTags.length; j++) { var tagElements = document.getElementsByTagName(gTabbableTags[j]); for (var k = 0 ; k < tagElements.length; k++) { tagElements[k].tabIndex = gTabIndexes[i]; tagElements[k].tabEnabled = true; i++; } } } } function hideSelectBoxes() { var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) { gHideSelects = true; } if (gHideSelects) { var objects = document.getElementsByTagName("select"); for (i=0; i -1) { gHideSelects = true; } if (gHideSelects) { var objects = document.getElementsByTagName("select"); for (i=0; i