// Check whether IE4 or later.
var MS = navigator.appVersion.indexOf("MSIE");
window.isIE4 = (MS > 0) &&
	(parseInt(navigator.appVersion.substring(MS + 5, MS + 6)) >= 4);

function lead0(val) {
	// Add leading 0s when necessary.
	return (val < 10) ? "0" + val.toString() : val;
}

function buildTime() {
	var time = new Date();
	var ampm = "";
	var h = time.getHours();
	// Fix military time and determine ampm.
// if (h > 12) {
// h = h - 12;
// ampm = " ";
//  }
	return lead0(h) + ":" + lead0(time.getMinutes()) + ":" +
		lead0(time.getSeconds()) + ampm;
}

function tick() {
	// Replace the clock's time with the current time.
	document.all.clock.innerText = buildTime();
}