function clock(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 = '<p id="clock"></p>';
         
         document.write(html_code);
         
         Today = new Date();
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth() + 1;
         
         <%
         current_time = time         
         current_second = second(current_time)
         current_minute = minute(current_time)
         current_hour = hour(current_time)
         
         current_date = date
         current_day = day(current_date)
         current_month = month(current_date)
         current_year = year(current_date)
				 
         %>
		 
         //Computes the time difference between the client computer and the server.
         Server_Date = (new Date(<%= current_year - 2000 %>, <%= current_month %>, <%= current_day %>,
                                 <%= current_hour %>, <%= current_minute %>, <%= current_second %>)).getTime();
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(),
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();
         
         tick((Todays_Date - Server_Date), format);                
         }
         
function tick(time_difference, format)
         {
         Today = new Date(new Date().getTime() - time_difference);  
         
         minutes = Today.getMinutes();
         if(minutes < 10)
            minutes = '0' + minutes;
            
         seconds = Today.getSeconds();
         if(seconds < 10)
            seconds = '0' + seconds;
         
         months = new Array('January',
                            'February',
                            'March',
                            'April',
                            'May',
                            'June',
                            'July',
                            'August',
                            'September',
                            'October',
                            'November',
                            'December');   
		  
		 /* Set GMT */                                 
		 var hours = Today.getHours();
		 hours = hours + 6;
		 
         switch(format)
               {
               case 0:
                    document.getElementById('clock').innerHTML = months[Today.getMonth()] + ' ' +
                                                   Today.getDate() + ', ' + 
                                                   Today.getYear() +  ' ' + 
                                                   Today.getHours() + ':' +
                                                   minutes + ':' +
                                                   seconds;
                    break;
               case 1:
                    document.getElementById('clock').innerHTML = Today.getDate() + '-' +
                                                   (Today.getMonth() + 1) + '-' + 
                                                   Today.getYear() +  ' ' + 
                                                   Today.getHours() + ':' +
                                                   minutes + ':' +
                                                   seconds;
                    break;
               default: 
                    document.getElementById('clock').innerHTML = "Thailand Time: "+//months[Today.getMonth()] + ' ' +
                                                   //Today.getDate() + ', ' + 
                                                   //Today.getYear() +  ' ' + 
                                                   hours + ':' +
                                                   minutes + ':' +
                                                   seconds;
               }
               
         //Recursive call, keeps the clock ticking.
         setTimeout('tick(' + time_difference + ', ' + format + ');', 1000);
         }
