/*
This script creates a date to which to count down to and then counts down to it. It places the decrimenting
clock in a div or block object with the ID of "txt" somewhere on the created page.
This script is based on a few examples I can't be bothered to cite but the combination of the scripts is
entirely my own...so there :p
*/
function countdown(y, m, d, hr, min, sec){
/*The above invocation collects 6 variables from the calling of the script. They are (in order) a four
digit year, the month (0-11), the date (1-31), the hour (0-23), the minute (0-59), the second (0-59).*/
	year=y
	month=m
	day=d
	hour=hr
	minute=min
	second=sec
	var today=new Date()
	var future=new Date()
	future.setFullYear(year) //four digit year
	future.setMonth(month) //0-11
	future.setDate(day) //1-31
	future.setHours(hour) //0-23
	future.setMinutes(minute) //0-59
	future.setSeconds(second) //0-59
	dd=future-today
	dday=Math.floor(dd/(60*60*1000*24)*1)
	dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
	dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
	dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
	dday=checkTime(dday)
	dhour=checkTime(dhour)
	dmin=checkTime(dmin)
	dsec=checkTime(dsec)
	document.getElementById("txt").innerHTML="ETA "+dday+ ":"+dhour+":"+dmin+":"+dsec
	t=setTimeout('countdown(year, month, day, hour, minute, second)',1000)
	if (dd<=0)
	document.getElementById("txt").innerHTML="Game over, man"
}
//The above function is an infinite loop.
//The below function corrects the time to have two digits
function checkTime(i)
{
if (i<10)
  {
  i="0" + i;
  }
return i;
}
