//window.onload = new_window; function new_window() { //Create this elements var myobjBody = document.getElementsByTagName("body").item(0); var ArrayPageSize = GetPageSize(); myobjBody.style.zIndex = "1"; var bodyHeight = 500; //OverLay var myOverlay = document.createElement("div"); myOverlay.setAttribute('id','myoverlay'); var arrayPageSize = getSize(); //get pagesize to set Overlay size myOverlay.style.width = "100%"; myOverlay.style.height = ArrayPageSize[1]+'px'; myOverlay.style.position = "absolute"; myOverlay.style.zIndex = "105"; myOverlay.style.top = "0"; myOverlay.style.left = "0"; myOverlay.style.backgroundColor = "#000"; myOverlay.style.opacity = 8/10; myOverlay.style.filter = 'alpha(opacity=' + 8*10 + ')'; myOverlay.style.display = "none"; myobjBody.appendChild(myOverlay); var myLightbox = document.createElement("div"); myLightbox.setAttribute('id','myLightbox'); myLightbox.style.width ="100%"; myLightbox.style.position = "absolute"; myLightbox.style.top = "0"; myLightbox.style.left = "0"; myLightbox.style.zIndex = "120"; myLightbox.style.display = "none"; myobjBody.appendChild(myLightbox); //Iframewrap var iframeWrap = document.createElement("div"); iframeWrap.setAttribute('id','iframewrap'); iframeWrap.style.height = "700px"; iframeWrap.style.width = "1000px"; iframeWrap.style.position = "relative"; iframeWrap.style.margin = "40px auto"; iframeWrap.style.padding = "10px"; iframeWrap.style.backgroundColor = "#fff"; myLightbox.appendChild(iframeWrap); //Close Button var closeBut = document.createElement("img"); closeBut.setAttribute('src','/images/close2.gif'); closeBut.setAttribute('style','float:right'); closeBut.style.cursor = "pointer"; closeBut.onclick = function() { document.getElementById('myoverlay').style.display = 'none'; document.getElementById('myLightbox').style.display = 'none'; document.getElementById('myFrame').setAttribute('src',''); } iframeWrap.appendChild(closeBut); //Iframe var myFrame = document.createElement("iframe"); myFrame.frameborder = "0"; myFrame.setAttribute('style','margin-top: 10px;border: 1px solid #FFFFFF'); myFrame.setAttribute('id','myFrame'); myFrame.setAttribute('width','100%'); myFrame.setAttribute('height','650'); myFrame.setAttribute('scrolling','auto'); myFrame.setAttribute('frameborder','0'); iframeWrap.appendChild(myFrame); elements = document.getElementsByTagName('a'); if(elements){ if(elements.length){ for( i = 0; i < elements.length; i++){ linkOj = elements[i]; set_new_window_function(linkOj); } }else{ linkOj = elements; set_new_window_function(linkOj); } } } function set_new_window_function(linkObj){ if(linkObj.className.indexOf('new_window')>=0){ linkOj.onclick = function() { anchor = this.href; if(anchor){ document.getElementById('myFrame').setAttribute('src', anchor); document.getElementById('myoverlay').style.display = "block"; document.getElementById('myLightbox').style.display = "block"; window.scroll(0,0); //DO not redirect my page. Will you? return false; } } } } function GetPageSize(){ var xScroll, yScroll; var windowWidth, windowHeight; 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; } 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; } dyWindowArrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) return dyWindowArrayPageSize; } function getSize() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } var out = Array(); out[0] = myWidth; out[1] = myHeight; return out; //window.alert( 'Width = ' + myWidth ); //window.alert( 'Height = ' + myHeight ); } function addEvent(elm, evType, fn, useCapture){ if (elm.addEventListener){ elm.addEventListener(evType, fn, useCapture); return true; }else if (elm.attachEvent){ var r = elm.attachEvent("on"+evType, fn); return r; } } addEvent (window,'load',new_window);