var transitions = []; transitions[0] = "progid:DXImageTransform.Microsoft.Fade(duration=1)"; transitions[1] = "progid:DXImageTransform.Microsoft.Blinds(Duration=1,bands=20)"; transitions[2] = "progid:DXImageTransform.Microsoft.Checkerboard(Duration=1,squaresX=20,squaresY=20)"; transitions[3] = "progid:DXImageTransform.Microsoft.Strips(Duration=1,motion=rightdown)"; transitions[4] = "progid:DXImageTransform.Microsoft.Barn(Duration=1,orientation=vertical)"; transitions[5] = "progid:DXImageTransform.Microsoft.GradientWipe(duration=1)"; transitions[6] = "progid:DXImageTransform.Microsoft.Iris(Duration=1,motion=out)"; transitions[7] = "progid:DXImageTransform.Microsoft.Wheel(Duration=1,spokes=12)"; transitions[8] = "progid:DXImageTransform.Microsoft.Pixelate(maxSquare=10,duration=1)"; transitions[9] = "progid:DXImageTransform.Microsoft.RadialWipe(Duration=1,wipeStyle=clock)"; transitions[10] = "progid:DXImageTransform.Microsoft.RandomBars(Duration=1,orientation=vertical)"; transitions[11] = "progid:DXImageTransform.Microsoft.Slide(Duration=1,slideStyle=push)"; transitions[12] = "progid:DXImageTransform.Microsoft.RandomDissolve(Duration=1,orientation=vertical)"; transitions[13] = "progid:DXImageTransform.Microsoft.Spiral(Duration=1,gridSizeX=40,gridSizeY=40)"; transitions[14] = "progid:DXImageTransform.Microsoft.Stretch(Duration=1,stretchStyle=push)"; transitions[15] = "special case"; transitions[16] = "none"; var transitionIndex = 15; var browserCanBlend = true; var direction = 1; var timeout = 3000; var timeoutCount= 3; var timeoutWait = 1000; var timerMain, timmerThumb; var currentIndex = 0; var nextIndex = 1; var arrImage = []; var arrThumb = []; var thumbIndex = 0; var run = true; function PageLoad() { LoadThumb(); PrepareNext(); } function LoadThumb() { var img = null; if(arrThumb[thumbIndex]) { img = arrThumb[thumbIndex]; } if(img==null) { img = new Image(); img.src = document.getElementById("photoThumbUrl" + thumbIndex).value; arrThumb[thumbIndex] = img; timmerThumb = setTimeout("WaitForThumb();", 1000); } } function ShowPhoto(photoIndex) { if(timerMain) clearTimeout(timerMain); var img = null; if(arrImage[photoIndex]) { img = arrImage[photoIndex]; } if(img) { if(img.complete) { var imgMain = document.getElementById("imgMain"); if(imgMain) { imgMain.src = img.src; imgMain.parentNode.href = document.getElementById("photoFullUrl" + photoIndex).value; document.getElementById("divFileName").innerHTML = document.getElementById("photoFileName" + photoIndex).value; document.getElementById("divFileDescr").innerHTML = document.getElementById("photoDescription" + photoIndex).value; currentIndex = photoIndex; } if(run) PrepareNext(); } else { timerMain = setTimeout("WaitForLoadPhoto(" + photoIndex + ");", timeout); } } else { img = new Image(); img.src = document.getElementById("photoPreviewUrl" + photoIndex).value; arrImage[photoIndex] = img; timerMain = setTimeout("WaitForLoadPhoto(" + photoIndex + ");", timeout); } } function WaitForLoadPhoto(photoIndex) { var img = arrImage[photoIndex]; if(img) { if(!img.complete) { clearTimeout(timmerMain); timerMain = setTimeout("WaitForLoadPhoto(" + photoIndex + ");", timeout); } else { ShowPhoto(photoIndex); } } } function WaitForThumb() { var img = arrThumb[thumbIndex]; if(img) { if(!img.complete) { clearTimeout(timmerThumb); timmerThumb = setTimeout("WaitForThumb();", 100); } else { clearTimeout(timmerThumb); document.getElementById("imgThumb" + thumbIndex).src = img.src; if(thumbIndex<(photoCount-1)) { thumbIndex++; LoadThumb(); } } } } function PrepareNext() { if(direction>0) { if(currentIndex0) { nextIndex = currentIndex -1; } else { nextIndex = photoCount-1; } } var img = null; if(arrImage[nextIndex]) { img = arrImage[nextIndex]; } if(img==null) { img = new Image(); img.src = document.getElementById("photoPreviewUrl" + nextIndex).value; arrImage[nextIndex] = img; clearTimeout(timerMain); timerMain = setTimeout("WaitForLoad();", timeoutWait); } else { clearTimeout(timerMain); timerMain = setTimeout("DisplayNext();", timeout); } } function WaitForLoad() { var img = arrImage[nextIndex]; if(img) { if(!img.complete) { clearTimeout(timerMain); timerMain = setTimeout("WaitForLoad();", timeoutWait); } else { clearTimeout(timerMain); timerMain = setTimeout("DisplayNext();", timeout); } } } function DisplayNext() { var imgMain = document.getElementById("imgMain"); if(imgMain) { if(imgMain.filters) { imgMain.style.filter = transitions[GetTransitionIndex()]; imgMain.filters[0].Apply(); } imgMain.src = arrImage[nextIndex].src; imgMain.parentNode.href = document.getElementById("photoFullUrl" + nextIndex).value; document.getElementById("divFileName").innerHTML = document.getElementById("photoFileName" + nextIndex).value; document.getElementById("divFileDescr").innerHTML = document.getElementById("photoDescription" + nextIndex).value; if(imgMain.filters) { imgMain.filters[0].Play(); } clearTimeout(timerMain); timerMain = setTimeout("PrepareNext();", timeout); currentIndex = nextIndex; } } function GetTransitionIndex() { transitionIndex = Math.floor(Math.random() * (transitions.length-3)); return transitionIndex; } function GoBack() { if(run) { direction = 0; } else { if(currentIndex<=0) ShowPhoto(photoCount-1); else ShowPhoto(currentIndex-1); } } function GoForward() { if(run) { direction = 1; } else { if(currentIndex>=(photoCount-1)) ShowPhoto(0); else ShowPhoto(currentIndex+1); } } function StopRun() { document.getElementById("btnStopOrStart").src = "Skin/play.gif"; run = false; clearTimeout(timerMain); } function StartRun() { document.getElementById("btnStopOrStart").src = "Skin/pause.gif"; run = true; PrepareNext(); } function StopOrStart() { if(run) { StopRun(); } else { StartRun(); } } function IncreaseTimeout() { timeoutCount++; timeout = timeoutCount * 1000; document.getElementById("spSecond").innerHTML = timeoutCount; } function DecreaseTimeout() { if(timeoutCount>1) { timeoutCount--; timeout = timeoutCount * 1000; document.getElementById("spSecond").innerHTML = timeoutCount; } }