// JavaScript Document
var timer_seconds = 0;
function show_timer(){
	if(timer_seconds > 0){
		var d = Math.floor(timer_seconds / 86400);
		seconds = timer_seconds % 86400;
		var h = Math.floor(seconds / 3600);
		seconds = seconds % 3600;
		var m = Math.floor(seconds / 60);
		seconds = seconds % 60;
		document.getElementById('timer').innerHTML = d + "d:" + (h < 10?"0":"") + h + "h:" + (m < 10?"0":"") +m + "m";
		Object.timer = setTimeout("show_timer("+(--timer_seconds)+")", 1000);
	}
	else if(Object.timer && bracketState){
		alert("Excuse us, the current round/stage of this bracket is over!");
		//var id = location.search.substr(4);
		//location.href = 'process_bracket.php?id=' + id + '&cmd=endstage&state=' + bracketState;
		location.reload();
	}
}