
var sbLoaderSide=100;var resizeImage=1;var imgDisplayDelay=600;var sbOverlayId="jwSBoverlay";var sbContainerId="jwSBcontainer";var sbContentId="jwSBcontent";var sbImageId="jwSBimage";var sbImageAlt="Preview...";var sbCaptionId="sbcaption";var sbButtonCloseId="jwSBclose";var sbCloseTitle="Click anywhere on the screen to close the image...";var isIE6=navigator.userAgent.toLowerCase().indexOf('msie 6')!=-1;function simpleBox(){if(!document.getElementsByTagName)return false;if(!document.getElementById)return false;var a=document.getElementsByTagName("a");for(var i=0;i<a.length;i++){if(/simplebox/.test(a[i].getAttribute("rel"))){a[i].onclick=function(){var imgSource=this.getAttribute("href");var imgTitle=this.getAttribute("title");buildImgPopup(imgSource,imgTitle);return false;}}}}
function buildImgPopup(sbImg,sbTitle){var sbImg;var sbTitle;var jwlbcontainer=document.createElement('div');jwlbcontainer.setAttribute("id",sbOverlayId);if(isIE6){document.getElementsByTagName('html')[0].style.overflow='hidden';var IEwidth=document.documentElement.clientWidth+'px';var IEheight=document.documentElement.clientHeight+'px';}
jwlbcontainer.innerHTML='<div id="'+sbContainerId+'" style="width:'+IEwidth+';height:'+IEheight+';"><a href="#" title="'+sbCloseTitle+'" class="closingElement">&nbsp;</a></div><div id="'+sbContentId+'"><a id="'+sbImageId+'" class="closingElement" href="#" title="'+sbCloseTitle+'"></a><span id="'+sbCaptionId+'">'+sbTitle+'</span><a id="'+sbButtonCloseId+'" class="closingElement" href="#" title="'+sbCloseTitle+'">&nbsp;</a></div>';document.getElementsByTagName("body")[0].appendChild(jwlbcontainer);var div=document.getElementById(sbContentId);div.style.width=sbLoaderSide+'px';div.style.height=sbLoaderSide+'px';div.style.margin='-'+(sbLoaderSide/2)+'px 0 0 -'+(sbLoaderSide/2)+'px';if(isIE6){jwlbcontainer.style.top=document.documentElement.scrollTop+'px';div.style.top=(document.documentElement.clientHeight/2)+'px';div.style.position='absolute';}
var imgContainer=document.getElementById(sbImageId);imgContainer.style.background="url("+sbImg+") no-repeat 50% 50%";imgContainer.style.display="none";var imgCaption=document.getElementById(sbCaptionId);imgCaption.style.display="none";var image=new Image();image.onload=function(){if(resizeImage){var resizeHeight=document.documentElement.clientHeight-40;if(image.height<resizeHeight){imgHeight=image.height;imgWidth=image.width;}else{imgHeight=resizeHeight;imgWidth=Math.round(resizeHeight*image.width/image.height);image.height=imgHeight;image.width=imgWidth;}}else{imgHeight=image.height;imgWidth=image.width;}
setTimeout(function(){div.style.background="#060606";},300);setTimeout(function(){div.style.width=imgWidth+'px';div.style.height=imgHeight+'px';div.style.margin='-'+((imgHeight+28)/2)+'px 0 0 -'+(imgWidth/2)+'px';},600);setTimeout(function(){imgContainer.style.display="block";imgCaption.style.display="";},900);}
image.src=sbImg;var closeLinks=jwlbcontainer.getElementsByTagName("a");for(var j=0;j<closeLinks.length;j++){if(closeLinks[j].className=="closingElement"){closeLinks[j].onclick=function(){jwlbcontainer.style.display='none';document.getElementsByTagName("body")[0].removeChild(jwlbcontainer);if(isIE6){document.getElementsByTagName('html')[0].style.overflow='';}
return false;}}}}
function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){if(oldonload){oldonload();}
func();}}}
addLoadEvent(simpleBox);
