var rotIndex = 2; var rotImageCount = 5; var rotStep = 10; var rotBackground,rotDisplay,rotFadeStep; if (!window.onload){onLoads = new Array(); window.onload = function(){for (z = 0;z < onLoads.length;z++) onLoads[z]();}} onLoads.push(function(){ rotBackground = document.getElementById("background"); rotDisplay = document.getElementById("display"); rotFinal(); setInterval (rotUpdate,100); }); function rotAlpha(obj,alpha){ if (obj.filters !== undefined) obj.style.filter = "alpha(opacity=" + alpha + ")"; else if (obj.style.MozOpacity !== undefined) obj.style.MozOpacity = alpha / 100; else if (obj.style.opacity !== undefined) obj.style.opacity = alpha / 100; else if (obj.style.KhtmlOpacity !== undefined) obj.style.KhtmlOpacity = alpha / 100; } function rotFinal(){ rotFadeStep = false; document.body.style.backgroundImage = rotBackground.style.backgroundImage ? rotBackground.style.backgroundImage : "url(/homescreens/1.jpg)"; rotAlpha(rotBackground,0); rotBackground.style.backgroundImage = "url(/homescreens/" + rotIndex + ".jpg)"; } function rotNextImage(){ if (rotFadeStep) rotFinal(); rotStep = 10; rotIndex = rotIndex++ % rotImageCount + 1; rotFadeStep = 10; } function rotUpdate(){ if (rotFadeStep !== false){ rotAlpha(rotBackground,100 - (--rotFadeStep * 10)); if (!rotFadeStep) rotFinal(); } rotStep -= .1; if (rotStep <= 0) rotNextImage(); rotDisplay.innerHTML = rotStep.toFixed(1) + " sec. resterend"; }