ITime = new Date(); function _id(e) { return document.getElementById('' + e + ''); } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function setPopupTimer(w, h, e, c, topPossition, leftPossition, s) { if (!(readCookie('ImperaPopupTime'))) { ISec = (ITime.getMinutes() * 60 + (((ITime.getHours() * 60) * 60) + (ITime.getSeconds() + s))); createCookie('ImperaPopupTime',ISec,1); } setLightbox(w, h, e, c, topPossition, leftPossition, 1); } function setLightbox(w, h, e, c, topPossition, leftPossition, s) { if (s) { if (readCookie('ImperaPopupTime')) { ISec = ITime.getMinutes() * 60; ISec = (ISec + ((ITime.getHours() * 60) * 60)); ISec = ISec + ITime.getSeconds(); ISec = (ISec + s); if (ISec >= readCookie('ImperaPopupTime')) { setLightbox(w, h, e, c, topPossition, leftPossition); } else { s = s + 1; setTimeout(function(){setLightbox(w, h, e, c, topPossition, leftPossition, s)},1000); } } else { setLightbox(w, h, e, c, topPossition, leftPossition, s); } } else { if(readCookie('ImperaPopup') && c) { } else { if (c) { createCookie('ImperaPopup','yes',c);} if(_id('Lightbox')) { _id('Lightbox').style.display = 'block'; } else { newE = document.createElement("div"); newE.id = 'Lightbox'; newE.style.position = 'absolute'; newE.style.top = '0px'; newE.style.left = '0px'; newE.style.height = '' + document.documentElement.scrollHeight + 'px'; newE.style.width = '100%'; newE.style.cursor = 'pointer'; newE.style.zIndex = '999'; newE.style.backgroundColor = '#000000'; newE.style.filter = 'alpha(opacity=50)'; newE.style.opacity = '.50'; document.body.insertBefore(newE, document.body.firstChild); } if(_id('LightboxContent')) { e1 = _id('LightboxContent'); e1.style.display = 'block'; e1.style.top = '' + (((document.documentElement.offsetHeight / 2) - parseInt(h / 2)) + document.documentElement.scrollTop) + 'px'; e1.style.left = '' + (((document.documentElement.offsetWidth / 2) - parseInt(w / 2)) - document.documentElement.scrollLeft) + 'px'; } else { A = document.createElement("div"); A.id = 'LightboxContent'; A.style.position = 'absolute'; A.style.top = '' + (((document.documentElement.offsetHeight / 2) - parseInt(h / 2)) + document.documentElement.scrollTop) + 'px'; A.style.left = '' + (((document.documentElement.offsetWidth / 2) - parseInt(w / 2)) - document.documentElement.scrollLeft) + 'px'; A.style.height = '' + h + 'px'; A.style.width = '' + w + 'px'; A.style.zIndex = '1001'; document.body.insertBefore(A, document.body.firstChild); } _id('LightboxContent').innerHTML = '
'; if(navigator.appName == "Microsoft Internet Explorer") { _id('Lightbox').attachEvent('onclick', closeLightbox); } else { _id('Lightbox').addEventListener('click', closeLightbox,false); } } } } function closeLightbox() { _id('Lightbox').style.display = 'none'; _id('LightboxContent').style.display = 'none'; _id('LightboxContent').innerHTML = ''; }