var timerID = 0;
var tStart  = null;

function UpdateTimer() {
   if(timerID) {
      clearTimeout(timerID);
      clockID  = 0;
   }

   if(!tStart)
      tStart   = new Date();

   var   tDate = new Date();
   var   tDiff = tDate.getTime() - tStart.getTime();

   tDate.setTime(tDiff);

   document.getElementById('theTime').value = tDate.getSeconds();
   
   if (document.getElementById('theTime').value > 2) {
   		Stop();
		Reset();
		document.getElementById('ea').value = "you@email.com";
   } else {
	   timerID = setTimeout("UpdateTimer()", 1000);
   }
}

function Start() {
   tStart   = new Date();

   document.getElementById('theTime').value = 0;

   timerID  = setTimeout("UpdateTimer()", 1000);
}

function Stop() {
   if(timerID) {
      clearTimeout(timerID);
      timerID  = 0;
   }

   tStart = null;
}

function Reset() {
   tStart = null;

   document.getElementById('theTime').value = 0;
}
