function countdown_clock(year, month, day, hour, minute, time_sync, id_extension) // thanks to franciscocharrua.com for the logic for this script // adapted by jon harris, digital ink // removed format control, replaced with graphics { html_code = '
'; document.write(html_code); Today = new Date(); Todays_Year = Today.getFullYear() - 2000; Todays_Month = Today.getMonth(); //Computes the time difference between the client computer and the server. Server_Date = (new Date(10, 07, 30, 00, 01, 11)).getTime(); Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime(); countdown(year, month, day, hour, minute, (Todays_Date - Server_Date), time_sync, id_extension); } function countdown(year, month, day, hour, minute, time_difference, time_sync, id_extension) { Today = new Date(); Todays_Year = Today.getFullYear() - 2000; Todays_Month = Today.getMonth(); //Convert today's date and the target date into miliseconds. Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime(); Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime(); // alert(Todays_Date) ; // alert(Target_Date) ; //Find their difference, and convert that into seconds. //Taking into account the time differential between the client computer and the server. Time_Left = Math.round((Target_Date - Todays_Date + time_difference - time_sync) / 1000); if(Time_Left < 0) Time_Left = 0; //More datailed. days = Math.floor(Time_Left / (60 * 60 * 24)); Time_Left %= (60 * 60 * 24); hours = Math.floor(Time_Left / (60 * 60)); Time_Left %= (60 * 60); minutes = Math.floor(Time_Left / 60); innerHTML = digits(days,'days',1) ; innerHTML += digits(hours,'hours',2) ; // innerHTML += digits(minutes,'minutes',4) ; // countdown_id = 'countdown' + id_extension; //eval('countdown_Object = document.all.' + countdown_id); document.getElementById('countdown').innerHTML = innerHTML ; // countdown_Object.innerHTML = innerHTML ; // start with 1 second time_out = 1000; var format = 6 ; // now minutes if(format > 3) time_out *= 60; // now hours if(format > 3) time_out *= 60; //Recursive call, keeps the clock ticking. setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + time_difference + ', ' + time_sync + ', \'' + id_extension + '\');', time_out); } function digits(iValue, elementID, padding) { var theHtml = '' ; if (iValue < 10) { var digit1 = '
' ;
var digit2 = '
' ;
}
else
{
// parse the number
var sValue = String(iValue);
var sFirst = sValue.substr(0,1) ;
var sSecond = sValue.substr(1,1) ;
var digit1 = '
' ;
var digit2 = '
' ;
}
theHtml = '