var ClockApp = Class.create();

ClockApp.prototype = {
	utcTime: null,
	utcStartPoint: null,
	timerObj: null,
	container: null,
	
	initialize: function (utcTime, container) {
		date = new Date();
				
		this.utcTime = utcTime;
		this.container = container;
		this.utcStartPoint = date.getTime();
			
		this.updateClockEvent = this.updateClock.bind(this);
		
		this.timerObj = new PeriodicalExecuter(this.updateClockEvent, 1);
	},
	
	updateClock: function() {
		date = new Date();
		date.setTime(this.utcTime + date.getTime() - this.utcStartPoint);
		$(this.container).innerHTML = (date.getUTCHours().toString().length == 1 ? '0' + date.getUTCHours().toString() : date.getUTCHours().toString())  + ':' + (date.getUTCMinutes().toString().length == 1 ? '0' + date.getUTCMinutes().toString() : date.getUTCMinutes().toString())
	}
}