var CurScreen = 0;
var MaxScreen = 0;
var refreshSwitchTimer;

function pauseSwitch()
{
	clearTimeout(refreshSwitchTimer);
}

function goonSwitch()
{
	var MaxScreen = document.getElementById('ImageCount').getAttribute('value');
	//window.alert(MaxScreen);
	var NextScreen = CurScreen + 1;
	if(NextScreen > MaxScreen)
	{
		NextScreen = 1;
	}
	imageDisplay(NextScreen);
	refreshSwitchTimer = setTimeout('goonSwitch()', 4000);
}

function imageDisplay(Show_SwitchId)
{
	//window.alert(Show_SwitchId);
	var MaxScreen = document.getElementById('ImageCount').getAttribute('value');
	//window.alert(MaxScreen);
	for(var i=1; i<=MaxScreen; i++)
	{
		document.getElementById("Switch_" + i).style.display = "none";
	}
	document.getElementById("Switch_" + Show_SwitchId).style.display = "block";
	
	CurScreen = Show_SwitchId;
}