function countdown_clock(year, month, day, hour, minute, format)
         {
         //I chose a div as the container for the timer, but
         //it can be an input tag inside a form, or anything
         //who's displayed content can be changed through
         //client-side scripting.
         html_code = '<div id="countdown"></div>';
         
         document.write(html_code);
         
         countdown(year, month, day, hour, minute, format);                
         }
         
function countdown(year, month, day, hour, minute, format)
         {
         Today = new Date();
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth() + 1;                  
         
         //Convert both 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();                  
         
         //Find their difference, and convert that into seconds.                  
         Time_Left = Math.round(Target_Date - Todays_Date) /1000;

		 var DSTAdjust = 0;
		oneMinute = 1000 * 60;
		var timerEnd = new Date(year, month, day, hour, minute, 00);
		var oneDay = oneMinute * 60 * 24;
		time = new Date();
		DSTAdjust = (timerEnd.getTimezoneOffset( ) - time.getTimezoneOffset( )) * oneMinute;
		var diff = Math.abs(timerEnd.getTime( ) - time.getTime( )) - DSTAdjust;
		var  mseconds =  diff % 1000;
		var  thdm = Math.floor(mseconds/100);
		var  hdm = Math.floor((mseconds%100)/10);
		var tedm = mseconds % 10;
		
        
         if(Time_Left < 0)
            Time_Left = 0;
        if(Time_Left > 0){
         switch(format)
               {
               case 0:
                    //The simplest way to display the time left.
                   document.getElementById('countdown').innerHTML = Time_Left + ' seconds'+ '<Br>';
					document.getElementById('countdown').innerHTML += thdm.toString() + hdm.toString() + tedm.toString() + ' msecs';
                    break;
               case 1:
                    //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);
                    Time_Left %= 60;
                    seconds = Time_Left;

                    dps = 's'; hps = 's'; mps = 's'; sps = 's';
                    //ps is short for plural suffix.
                    if(days == 1) dps ='';
                    if(hours == 1) hps ='';
                    if(minutes == 1) mps ='';
                    if(seconds == 1) sps ='';
					document.getElementById('countdown').innerHTML = "<table id='timer2' class='timer2' cellpadding='0' cellspacing='0' style='color:white;'>"+
      "<tr><td id='days' align='center'>0</td><td>&nbsp;</td><td align='center' id='hours'>0</td><td>&nbsp;</td><td id='mins' align='center'>0</td><td>&nbsp;</td><td id='secs' align='center'>0</td><td>&nbsp;</td><td id='msecs' align='center'>0</td></tr>"+
      "<tr class='labels'><td align='center'>&nbsp;days&nbsp;</td><td>&nbsp;</td><td align='center'>&nbsp;hours&nbsp;</td><td>&nbsp;</td><td align='center'>&nbsp;mins&nbsp;</td><td>&nbsp;</td><td align='center'>&nbsp;secs&nbsp;</td><td>&nbsp;</td><td align='center'>&nbsp;msecs&nbsp;</td></tr><tr><td colspan='16' align='right'></td></tr></table>";
					
					 document.getElementById('days').innerHTML = days;
					 document.getElementById('hours').innerHTML = hours;
					 document.getElementById('mins').innerHTML = minutes;
					 document.getElementById('secs').innerHTML = seconds;
					 document.getElementById('msecs').innerHTML = thdm.toString() + hdm.toString() + tedm.toString();


                    break;
               default: 
                   document.getElementById('countdown').innerHTML = Time_Left + ' seconds'+ '<Br>';
					document.getElementById('countdown').innerHTML += thdm.toString() + hdm.toString() + tedm.toString()+ ' msecs';
               }
               //alert(Math.floor(mseconds/100)+","+Math.floor((mseconds%100)/10)+","+mseconds % 10);
		         //Recursive call, keeps the clock ticking.
		         setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');', 100);
         	}
         }