/* Copyright E-Learning Developments 2010 */ /* DO NOT MOVE THIS FILE FROM THE 'js' FOLDER */ var images = new Array("home/JPL_1.jpg","home/JPL_2.jpg","home/JPL_3.jpg","home/JPL_4.jpg","home/JPL_5.jpg"); var delay = 5000; var amount = 0.01; var opacity = 0; var imagea = null; var imageb = null; var curImg = 1; function fade() { opacity+=amount; if(amount>0) { if(opacity>1) { opacity = 1; amount*=-1; } } else { if(opacity<0) { opacity = 0; amount*=-1; } } imageb.style.opacity = opacity; imageb.style.filter = "alpha(opacity="+(opacity*100)+")"; if(opacity!=1 && opacity!=0) setTimeout(fade, 1000/60); else { curImg++; if(curImg>=images.length) curImg = 0; if(opacity == 1) // At full opacity, change background image to next image { imagea.style.backgroundImage = "url("+images[curImg]+")"; } else // At full transparency, set foreground div to next image { imageb.style.backgroundImage = "url("+images[curImg]+")"; //alert("Changing fg to " + images[curImg]); } setTimeout(fade, delay); } } function init() { imagea = document.getElementById('contentText'); imageb = document.getElementById('fadeCover'); setTimeout(fade,delay); }