var Todays_Date;
var countdownTime;
var changed = false;

function countdown_clock(today, year, month, day, hour, minute)
{
	 Todays_Date = today;
	 countdownTime = document.getElementById("kickoff_countdown");
	 countdown(year, month, day, hour, minute);
}

function countdown(year, month, day, hour, minute)
{
	Todays_Date += 10000;
	var Target_Date = (new Date(year, month - 1, day, hour, minute, 00)).getTime();
	var Time_Left = Math.round((Target_Date - Todays_Date) / 1000);

	 if(Time_Left < 0)
		Time_Left = 0;

	var days = Math.floor(Time_Left / (60 * 60 * 24));
	Time_Left %= (60 * 60 * 24);
	var hours = Math.floor(Time_Left / (60 * 60));
	Time_Left %= (60 * 60);
	var minutes = Math.floor(Time_Left / 60);
	Time_Left %= 60;

	var dps = 'S'; var hps = 'S'; var mps = 'S'; 
	//ps is short for plural suffix.
	if(days == 1) dps ='';
	if(hours == 1) hps ='';
	if(minutes == 1) mps ='';

	var minutesStr = minutes + "";

	var timeStr = "<span class=\"greenLabel\">" + days + "</span> <span class=\"unitLabel\">DAY" + dps + "</span>";
	timeStr += " <span class=\"greenLabel\">" + hours + "</span> <span class=\"unitLabel\">HOUR" + hps + "</span>";
	timeStr += " <span class=\"greenLabel\">" + minutesStr + "</span> <span class=\"unitLabel\">MIN" + mps + "</span>";

	countdownTime.innerHTML = timeStr;

	setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ');', 10000);
}