var CountDown = function(container, remainingTime) {
	this.htmlElement = document.getElementById(container);
		this.remainingTime = remainingTime; 	
};

CountDown.prototype = {
  display: function() {
		if (this.remainingTime > 0) {
			var h = Math.floor(this.remainingTime/3600); //this.localTime.getHours();
			var m = Math.floor((this.remainingTime-h*3600)/60);//this.localTime.getMinutes();
			var s = Math.floor((this.remainingTime - h*3600 - m*60)); //this.localTime.getSeconds();
			
			h = (h < 10) ? '0' + h : '' + h;
			m = (m < 10) ? '0' + m : '' + m;
			s = (s < 10) ? '0' + s : '' + s;
			
			//this.localTime.date.setUTCMilliseconds(-1);
			this.remainingTime--;
	
			var displayText = h + ":" + m + ":" + s;
		}
		else {
			var displayText = "00:00:00";
		}
		
		if (this.remainingTime < 3600) {
			this.htmlElement.style.color = "#ff0000";
		}
  
  	this.htmlElement.innerHTML = displayText;
  	
  	setTimeout(this.display.bindAsEventListener(this), 1000);
  }  
}
