var timerID = null;
var timerRunning = false;

function stopclock (){
 if(timerRunning){
  clearTimeout(timerID);
  timerRunning = false;
 }
}

function showtime () {
 var now = new Date();
 var hours = now.getHours();
 var minutes = now.getMinutes();
 var seconds = now.getSeconds()
 if(minutes < 10) minutes="0" + minutes;
 if(seconds < 10) seconds="0" + seconds;
 var timeValue = hours + ":" + minutes + ":" + seconds;

/* only for ie */


 document.clock.time.value = timeValue;

 timerID = setTimeout("showtime()",1000);
 timerRunning = true;
}

function startclock() {
 stopclock();
 showtime();
}
