// this array consists of the id attributes of the divs we wish to alternate between. You can add more divs to the array, and change the counter to if i==n
var divs_to_fade = new Array('sub1a','sub1b');


var n = divs_to_fade.length;

// 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;  //counters start at 0 ;)
 
// the number of milliseconds between swaps.  Default is five seconds.
var wait =3 * 1000;

// the function that performs the fade
function swapFade() {

	Effect.Fade(divs_to_fade[i], { duration:.75, from:1.0, to:0.0 });
	i++;
	if (i == n) i = 0;
	Effect.Appear(divs_to_fade[i], { duration:0.75, from:0.0, to:1.0 });
}


var divstate = new Array(true,false,true,false,true);



function randomFade(){
	while (i==n-1) { i=Math.floor(Math.random()*5)};
	
	n=i+1;
	if (divstate[i]) {
		divstart = "sub" + n + "a";
		divend = "sub" + n + "b";
		divstate[i] = false;

	} else {
		divstart = "sub" +  n + "b";
		divend = "sub" + n + "a";
		divstate[i] = true;

	}
	
	Effect.Fade(divstart, { duration:1, from:1.0, to:0.0 });
	Effect.Appear(divend, { duration:1, from:0.0, to:1.0 });
}

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

