function Game() {

	this.DrawInterval = 33;
	var frameManager;
	var seconds;
	var _frameHolder;
	

	this.Initialize = function () {
		// initialize all game variables
		frameManager = new Framerate();
		frameManager.setRate(30);
		frameManager.reset();
		seconds = 0;
		_frameHolder = document.getElementById('framecounter');
		_frameHolder.value = seconds;
	}
	this.LoadContent = function () {
		this.Initialize();
		// load content – graphics, sound etc.
		// since all content is loaded run main game loop
		// Calls RunGameLoop method every ‘draw interval’
		var game_env = this;
		this.GameLoop = setInterval(function(){game_env.RunGameLoop();}, this.DrawInterval);
	}



	this.Update = function () {
		// update game variables, handle user input, perform calculations etc.
		var numFrames = frameManager.getFrames();
        
        // Update amount of seconds
        seconds += numFrames / 10;
        
        // Show seconds on screen
        _frameHolder.value = Math.floor(seconds) + "." +
                               Math.floor(seconds * 10) % 10 +
                               " seconds";
	}

	this.Draw = function () {
	// draw game frame
	}
	
	this.RunGameLoop = function () {
		var myself = this;
		myself.Update();
		myself.Draw();
	}
}


/*function Game() {
	this.DrawInterval = 50;
	var frames;
	var _frameHolder;
	var _canvas;
	var _canvasContext;
	var _canvasFrameBuffer;

	//Game variables and Canvas Init
	this.Initialize = function () {
		//Game variables
		frames = 0;
		_frameHolder = document.getElementById('framecounter');
		_frameHolder.value = frames;
		//Init the canvas and the canvas buffer
		_canvas = document.getElementById('canvas');
		if (_canvas && _canvas.getContext) {
			_canvasContext = _canvas.getContext('2d');
			_canvasBuffer = document.createElement('canvas');
			_canvasBuffer.width = _canvas.width;
			_canvasBuffer.height = _canvas.height;
			_canvasBufferContext = _canvasBuffer.getContext('2d');
			return true;
		}
		return false;
	}
	//Content Load and Loop init
	this.LoadContent = function () {
		this.GameLoop = setInterval(this.RunGameLoop, this.DrawInterval);
	}

	//Game Loop
	this.RunGameLoop = function (game) {
				frames += 1;
		_frameHolder.value = frames;
		//this.Update();
		game.Draw();
	}

	//Game start function
	this.Run = function () {
		if (this.Initialize()) {
			// if initialization was succesfull, load content
			this.LoadContent();
		}

	}

	//Game update function
	this.Update = function () {
		frames += 1;
		_frameHolder.value = frames;
		alert("test");
	}

	//Performing double buffering
	this.Draw = function () {
		//Clear Canvas Buffer and Context
		_canvasFrameBuffer.clearRect(0, 0, _canvas.width, _canvas.height);
		_canvasContext.clearRect(0, 0, _canvas.width, _canvas.height);
		//Fill the buffer
		_map.Draw(_canvasFrameBuffer);
		//Move the buffer contents to _canvasContext
		_canvasContext.drawImage(_canvasBuffer, 0, 0);
	}
}*/
