var timerID = null
var timerRunning = false
var now = new Date()
var msecs = 0;

function stopclock(){
   if(timerRunning)
      clearInterval(timerID)
   timerRunning = false
}

function startclock(){
   // Make sure the clock is stopped
   stopclock()
msecs = parseInt(document.timeform.mytime.value)*1000;
//alert(document.timeform.mytime.value);  // why am I getting NAN????
   timerID = setInterval("showtime()",1000)
   timerRunning = true
}

function showtime(){	
msecs = msecs+1000;
now.setTime(msecs);
   var hours = now.getHours()
   var minutes = now.getMinutes()
   var seconds = now.getSeconds()
   var timeValue = "" + ((hours > 12) ? hours - 12 : hours)
   timeValue += ((minutes < 10) ? ":0" : ":") + minutes
   timeValue += ((seconds < 10) ? ":0" : ":") + seconds
   timeValue += (hours >= 12) ? " P.M." : " A.M."
document.getElementById("date").innerHTML = now.toDateString()+'  '+timeValue;

}

