var beginTime;
var c;
var t;
var timer_is_on=0;

function timedCount()
{
var time = new Date();
var total = time.getTime()-beginTime;
var h = (total - (total % 3600000)) / 3600000;
var mrem = total -h * 3600000;
var m = (mrem - (mrem % 60000))/60000;
var srem = mrem - m*60000;
var s = (srem - (srem % 1000)) / 1000;
document.getElementById('txt').innerHTML=h+":"+m+":"+s;
t=setTimeout("timedCount()",1000);
}

function doTimer(begin)
{
if (!timer_is_on)
  {
  timer_is_on=1;
  beginTime = begin;
  timedCount();
  }
}

function stopCount()
{
clearTimeout(t);
timer_is_on=0;
begintime=0;
}