
//Script by Howard Chen
//This clock tells you the exact days, hours, minutes, and seconds from a particular date.

var theDay = new Date("January 1, 2010 00:00:01")		//The day that you want to solve that it's how long from now.
var DayTill					//The string that is going to put all numbers together and make sense.

function countdown()
{
var today = new Date()				//Create an Date Object that contains today's date.
var second = Math.floor((theDay.getTime() - today.getTime())/1000)
/*Use getTime() to get the milisecond (1/1000 of a second) from now to theDay.
and devide it into 1000 to get the seconds from now to theDay.*/

var minute = Math.floor(second/60)		//Devide "second" into 60 to get the minute
var hour = Math.floor(minute/60)		//Devide "minute" into 60 to get the hour
var day = Math.floor(hour/24)			//Devide "hour" into 60 to get the day

CDay= day					//Correct day
CHour= hour % 24				//Correct hour, after devide into 24, the remainder deposits here.
CMinute= minute % 60				//Correct minute, after devide into 60, the remainder deposits here.
CSecond= second % 60				//Correct second, after devide into 60, the remainder deposits here.

if ( CHour < 10 ) CHour = '0' + CHour ;
if ( CMinute < 10 ) CMinute = '0' + CMinute ;
if ( CSecond < 10 ) CSecond = '0' + CSecond ;

//DayTill =  CDay + " JOURS " + CHour + ":" + CMinute + ":" + CSecond + " AVANT L'OUVERTURE OFFICIELLE !"
DayTill =  CDay + TRD_JOURS + CHour + ":" + CMinute + ":" + CSecond 
//Rewrite the string to the correct information.

if ( second >= 0 ) {
  document.getElementById("compteur").innerHTML = DayTill;
}

//document.clock.countdown.value = DayTill	//Make the particular form chart become "Daytill"
var counter = setTimeout("countdown()", 1000)	//Create the timer "counter" that will automatic restart function countdown() again every second.
}

// DEMARRER QUAND LA PAGE EST CHARGEE!
addLoadEvent(function() {
  countdown();
});

