// JavaScript Document



var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

var defaultMsg = 'Countdown over!';

function countdown(yr,m,d,id,msg){

var div = document.getElementById(id);

var theyear=yr;

var themonth=m;

var theday=d;

var today=new Date();

var todayy=today.getFullYear();

var todaym=today.getMonth();

var todayd=today.getDate();

var todayh=today.getHours();

var todaymin=today.getMinutes();

var todaysec=today.getSeconds();

var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec;

futurestring=montharray[m-1]+" "+d+", "+yr;

var dd=Date.parse(futurestring)-Date.parse(todaystring);

var dday=Math.floor(dd/(60*60*1000*24)*1);

var dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);

var dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);

var dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);

if(dd>0){

 div.innerHTML=dday+ " days "+dhour+" hours "+dmin+" minutes and "+dsec+" seconds";

setTimeout("countdown("+ theyear +","+ themonth +","+ theday +",'"+ id +"','"+ msg +"')",1000);

} else {

 // Countdown is expired

 div.innerHTML = (msg) ? msg : defaultMsg;

}

 }

 window.onload = function() {

 // Set your YYYY,M,DD here

countdown(2010,12,01,'live');

  // Experiment with these past date

 countdown(1999,1,1,'expired');

// With custom message

countdown(1999,1,1,'expiredMsg','I like cake!');

  // Attributes are:

  // year

  // month

  // day

  // ID of the element to put the countdown in.

  // Message to display when the countdown is finished (optional).

 

      } 

