/*  Crossfader section**************/	
var wait = 5000;
var duration = 1.0;
var i = 0;
var divs_to_fade = new Array();

document.observe("dom:loaded", function() {
	if ($('faderWrapper') ) {
		startPage();
	};
});  
/* /Crossfader section************/	


function startPage() {
    // this array consists of the divs we want to crossfade between
    divs_to_fade = $$('#faderWrapper .startScreenFader');

    // setTimeout works better here with IE
	if(divs_to_fade.length > 1)
		myTimeout = setTimeout("swapFade()", (duration*1000)+wait);
}


// the function that performs the fade
function swapFade() {
	$(divs_to_fade[i]).fade({ 
		duration:duration, 
		afterFinish: function(el){
			
		}
	});
	i++;
	if (i >= divs_to_fade.length) {
		i = 0;
	}
	//$(divs_to_fade[i]).appear({ duration:duration, from:0.0, to:1.0 });
	$(divs_to_fade[i]).appear({ 
		duration:duration, 
		afterFinish: function(el){

		} 
	});
	
	clearTimeout(myTimeout);
	myTimeout = setTimeout("swapFade()", (duration*1000)+wait);
}
