// This script uses scriptaculous & prototype libraries to fade between multiple divs.
//include both lines below for it to work:

/*<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js"></script>*/


// this array consists of the id attributes of the divs we wish to alternate between
var divs_to_fade = new Array('banner1', 'banner2', 'banner3', 'banner4' );
var array_length = 4;

// the number of seconds between swaps.  Default is five seconds.
var seconds = 6;
wait = seconds * 1000;//milliseconds

// the starting index in the above array.  It should be set to the value of the div which doesn't have the CSS Display property set to "none"
var i = 0;

// the function that performs the fade
function swapFade() {
        Effect.Fade(divs_to_fade[i], { duration:1, from:1.0, to:0.0 });
        i++;
        if (i == array_length) i = 0;
        Effect.Appear(divs_to_fade[i], { duration:1, from:0.0, to:1.0 });
}
                       

// the onload event handler that starts the fading. (moved to page)
/*function startPage() {
        setInterval('swapFade()',wait);
}*/
