var score_timeout;
var oScoreboard = document.getElementById("scoreboard");

function handle_score_load ()
{
	oScoreList = document.getElementById("score_list");
	if(oScoreList)
	{
		oScoresArray = oScoreList.getElementsByTagName("LI");
		if(oScoresArray.length > 0)
		{
			// Display the first result
			oScoresArray[0].style.display = "block";
			scroller_interval = 5000;
			current_score = 0;

			clearTimeout(score_timeout);

			if (oScoresArray.length > 1) 
			{
				score_timeout = setTimeout(change_score, scroller_interval);
			}
		}
	}
	else {
		oScoresArray = null;
	}
}

function change_score()
{
	//Hide current score
	if (oScoresArray && oScoresArray.length > 0)
	{
		oScoresArray[current_score].style.display = "none";
		var next_score = current_score + 1;
		if (next_score >= oScoresArray.length) {
			next_score = 0;
		}
		oScoresArray[next_score].style.display = "block";
		current_score = next_score;
		score_timeout = setTimeout(change_score, scroller_interval);
	}
}
