// Original code from http://www.javascript-page.com/clock.html
// Ammended by Daily.co.uk to prepend 0 to numbers less than 10

var clockID = 0;

function UpdateClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }

   var tDate = new Date();
   var fullmin = tDate.getMinutes();;
   var fullhour = tDate.getHours();
   var fullsecond = tDate.getSeconds(); 

   if (fullhour < 10) {
       fullhour = "0" + fullhour;
   }

   if (fullmin < 10) {
       fullmin = "0" + fullmin;
   }

   if (fullsecond < 10) {
       fullsecond = "0" + fullsecond;
   }

   document.theClock.theTime.value = "" 
                                   + fullhour + ":" 
                                   + fullmin + ":" 
                                   + fullsecond;
   
   clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
   clockID = setTimeout("UpdateClock()", 500);
}

function KillClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }
}
