var clockID = 0;

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

   var tDate = new Date();
   
   var ore=tDate.getHours();
   var minute=tDate.getMinutes();
   var secunde=tDate.getSeconds();
   
   if (ore<10) ore='0'+ore;
   if (minute<10) minute='0'+minute;
   if (secunde<10) secunde='0'+secunde;
   

   document.getElementById('ceas').innerHTML = "" 
                                   + ore + ":" 
                                   + minute + ":" 
                                   + secunde;
   
   clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
   clockID = setTimeout("UpdateClock()", 500);
}

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