Track = new function () {
	this.goodMove = 0;
	this.badMove = 0;
	this.startTime = 0;
	this.trackMove = function () {
		this.goodMove ++;
	}
	this.trackFail = function () {
		this.badMove ++;
	}
	this.startLevel = function () {
		this.startTime = new Date();
		this.goodMove = 0;
		this.badMove = 0;
	}

	this.totalMovements = function()
	{
		return this.goodMove + this.badMove;
	}

	this.endLevel = function () {
		var tiempoTranscurrido = Math.round ( (new Date()-this.startTime ) / 1000 ) ;
		new  Ajax.Request(BaseURL()+'laberints/save/'+tiempoTranscurrido+'/'+this.goodMove+'/'+this.badMove+'/'+currentMaze[0],{method : 'post'});
		alert ('La teva puntuaci\u00F3 s\'ha guardat correctament.');
	}
}

