// this array consists of the id attributes of the divs we wish to alternate between
var divs_to_fade;

// 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 number of banners of the divs_to_fade array.
var numberOfBanners;

// the number of milliseconds between swaps.  Default is five seconds.
var wait = 4000;

// the function that performs the fade
function swapFade() {
	
	var banner = $('banner' + i);

	new Effect.Move(banner, { x: 0, y: -100, duration: 1.5, delay: 0, transition: Effect.Transitions.sinoidal, 
		afterFinish: function () 
		{
			banner.setStyle ('display : none');
			banner.setStyle ('top: 100px;');
		}
	});

	i++;
	if (i == numberOfBanners) {
		i = 0;
	}
	
	var banner2 = $('banner' + i);
	banner2.setStyle ('display : block');
	new Effect.Move(banner2, { x: 0, y: -100, duration: 1.5, delay: 0, transition: Effect.Transitions.sinoidal, 
		afterFinish: function () 
		{
			
		}
	});
}

// the onload event handler that starts the fading.
function startSlideShow() {
	divs_to_fade = $('news').select('[class="slideshow-banner"]');
	numberOfBanners = divs_to_fade.length;
	if (numberOfBanners > 1) {		
		setInterval('swapFade()',wait);
	}
}

