var closeButton = 'http://www.nomadoutlet.com/img/close.gif'; var intY = 400; var intX = 400; // // getPageScroll() // Returns array with x,y page scroll values. // Core code from - quirksmode.org // function getPageScroll(){ var yScroll; if (self.pageYOffset) { yScroll = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict yScroll = document.documentElement.scrollTop; } else if (document.body) {// all other Explorers yScroll = document.body.scrollTop; } arrayPageScroll = new Array('',yScroll) return arrayPageScroll; } // // getPageSize() // Returns array with page width, height and window width, height // Core code from - quirksmode.org // Edit for Firefox by pHaez // function getPageSize(){ 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){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = windowWidth; } else { pageWidth = xScroll; } arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) return arrayPageSize; } // // pause(numberMillis) // Pauses code execution for specified time. Uses busy code, not good. // Code from http://www.faqts.com/knowledge_base/view.phtml/aid/1602 // function pause(numberMillis) { var now = new Date(); var exitTime = now.getTime() + numberMillis; while (true) { now = new Date(); if (now.getTime() > exitTime) return; } } function showOnstuimigePopup(objLink) { // prep objects var objOverlay = document.getElementById('overlay'); var arrayPageSize = getPageSize(); var arrayPageScroll = getPageScroll(); // center loadingImage if it exists //if (objLoadingImage) { // objLoadingImage.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - objLoadingImage.height) / 2) + 'px'); // objLoadingImage.style.left = (((arrayPageSize[0] - 20 - objLoadingImage.width) / 2) + 'px'); // objLoadingImage.style.display = 'block'; //} // set height of Overlay to take up whole page and show objOverlay.style.height = (arrayPageSize[1] + 'px'); objOverlay.style.display = 'block'; var objOnstuimigePopup = null; if(objLink.getAttribute("rel") == "onstuimigeImagePopup"){ objOnstuimigePopup = document.getElementById('onstuimigeImagePopup'); var objImage = document.getElementById('onstuimigePopupImage'); // preload image imgPreload = new Image(); imgPreload.onload=function(){ objImage.src = objLink.href; // center and make sure that the top and left values are not negative // and the image placed outside the viewport var intTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - imgPreload.height) / 2); var intLeft = ((arrayPageSize[0] - 20 - imgPreload.width) / 2); objOnstuimigePopup.style.top = (intTop < 0) ? "0px" : intTop + "px"; objOnstuimigePopup.style.left = (intLeft < 0) ? "0px" : intLeft + "px"; //ie bug. if (navigator.appVersion.indexOf("MSIE")!=-1){ pause(250); } // Hide select boxes as they will 'peek' through the image in IE selects = document.getElementsByTagName("select"); for (i = 0; i != selects.length; i++) { selects[i].style.visibility = "hidden"; } objOnstuimigePopup.style.display = 'block'; // After image is loaded, update the overlay height as the new image might have // increased the overall page height. arrayPageSize = getPageSize(); objOverlay.style.height = (arrayPageSize[1] + 'px'); // Check for 'x' keypress //listenKey(); return false; } imgPreload.src = objLink.href; } if(objLink.getAttribute("rel") == "onstuimigeTextPopup"){ objOnstuimigePopup = document.getElementById('onstuimigeTextPopup'); var objText = document.getElementById('onstuimigePopupText'); var objBron = document.getElementById(objLink.getAttribute("id") + 'Text'); objText.innerHTML = objBron.value; // center and make sure that the top and left values are not negative // and the image placed outside the viewport var intTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - intY) / 2); var intLeft = ((arrayPageSize[0] - 20 - intX) / 2); objOnstuimigePopup.style.top = (intTop < 0) ? "0px" : intTop + "px"; objOnstuimigePopup.style.left = (intLeft < 0) ? "0px" : intLeft + "px"; //ie bug. if (navigator.appVersion.indexOf("MSIE")!=-1){ pause(250); } // Hide select boxes as they will 'peek' through the image in IE selects = document.getElementsByTagName("select"); for (i = 0; i != selects.length; i++) { selects[i].style.visibility = "hidden"; } element = document.getElementById("home_productscroller"); if(element){ element.style.visibility = "hidden"; } element = document.getElementById("header_home"); if(element){ element.style.visibility = "hidden"; } element = document.getElementById("flashbox"); if(element){ element.style.visibility = "hidden"; } objOnstuimigePopup.style.display = 'block'; // After image is loaded, update the overlay height as the new image might have // increased the overall page height. arrayPageSize = getPageSize(); objOverlay.style.height = (arrayPageSize[1] + 'px'); document.getElementById('onstuimigeTextPopup').focus(); return false; } return false; } function hideOnstuimigePopup() { // get objects objOverlay = document.getElementById('overlay'); objOnstuimigeImagePopup = document.getElementById('onstuimigeImagePopup'); objOnstuimigeTextPopup = document.getElementById('onstuimigeTextPopup'); // hide lightbox and overlay objOverlay.style.display = 'none'; objOnstuimigeImagePopup.style.display = 'none'; objOnstuimigeTextPopup.style.display = 'none'; // make select boxes visible selects = document.getElementsByTagName("select"); for (i = 0; i != selects.length; i++) { selects[i].style.visibility = "visible"; } element = document.getElementById("home_productscroller"); if(element){ element.style.visibility = "visible"; } element = document.getElementById("header_home"); if(element){ element.style.visibility = "visible"; } element = document.getElementById("flashbox"); if(element){ element.style.visibility = "visible"; } // disable keypress listener document.onkeypress = ''; } // // initLightbox() // Function runs on window load, going through link tags looking for rel="lightbox". // These links receive onclick events that enable the lightbox display for their targets. // The function also inserts html markup at the top of the page which will be used as a // container for the overlay pattern and the inline image. // function initOnstuimigePopup() { if (!document.getElementsByTagName){ return; } var anchors = document.getElementsByTagName("a"); // loop through all anchor tags for (var i=0; i // // // // //
//
//
//
// var objBody = document.getElementsByTagName("body").item(0); // create overlay div and hardcode some functional styles (aesthetic styles are in CSS file) var objOverlay = document.createElement("div"); objOverlay.setAttribute('id','overlay'); objOverlay.onclick = function() {hideOnstuimigePopup(); return false;} objOverlay.style.display = 'none'; objOverlay.style.position = 'absolute'; objOverlay.style.top = '0'; objOverlay.style.left = '0'; objOverlay.style.zIndex = '900'; objOverlay.style.width = '100%'; objBody.appendChild(objOverlay); var arrayPageSize = getPageSize(); var arrayPageScroll = getPageScroll(); //contentholder ImagePopup var objOnstuimigeImagePopup = document.createElement("div"); objOnstuimigeImagePopup.setAttribute('id','onstuimigeImagePopup'); objOnstuimigeImagePopup.style.display = 'none'; objOnstuimigeImagePopup.style.position = 'absolute'; objOnstuimigeImagePopup.style.zIndex = '910'; objOnstuimigeImagePopup.onclick = function() {hideOnstuimigePopup(); return false;} objBody.appendChild(objOnstuimigeImagePopup); // sluiten link var objLink2 = document.createElement("a"); objLink2.setAttribute('href','javascript:hideOnstuimigePopup()'); objLink2.onclick = function () {hideOnstuimigePopup();} objOnstuimigeImagePopup.appendChild(objLink2); //Afbeelding var objImage = document.createElement("img"); objImage.onclick = function () {hideOnstuimigePopup(); } objImage.setAttribute('id','onstuimigePopupImage'); objLink2.appendChild(objImage); // preload and create close button image var imgPreload2CloseButton = new Image(); // if close button image found, imgPreload2CloseButton.onload=function(){ var objCloseButton = document.createElement("img"); objCloseButton.src = closeButton; objCloseButton.setAttribute('id','closeButton'); objCloseButton.style.position = 'absolute'; objLink2.appendChild(objCloseButton); return false; } imgPreload2CloseButton.src = closeButton; //contentholder TextPopup var objOnstuimigeTextPopup = document.createElement("div"); objOnstuimigeTextPopup.setAttribute('id','onstuimigeTextPopup'); objOnstuimigeTextPopup.style.display = 'none'; objOnstuimigeTextPopup.style.position = 'absolute'; objOnstuimigeTextPopup.onclick = function() {hideOnstuimigePopup(); return false;} //objOverlay objOnstuimigeTextPopup.style.zIndex = '911'; objBody.appendChild(objOnstuimigeTextPopup); //text var objText = document.createElement("span"); objText.setAttribute('id','onstuimigePopupText'); //objText.style.zIndex = '90'; objText.style.zIndex = '920'; objOnstuimigeTextPopup.appendChild(objText); // sluiten link var objLink = document.createElement("a"); objLink.setAttribute('href','javascript:hideOnstuimigePopup()'); objLink.onclick = function () {hideOnstuimigePopup();} objOnstuimigeTextPopup.appendChild(objLink); // preload and create close button image var imgPreloadCloseButton = new Image(); // if close button image found, imgPreloadCloseButton.onload=function(){ var objCloseButton = document.createElement("img"); objCloseButton.src = closeButton; objCloseButton.setAttribute('id','closeButton'); objCloseButton.style.position = 'absolute'; objLink.appendChild(objCloseButton); return false; } imgPreloadCloseButton.src = closeButton; } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function'){ window.onload = func; } else { window.onload = function(){ oldonload(); func(); } } }