var defaultTimeOut = 5000; //Default timeout 5 seconds
var next = 1;

//Starts the rotation.
function startRotation (howMany, timeOut) {
	defaultTimeOut = timeOut;
	setTimeout('rotateLayers(' + howMany + ')', defaultTimeOut);
}

// This function rotates the visibility of layers sequentially.
function rotateLayers (howMany) {
	for (var i=1; i<=howMany; i++) eval("document.getElementById('rotatingLayer" + i + "').style.visibility = 'hidden'");
	eval("document.getElementById('rotatingLayer" + next + "').style.visibility = 'visible'");
	next++;
	if (next>howMany) next=1;
	setTimeout('rotateLayers(' + howMany + ')', defaultTimeOut);
}
