// $Id: clock.js,v 1.2 2006-09-15 14:11:53 smulcahy Exp $

function getObj(obj) {
	var objRef;

	if(document.all) {
		objRef = eval("document.all." + obj);
	}
	if(document.getElementById) {
		objRef = document.getElementById(obj);
	}

	return objRef;
}

var clockID = 0;
var tDate = new Date();

function showTime() {
	var mins = Number(tDate.getMinutes());
	if (mins < 10) mins = "0" + mins;

	var sec = Number(tDate.getSeconds());
	if (sec < 10) sec = "0" + sec;

	getObj("timeRefresh").innerHTML = "" + tDate.getHours() + ":" + mins + ":" + sec;
}

function UpdateClock() {
	if (clockID) {
		clearTimeout(clockID);
		clockID  = 0;
	}

	tDate.setTime(tDate.getTime() + 1000);

	showTime();

	clockID = setTimeout("UpdateClock()", 1000);
}

function _StartClock(y, m, d, h, M, S) {
	tDate = new Date(y, m, d, h, M, S);

	showTime();

	clockID = setTimeout("UpdateClock()", 1000);
}
