// array of the divs to swap
var divs_to_fade = new Array('cfBlock1');//, 'cfBlock2', 'cfBlock3', 'cfBlock4', 'cfBlock5', 'cfBlock6'); 
// 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 frameID = 0;
// milliseconds between swaps.
var wait = 7500;
var cfControlButOn = '/resources/images/homepage/impact/bul-on.png';
var cfControlBut = '/resources/images/homepage/impact/bul.png';
var divToFadeHeigt = '303px';
var intVal;
function swapFade() {
	i = frameID;
	document.getElementById('cfControl'+i).src=cfControlBut;
	Effect.Fade(divs_to_fade[i], { duration:1, from:1.0, to:0.0 , queue: {position:'end', scope: 'scopea'} });
	i++;
	if (i == divs_to_fade.length) {i = 0;}
	document.getElementById('cfControl'+i).src=cfControlButOn;
	Effect.Appear(divs_to_fade[i], { duration:1, from:0.0, to:1.0, queue: {position:'end', scope: 'scopeb'} });
	frameID=i;
}
// the onload event handler that starts the fading.
function initCrossfader(){			
	for (i=0; i<divs_to_fade.length;i++) {
		if(i!=frameID){
			document.getElementById(divs_to_fade[i]).style.display='none';
		} else {
			document.getElementById('cfControl'+i).src=cfControlButOn;
		}
		document.getElementById(divs_to_fade[i]).style.height=divToFadeHeigt;
	}
	//autoFade();
}
function autoFade(frameID) { /*intVal = setInterval('swapFade()',wait);*/}
function stopAutoFade(){ 
/*clearInterval(intVal); */
}
function focusMoveTo(vFrameID){
	stopAutoFade();
	for (i=0; i<divs_to_fade.length;i++) {
		if(i!=vFrameID){
			document.getElementById(divs_to_fade[i]).style.display='none';
			document.getElementById('cfControl'+i).src=cfControlBut;
		} else {
			document.getElementById(divs_to_fade[i]).style.display='block';
			document.getElementById('cfControl'+i).src=cfControlButOn;
		}
	}
	frameID = vFrameID;
}
onLoadEvents : addOnloadEvent(initCrossfader);

