/* disclaimer - Imagerotator by Sabri for Typolight Version 1.5 - This script is based on CSS Linked Photo Shuffler v1.1 by Carl Camera http://iamacamera.org - SetOpacity Function and inpiration from Photo Fade by Richard Rutter - http://clagnut.com - License: Creative Commons Attribution 2.5  License - http://creativecommons.org/licenses/by/2.5/ */
var gblDeckSize=gblImg.length;var gblOpacity=100;var gblOnDeck=0;var gblStartImg;var gblImageRotations=gblDeckSize*(gblRotations+1);
function fisherYates(myArray){var i=myArray.length;if(i==0)return false;while(--i){var j=Math.floor(Math.random()*(i+1));var tempi=myArray[i];var tempj=myArray[j];myArray[i]=tempj;myArray[j]=tempi;}}addWindowOnload=function(f){var current=window.onload;if(typeof window.onload!='function'){window.onload=f;}else{window.onload=function(){current();f()};}};startrotator=function photoShufflerLaunch(){var theimg=document.getElementById(gblPhotoShufflerImgId);gblStartImg=theimg.src;if(window.gblStartHref!=undefined){var theanchor=document.getElementById(gblPhotoShufflerAnchorId);gblStartHref=theimg.href;}document.getElementById(gblPhotoShufflerDivId).style.backgroundImage='url('+gblImg[gblOnDeck]+')';if(window.gblrandomactive!=undefined){fisherYates(asLucky);gblOnDeckRandom=asLucky[0];document.getElementById(gblPhotoShufflerDivId).style.backgroundImage='url('+gblImg[gblOnDeckRandom]+')';}setTimeout("photoShufflerFade()",gblPauseSeconds*1000);}
function photoShufflerFade(){var theimg=document.getElementById(gblPhotoShufflerImgId);var fadeDelta=100/(30*gblFadeSeconds);if(gblOpacity<2*fadeDelta){gblOpacity=100;if(gblImageRotations<1)return;photoShufflerShuffle();setTimeout("photoShufflerFade()",gblPauseSeconds*1000);}else{gblOpacity-=fadeDelta;setOpacity(theimg,gblOpacity);setTimeout("photoShufflerFade()",30);}}
function photoShufflerShuffle(){var thediv=document.getElementById(gblPhotoShufflerDivId);var theimg=document.getElementById(gblPhotoShufflerImgId);if(window.gblStartHref!=undefined){var theanchor=document.getElementById(gblPhotoShufflerAnchorId);}theimg.src=gblImg[gblOnDeck];if(window.gblrandomactive!=undefined){theimg.src=gblImg[gblOnDeckRandom];}if(window.gblStartHref!=undefined){theanchor.href=gblHref[gblOnDeck];window.status=gblHref[gblOnDeck];}setOpacity(theimg,100);gblOnDeck=++gblOnDeck%gblDeckSize;if(window.gblrandomactive!=undefined){fisherYates(asLucky);if(gblOnDeckRandom==asLucky[0]){gblOnDeckRandom=asLucky[1];}else{gblOnDeckRandom=asLucky[0];}}if(--gblImageRotations<1){gblImg[gblOnDeck]=gblStartImg;if(window.gblStartHref!=undefined){gblHref[gblOnDeck]=gblStartHref;}}thediv.style.backgroundImage='url('+gblImg[gblOnDeck]+')';if(window.gblrandomactive!=undefined){thediv.style.backgroundImage='url('+gblImg[gblOnDeckRandom]+')';}}
function setOpacity(obj,opacity){opacity=(opacity==100)?99.999:opacity;obj.style.filter="alpha(opacity:"+opacity+")";obj.style.KHTMLOpacity=opacity/100;obj.style.MozOpacity=opacity/100;obj.style.opacity=opacity/100;}addWindowOnload(startrotator);
// JavaScript Document