/*
	Lightbox JS: Fullsize Image Overlays
	by Lokesh Dhakar - http://www.huddletogether.com

	For more information on this script, visit:
	http://huddletogether.com/projects/lightbox/

	Script featured on Dynamic Drive code library Jan 24th, 06':
	http://www.dynamicdrive.com

	Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
	(basically, do anything you want, just leave my name and link)

	Table of Contents
	-----------------
	Configuration

	Functions
	- getPageScroll()
	- getPageSize()
	- pause()
	- getKey()
	- listenKey()
	- showLightbox()
	- hideLightbox()
	- initLightbox()
	- addLoadEvent()

	Function Calls
	- addLoadEvent(initLightbox)

*/



//
// Configuration
//
var loadingImage="/q_images/sys/loading.gif",closeButton="/q_images/sys/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;return arrayPageScroll=["",a]}
function getPageSize(){var a,b;window.innerHeight&&window.scrollMaxY?(a=document.body.scrollWidth,b=window.innerHeight+window.scrollMaxY):document.body.scrollHeight>document.body.offsetHeight?(a=document.body.scrollWidth,b=document.body.scrollHeight):(a=document.body.offsetWidth,b=document.body.offsetHeight);var d,c;if(self.innerHeight)d=self.innerWidth,c=self.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)d=document.documentElement.clientWidth,c=document.documentElement.clientHeight;
else if(document.body)d=document.body.clientWidth,c=document.body.clientHeight;pageHeight=b<c?c:b;pageWidth=a<d?d:a;return arrayPageSize=[pageWidth,pageHeight,d,c]}function pause(a){for(var b=new Date,a=b.getTime()+a;;)if(b=new Date,b.getTime()>a)break}function getKey(a){keycode=a==null?event.keyCode:a.which;key=String.fromCharCode(keycode).toLowerCase();key=="x"&&hideLightbox()}function listenKey(){document.onkeypress=getKey}
function showLightbox(a){var b=document.getElementById("overlay"),d=document.getElementById("lightbox"),c=document.getElementById("lightboxCaption"),g=document.getElementById("lightboxImage"),e=document.getElementById("loadingImage"),h=document.getElementById("lightboxDetails");g.style.display="block";h.style.display="block";var f=getPageSize(),i=getPageScroll();if(e)e.style.top=i[1]+(f[3]-35-e.height)/2+"px",e.style.left=(f[0]-20-e.width)/2+"px",e.style.display="block";b.style.height=f[1]+"px";b.style.display=
"block";imgPreload=new Image;imgPreload.onload=function(){g.src=a.href;var j=i[1]+(f[3]-35-imgPreload.height)/2,k=(f[0]-20-imgPreload.width)/2;d.style.top=j<0?"0px":j+"px";d.style.left=k<0?"0px":k+"px";h.style.width=imgPreload.width+"px";a.getAttribute("title")?(c.style.display="block",c.innerHTML=a.getAttribute("title")):c.style.display="none";navigator.appVersion.indexOf("MSIE")!=-1&&pause(250);if(e)e.style.display="none";d.style.display="block";f=getPageSize();b.style.height=f[1]+"px";listenKey();
return!1};imgPreload.src=a.href}function hideLightbox(){objOverlay=document.getElementById("overlay");objLightbox=document.getElementById("lightbox");objOverlay.style.display="none";objLightbox.style.display="none";if(document.getElementById("lightboxDiv"))document.getElementById("lightboxDiv").style.display="none";document.onkeypress=""}
function initLightbox(){if(document.getElementsByTagName){for(var a=document.getElementsByTagName("a"),b=0;b<a.length;b++){var d=a[b];if(d.getAttribute("href")&&d.getAttribute("rel")=="lightbox")d.onclick=function(){showLightbox(this);return!1}}var b=document.getElementsByTagName("body").item(0),c=document.createElement("div");c.setAttribute("id","overlay");c.onclick=function(){hideLightbox();return!1};c.style.display="none";c.style.position="absolute";c.style.top="0";c.style.left="0";c.style.zIndex=
"90";c.style.width="100%";b.insertBefore(c,b.firstChild);getPageSize();getPageScroll();var g=new Image;g.onload=function(){var a=document.createElement("a");a.setAttribute("href","#");a.onclick=function(){hideLightbox();return!1};c.appendChild(a);var b=document.createElement("img");b.src=loadingImage;b.setAttribute("id","loadingImage");b.style.position="absolute";b.style.zIndex="150";a.appendChild(b);g.onload=function(){};return!1};g.src=loadingImage;a=document.createElement("div");a.setAttribute("id",
"lightbox");a.style.display="none";a.style.position="absolute";a.style.zIndex="100";b.insertBefore(a,c.nextSibling);var e=document.createElement("a");e.setAttribute("href","#");e.setAttribute("title","Click to close");e.onclick=function(){hideLightbox();return!1};a.appendChild(e);b=new Image;b.onload=function(){var a=document.createElement("img");a.src=closeButton;a.setAttribute("id","closeButton");a.style.position="absolute";a.style.zIndex="200";e.appendChild(a);return!1};b.src=closeButton;b=document.createElement("img");
b.setAttribute("id","lightboxImage");e.appendChild(b);b=document.createElement("div");b.setAttribute("id","lightboxDetails");a.appendChild(b);d=document.createElement("div");d.setAttribute("id","lightboxDiv");a.appendChild(d);a=document.createElement("div");a.setAttribute("id","lightboxCaption");a.style.display="none";b.appendChild(a);a=document.createElement("div");a.setAttribute("id","keyboardMsg");a.innerHTML='press <span style="padding-left: 3px; padding-right: 3px; padding-bottom: 3px; padding-top: 1px; font-size: 11px; border: 1px solid #ccc; background-color: #e5e5e5;">x</span> to close';
b.appendChild(a)}}function addLoadEvent(a){var b=window.onload;window.onload=typeof window.onload!="function"?a:function(){b();a()}}addLoadEvent(initLightbox);

