var timer = "";			// our timer
var timerSeconds = 8;	// interval between switches
var timerOn = 1;		// which element are we on currently
var lastSpotlight = 0;		// the last element
var playing = true;
function swap(el) {
	// they clicked, clear mouseover
	lastSpotlight = 0;
	if ( playing == false ) playing = true; // we want the playPause() to pause

	change(el);
}
function change(el) {
	timerOn = el;
	document.getElementById('spotlight1').style.display = "none";
	document.getElementById('spotlight2').style.display = "none";
	document.getElementById('spotlight3').style.display = "none";
	document.getElementById('spotlight4').style.display = "none";
	document.getElementById('spotlight5').style.display = "none";	

	
	if ( el == 1 ) {
		document.getElementById('spotlight1').style.display = "block";
	}
	else if ( el == 2 ) {
		document.getElementById('spotlight2').style.display = "block";
	}
	else if ( el == 3 ) {
		document.getElementById('spotlight3').style.display = "block";
	}
	else if ( el == 4 ) {
		document.getElementById('spotlight4').style.display = "block";
	}
	else if ( el == 5 ) {
		document.getElementById('spotlight5').style.display = "block";
	}
}
function startTimer() {
	if ( timer == "" ) timer = setTimeout("doTimer()", timerSeconds * 1000)
}
function doTimer() {
	timer = "";
	if ( playing == true && lastSpotlight == 0 ) {
		timerOn++;
		if ( timerOn == 6 ) {
			timerOn = 1;
		}
		change(timerOn);
		startTimer();
	}
}


function spotlightOver(el) {
	lastSpotlight = timerOn;
//	playPause();
	change(el);
}
function spotlightOut() {
	if ( lastSpotlight > 0 ) {
		change(lastSpotlight);
		lastSpotlight = 0;
		startTimer();
	}
}
startTimer();

