function countdown_clock(Time_Left, 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(Time_Left, format);                

         }

         

function countdown(Time_Left, format)

         {

         

         //Find their difference, and convert that into seconds.                  

        Time_Left_orginal = Time_Left;

         if(Time_Left <= 0)

		 {

            Time_Left = 0;

         

		document.getElementById("countdown").innerHTML = "<font color='red'>Closed</font>";

		return;

		 }

		

         switch(format)

               {

               case 0:

                    //The simplest way to display the time left.

                    document.getElementById("countdown").innerHTML = Time_Left + ' seconds';

                    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 = days +': ';

					

					hours+=days*24;

					

                    document.getElementById("countdown").innerHTML = hours + ': ';

                    document.getElementById("countdown").innerHTML += minutes + ': ';

                    document.getElementById("countdown").innerHTML += seconds + '';

                    break;

               default: 

                    document.getElementById("countdown").innerHTML = Time_Left + ' seconds';

               }

               Time_Left_orginal=Time_Left_orginal-1;

         //Recursive call, keeps the clock ticking.

         setTimeout('countdown(' + Time_Left_orginal +  ',' + format + ');', 1000);
 }