var imagesToShow=new Array();var numImagesToShow=0;function imageClick(e){var e=e||window.event;var target=e.target||e.srcElement;var imgSrc=target.parentNode.href;var largeImg=document.getElementById('large');if(largeImg)largeImg.src=imgSrc;show.pauseImage();if(window.event)e.returnValue=false;else e.preventDefault();return false};function slideshowInit(){var thumbs=document.getElementsByTagName('ul');var numRows=thumbs.length;for(var i=0;i<numRows;i++){if(thumbs[i].className=='thumbnails'){var thumbUL=thumbs[i];break}}if(thumbUL){var anchorList=thumbUL.getElementsByTagName('a');numImagesToShow=anchorList.length;for(var i=0;i<numImagesToShow;i++){imagesToShow[i]=anchorList[i].href;if(window.addEventListener)anchorList[i].addEventListener("click",imageClick,false);else if(window.attachEvent)anchorList[i].attachEvent("onclick",imageClick);else anchorList[i].onclick=imageClick}}show=new Slideshow(numImagesToShow,4)};function Slideshow(numOfImgs,rateOfPause){this.numImgs=numOfImgs;this.nextImg=2;this.imgStatic=rateOfPause*1000;this.imgList=new Array();for(i=1;i<=this.numImgs;i++){this.imgList[i]=new Image;this.imgList[i].ready=false;this.imgList[i].onload=imageLoaded;this.imgList[i].src=imagesToShow[i]}function imageLoaded(){this.ready=true};var loop=this;this.swapImage=function(){var thisImg=document.getElementById('large');var imgCount=0;while((!(loop.imgList[loop.nextImg].ready))&&(imgCount<loop.numImgs)){loop.nextImg++;if(loop.nextImg>loop.numImgs)loop.nextImg=1;imgCount++}thisImg.src=loop.imgList[loop.nextImg++].src;if(loop.nextImg>loop.numImgs)loop.nextImg=1;loop.timer=setTimeout(loop.swapImage,loop.imgStatic)};this.pauseImage=function(){if(loop.timer)clearTimeout(loop.timer);loop.timer=setTimeout(this.swapImage,this.imgStatic)};loop.timer=setTimeout(this.swapImage,this.imgStatic)};function runOnLoad(f){if(runOnLoad.loaded)f();else runOnLoad.funcs.push(f)};runOnLoad.funcs=[];runOnLoad.loaded=false;runOnLoad.run=function(){if(runOnLoad.loaded)return;for(var i=0;i<runOnLoad.funcs.length;i++){try{runOnLoad.funcs[i]()}catch(e){}}runOnLoad.loaded=true;delete runOnLoad.funcs;delete runOnLoad.run};if(window.addEventListener)window.addEventListener("load",runOnLoad.run,false);else if(window.attachEvent)window.attachEvent("onload",runOnLoad.run);else window.onload=runOnLoad.run;runOnLoad(slideshowInit);