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