function changeImage(imgObj, imgTgt) { document.getElementById(imgTgt).src = eval(imgObj + ".src"); } var bannerTimer; var bannerTimeout; var curPromo; var curOpacity = 0; var firstPromo = (document.getElementById('rb0') != null) ? 0 : 1; var banner = firstPromo; // holds which variable we are going to show var bannerTimer; // holds ID of the timer that changes the banners var offset = 0; // holds the element index where page #1 will be; // list of pages in the banner rotation function hideAllPromos(cur) { var i = firstPromo; while (document.getElementById('rb'+i) != null) { if (i != cur) { document.getElementById('rb'+i).style.display='none'; } i++; } } function bannerRotate() // standard rotation of the banner; { bannerRotate(banner); } function bannerRotate(num) { if (!isNaN(num)) // num is a number (and not undefined, etc), change the banner to that banner # { banner = num - offset; } hideAllPromos(banner); var elem = document.getElementById('rb'+banner); startFade(elem); banner++; if (document.getElementById('rb'+banner) == undefined) { banner = firstPromo; } } function startFade(elem) { curPromo = elem; curOpacity = 0; elem.style.opacity='0'; elem.style.display=''; setTimeout("fade();", 10); } function fade() { curOpacity += .1; curPromo.style.opacity = curOpacity; if(curOpacity < 1) { setTimeout("fade();", 50); } else { if (!isNaN(bannerTimer)) // if bannerTimer has been defined, unset the timer { clearTimeout(bannerTimer); } bannerTimer = setTimeout("bannerRotate();",7000); // declare banner timer } } // initial call to the banner rotation bannerRotate();