var loadingImage="./img/lightbox/loading.gif";var closeButton="./img/lightbox/close.gif";function getPageScroll(){var a;if(self.pageYOffset){a=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){a=document.documentElement.scrollTop}else{if(document.body){a=document.body.scrollTop}}}arrayPageScroll=new Array("",a);return arrayPageScroll}function getPageSize(){var c,a;if(window.innerHeight&&window.scrollMaxY){c=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}var b,d;if(self.innerHeight){b=self.innerWidth;d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){pageHeight=d}else{pageHeight=a}if(c<b){pageWidth=b}else{pageWidth=c}arrayPageSize=new Array(pageWidth,pageHeight,b,d);return arrayPageSize}function pause(b){var a=new Date();var c=a.getTime()+b;while(true){a=new Date();if(a.getTime()>c){return}}}function getKey(a){if(a==null){keycode=event.keyCode}else{keycode=a.which}key=String.fromCharCode(keycode).toLowerCase();if(key=="x"){hideLightbox()}}function listenKey(){document.onkeypress=getKey}function showLightbox(c){var h=document.getElementById("overlay");var b=document.getElementById("lightbox");var e=document.getElementById("lightboxCaption");var j=document.getElementById("lightboxImage");var a=document.getElementById("loadingImage");var g=document.getElementById("lightboxDetails");var f=getPageSize();var d=getPageScroll();if(a){a.style.top=(d[1]+((f[3]-35-a.height)/2)+"px");a.style.left=(((f[0]-20-a.width)/2)+"px");a.style.display="block"}h.style.height=(f[1]+"px");h.style.display="block";imgPreload=new Image();imgPreload.onload=function(){j.src=c.href;var l=d[1]+((f[3]-35-imgPreload.height)/2);var k=((f[0]-20-imgPreload.width)/2);b.style.top=(l<0)?"0px":l+"px";b.style.left=(k<0)?"0px":k+"px";g.style.width=imgPreload.width+"px";if(c.getAttribute("title")){e.style.display="block";e.innerHTML=c.getAttribute("title")}else{e.style.display="none"}if(navigator.appVersion.indexOf("MSIE")!=-1){pause(250)}if(a){a.style.display="none"}selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="hidden"}b.style.display="block";f=getPageSize();h.style.height=(f[1]+"px");listenKey();return false};imgPreload.src=c.href}function hideLightbox(){objOverlay=document.getElementById("overlay");objLightbox=document.getElementById("lightbox");objOverlay.style.display="none";objLightbox.style.display="none";selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="visible"}document.onkeypress=""}function initLightbox(){if(!document.getElementsByTagName){return}var b=document.getElementsByTagName("a");for(var e=0;e<b.length;e++){var f=b[e];if(f.getAttribute("href")&&(f.getAttribute("rel")=="lightbox")){f.onclick=function(){showLightbox(this);return false}}}var p=document.getElementsByTagName("body").item(0);var o=document.createElement("div");o.setAttribute("id","overlay");o.onclick=function(){hideLightbox();return false};o.style.display="none";o.style.position="absolute";o.style.top="0";o.style.left="0";o.style.zIndex="90";o.style.width="100%";p.insertBefore(o,p.firstChild);var h=getPageSize();var j=getPageScroll();var k=new Image();k.onload=function(){var r=document.createElement("a");r.setAttribute("href","#");r.onclick=function(){hideLightbox();return false};o.appendChild(r);var q=document.createElement("img");q.src=loadingImage;q.setAttribute("id","loadingImage");q.style.position="absolute";q.style.zIndex="150";r.appendChild(q);k.onload=function(){};return false};k.src=loadingImage;var c=document.createElement("div");c.setAttribute("id","lightbox");c.style.display="none";c.style.position="absolute";c.style.zIndex="100";p.insertBefore(c,o.nextSibling);var d=document.createElement("a");d.setAttribute("href","#");d.setAttribute("title","Click to close");d.onclick=function(){hideLightbox();return false};c.appendChild(d);var l=new Image();l.onload=function(){var q=document.createElement("img");q.src=closeButton;q.setAttribute("id","closeButton");q.style.position="absolute";q.style.zIndex="200";d.appendChild(q);return false};l.src=closeButton;var n=document.createElement("img");n.setAttribute("id","lightboxImage");d.appendChild(n);var m=document.createElement("div");m.setAttribute("id","lightboxDetails");c.appendChild(m);var g=document.createElement("div");g.setAttribute("id","lightboxCaption");g.style.display="none";m.appendChild(g);var a=document.createElement("div");a.setAttribute("id","keyboardMsg");a.innerHTML='press <a href="#" onclick="hideLightbox(); return false;"><kbd>x</kbd></a> to close';m.appendChild(a)}function addLoadEvent(a){var b=window.onload;if(typeof window.onload!="function"){window.onload=a}else{window.onload=function(){b();a()}}}addLoadEvent(initLightbox);
