function Clock(target) {
	this.browse = function() {
		
		window.location.href = "temps.html";
	}
	this.closure = function() {
		try {
			target.clock.step();
		}
		catch(e) {
		}
	}
	this.start = function() {
		this.interval = window.setInterval(this.closure, 1000);
	}
	this.step = function() {
		var date = new Date();
		var hours = date.getHours();
		var minutes = date.getMinutes();
		var seconds = date.getSeconds();
		this.stepDigit($("H1"), Math.floor(hours / 10));
		this.stepDigit($("H0"), Math.floor(hours % 10));
		this.stepDigit($("M1"), Math.floor(minutes / 10));
		this.stepDigit($("M0"), Math.floor(minutes % 10));
		this.stepDigit($("S1"), Math.floor(seconds / 10));
		this.stepDigit($("S0"), Math.floor(seconds % 10));
	}
	this.stepDigit = function(element, value) {
		element.style.backgroundPosition = '-' + (value * 20) + 'px 0';
	}
	var html = '<table border="0" cellpadding="0" cellspacing="0">';
	html += '<tr>'
	html += '<td id="H1" class="DIGIT"></td>';
	html += '<td id="H0" class="DIGIT"></td>';
	html += '<td class="COLON" id="C1"></td>';
	html += '<td id="M1" class="DIGIT"></td>';
	html += '<td id="M0" class="DIGIT"></td>';
	html += '<td class="COLON" id="C0"></td>';
	html += '<td id="S1" class="DIGIT"></td>';
	html += '<td id="S0" class="DIGIT"></td>';
	html += '</tr></table>'
	target.innerHTML = html;
	target.clock = this;
	this.step();
	Event.observe(target, "click", this.browse);
};

