﻿var timerStopped = false;
var switchToNew = 2;
var t

function switchTip(tipNumber) {

	document.getElementById("tip_counter_1").style.backgroundColor = '#b40000';
	document.getElementById("tip_counter_2").style.backgroundColor = '#b40000';
	document.getElementById("tip_counter_3").style.backgroundColor = '#b40000';
	document.getElementById("tip_counter_" + tipNumber).style.backgroundColor = '#ff0000';

	document.getElementById("tip1").style.display = 'none';
	document.getElementById("tip2").style.display = 'none';
	document.getElementById("tip3").style.display = 'none';
	document.getElementById("tip" + tipNumber).style.display = 'block';

}

function switchTimer(switchTo) {
	
	 switchTo = parseInt(switchTo) 

	 
	 	switchTip(switchTo);
	 	if (switchTo == 3) {
	 		switchToNew = 1;
	 	} else {
	 		switchToNew = switchTo + 1;
	 	}
	 
	 clearTimeout(t);
	 t = setTimeout("switchTimer('" + switchToNew  + "')", 7500); 	
}

function stopTimer(nextId) {
	if (nextId == 3)
	{
	    switchToNew = 1 
	} else {
	    switchToNew = nextId + 1
	}
	clearTimeout(t);
        t = setTimeout("switchTimer('" + switchToNew  + "')", 7500); 	
}