var keyOfOpenImage; var listOfImages=Array(); var slideShowOn; var globTimeout; var slideShowDelay; var viewportheight; var viewportwidth; var newImg = new Image(); var LoadingImg = new Image(); var spiderShop; function SetOpacity(elem, opacityAsInt) { var opacityAsDecimal = opacityAsInt; if (opacityAsInt > 100) opacityAsInt = opacityAsDecimal = 100; else if (opacityAsInt < 0) opacityAsInt = opacityAsDecimal = 0; opacityAsDecimal /= 100; if (opacityAsInt < 1) opacityAsInt = 1; // IE7 bug, text smoothing cuts out if 0 elem.style.opacity = (opacityAsDecimal); elem.style.filter = "alpha(opacity=" + opacityAsInt + ")"; } function FadeOpacity(elemId, fromOpacity, toOpacity, time, fps) { var steps = Math.ceil(fps * (time / 1000)); var delta = (toOpacity - fromOpacity) / steps; FadeOpacityStep(elemId, 0, steps, fromOpacity, delta, (time / steps)); } function FadeOpacityStep(elemId, stepNum, steps, fromOpacity, delta, timePerStep) { SetOpacity(document.getElementById(elemId), Math.round(parseInt(fromOpacity) + (delta * stepNum))); if (stepNum < steps) setTimeout("FadeOpacityStep('" + elemId + "', " + (stepNum+1) + ", " + steps + ", " + fromOpacity + ", " + delta + ", " + timePerStep + ");", timePerStep); } function getWinHeight() { winH=0; if (navigator.appName=="Netscape") { winH = window.innerHeight; } if (navigator.appName.indexOf("Microsoft")!=-1) { winH = document.body.offsetHeight; } return winH; } function getImageKey(href) { var key=-1; for(i=0; i0) { document.getElementById("showPictureAnimated").style.height=""+document.getElementById("showPictureAnimated").clientHeight+"px"; LoadingImgMargin=(document.getElementById("showPictureAnimated").clientHeight-LoadingImg.height)/2; } else { document.getElementById("showPictureAnimated").style.height="400px"; LoadingImgMargin=(400-LoadingImg.height)/2; } document.getElementById("showPictureAnimated").innerHTML=''; if(document.getElementById("showPictureAnimatedBg").style.display=="none") FadeOpacity("showPictureAnimatedBg", 0, 70, 500, 10); document.getElementById("showPictureAnimatedTable").style.display="table"; if(darkBG) document.getElementById("showPictureAnimatedBg").style.display="block"; SetOpacity(document.getElementById("showPictureAnimated"), 100); document.getElementById("showPictureAnimated").style.display="block"; newImg.src = href; } function showPictureAnimatedInner(href, newImgheight, newImgwidth) { document.getElementById("showPictureAnimated").style.display="none"; if(keyOfOpenImage<0) keyOfOpenImage = getImageKey(href); boxContainerWidth=0; if(newImgheight<=(viewportheight-100) && newImgwidth<=(viewportwidth-50)) { document.getElementById("showPictureAnimated").innerHTML=''; boxContainerWidth=newImgwidth; } else { if((newImgheight/viewportheight)>(newImgwidth/viewportwidth)) { document.getElementById("showPictureAnimated").innerHTML=''; boxContainerWidth=((newImgwidth*(viewportheight-100))/newImgheight); } else { document.getElementById("showPictureAnimated").innerHTML=''; boxContainerWidth=(viewportwidth-40); } } document.getElementById("boxContainer").style.width=(boxContainerWidth>300)?(""+boxContainerWidth+"px"):"300px"; document.getElementById("showPictureAnimated").style.height=""; FadeOpacity("showPictureAnimated", 0, 100, 500, 10); document.getElementById("showPictureAnimated").style.display="block"; if(slideShowOn) { clearTimeout(globTimeout); globTimeout=setTimeout('nextImage()',slideShowDelay); } } function nextImage() { if(keyOfOpenImage0) keyOfOpenImage=keyOfOpenImage-1; else keyOfOpenImage=listOfImages.length-1; showPictureAnimated(listOfImages[keyOfOpenImage]); } function toggleSlideShow() { clearTimeout(globTimeout); if(!(slideShowOn)) { document.getElementById("toggleSlideShowCheckbox").src=spiderBoxBase+"pause.png"; slideShowOn=1; nextImage(); } else { document.getElementById("toggleSlideShowCheckbox").src=spiderBoxBase+"play.png"; slideShowOn=0; } } window.onresize=getViewportSize; function getViewportSize() { if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewportwidth = document.documentElement.clientWidth, viewportheight = document.documentElement.clientHeight } else { viewportwidth = document.getElementsByTagName('body')[0].clientWidth, viewportheight = document.getElementsByTagName('body')[0].clientHeight } if(document.getElementById("tdviewportheight")!=undefined) document.getElementById("tdviewportheight").style.height=(viewportheight-35)+"px"; if(document.getElementById("showPictureAnimatedBg")!=undefined) document.getElementById("showPictureAnimatedBg").style.height=(viewportheight+300)+"px"; } function SpiderCatAddToOnload() { if(SpiderCatOFOnLoad){SpiderCatOFOnLoad();} getViewportSize(); slideShowDelay=3000; slideShowQ=0; allImagesQ=0; spiderShop=1; darkBG=1; keyOfOpenImage=-1; spiderBoxBase="http://ironcrown.com/wp-content/plugins/catalog/spiderBox/"; LoadingImg.src=spiderBoxBase+"loadingAnimation.gif"; var spiderBoxElement = document.createElement('span'); spiderBoxElement.innerHTML+=' '; document.body.appendChild(spiderBoxElement); for ( i = 0; i < document.getElementsByTagName( 'a' ).length; i++ ) if(document.getElementsByTagName( 'a' )[i].target=="spiderbox" || ((allImagesQ || spiderShop) && (document.getElementsByTagName( 'a' )[i].href.substr(document.getElementsByTagName( 'a' )[i].href.length-4)==".jpg" || document.getElementsByTagName( 'a' )[i].href.substr(document.getElementsByTagName( 'a' )[i].href.length-4)==".png" || document.getElementsByTagName( 'a' )[i].href.substr(document.getElementsByTagName( 'a' )[i].href.length-4)==".gif" || document.getElementsByTagName( 'a' )[i].href.substr(document.getElementsByTagName( 'a' )[i].href.length-4)==".bmp" || document.getElementsByTagName( 'a' )[i].href.substr(document.getElementsByTagName( 'a' )[i].href.length-4)==".JPG" || document.getElementsByTagName( 'a' )[i].href.substr(document.getElementsByTagName( 'a' )[i].href.length-4)==".PNG" || document.getElementsByTagName( 'a' )[i].href.substr(document.getElementsByTagName( 'a' )[i].href.length-4)==".GIF" || document.getElementsByTagName( 'a' )[i].href.substr(document.getElementsByTagName( 'a' )[i].href.length-4)==".BMP"))) { listOfImages[listOfImages.length]=document.getElementsByTagName( 'a' )[i].href; document.getElementsByTagName( 'a' )[i].href="javascript:showPictureAnimated('"+document.getElementsByTagName( 'a' )[i].href+"')"; document.getElementsByTagName( 'a' )[i].style.cursor="url('http://ironcrown.com/wp-content/plugins/catalog/spiderBox/cursor_magnifier_plus.cur'),pointer"; document.getElementsByTagName( 'a' )[i].target=""; } }