// JavaScript Document
	window.onload = function() { new CountDownTimer('timer'); };
	
	var CountDownTimer = function(timer_id) {
		var _this = this;
		
		this._timer_id 			= timer_id;
		this._timer 			= null;
		this._secondsRemaining 	= null;
		
		this.start = function() {
			this._timer = document.getElementById(this._timer_id);
			this._secondsRemaining = this._timer.getAttribute('seconds')? parseInt(this._timer.getAttribute('seconds')) : 300;
			this.countDown();
		};
				
		this.countDown = function() {
			if(--this._secondsRemaining < 0) {
				alert('Your time has expired! Press OK if you would like more time.');
				this.start();
				return;
			}
						
			var minutes = parseInt(this._secondsRemaining/60);
			var seconds = this._secondsRemaining%60;
			this._timer.innerHTML = (minutes < 10? '0' + minutes : minutes) + ':' + (seconds < 10? '0' + seconds : seconds);

			window.setTimeout(function() { _this.countDown(); }, 1000);
		};
		
		this.start();
	};
		

