var clockID = 0;

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

  var tid = new Date();

  var h = tid.getHours();
  hrs = (h>=10)?(""+h):("0"+h);

  var m=tid.getMinutes();
  mns = (m>=10)?(""+m):("0"+m);

  var s=tid.getSeconds();
  scs = (s>=10)?(""+s):("0"+s); 

   document.getElementById('theTime').innerHTML = "" 
                                   + hrs + ":" 
                                   + mns + ":" 
                                   + scs;
   
   clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
   clockID = setTimeout("UpdateClock()", 500);
}

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

//-->


