/* author: Y Troullides */
/* creation date: 18/11/00 */
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()
	var tStr
	tDate.setTime(tDiff)
	tStr = ""
	if (tDate.getMinutes() < 10)
		tStr += "0" + tDate.getMinutes()
	else
		tStr += tDate.getMinutes()
	if (tDate.getSeconds() < 10)
		tStr += "0" + tDate.getSeconds()
	else
		tStr += tDate.getSeconds()
	
	ShowTimer(tStr)
	timerID = setTimeout("UpdateTimer()", 1000)
} 

function StartTimer() {
	tStart = new Date()
	ShowTimer("0000")
	timerID = setTimeout("UpdateTimer()", 1000)
}

function ShowTimer(timeStr) {
	for (i=1; i<=timeStr.length; i++) {
		//window.status='Timer'+i+'Div'+'   timeStr'
		changeImage('Timer'+i+'Div','Timer'+i+'Img','LedImg'+timeStr.charAt(i-1))
	}
}

function StopTimer() {
	if (timerID) {
		clearTimeout(timerID)
		timerID = 0
	}
	tStart = null
}

function ResetTimer() {
	tStart = null
	ShowTimer("0000")
}
	

