function loadingTab(){
		$("#user-tab-response").html(
			"<div id='cuadrousuariosb' class='loading' >"+
			"<table width='305' cellpadding='0' cellspacing='0'>"+
			"<tr class='color2'>"+
			"<th colspan='2'>Nombre de usuario</th>"+
			"<th>Nivel</th>"+
			"<th>Puntos</th>"+
			"</tr>"+
			"<tr class='color1' align='center	'><td colspan='4'><img src='"+base+"/img/loadingAnimation.gif' /></td></tr>"+
			"<tr class='pie'>"+
			"<td colspan='4' height='34'>&nbsp;</td>"+
			"</tr>"+
			"</table>"+
			"</div>"
			);
}

function nextGameLeft(){
	globalAjaxLoadingEnabled = false;
	$("#next_game_p").load( base + "/games/nextGameLeft" );
	globalAjaxLoadingEnabled = true;
}
function nextGameLeftCountDown(){
	LeftSeconds =  LeftSeconds - 1;
	if ( LeftSeconds <= 0 ){
		LeftSeconds = 60;
		LeftMinutes = LeftMinutes - 1;
		if ( LeftMinutes <= 0 ){
			LeftMinutes = LeftMinutes -1;
			LeftHours = LeftHours - 1;
			if ( LeftHours <= 0 ){
				nextGameLeft();
				return;
			}
		}
	}
	$("#next_game_p").text( "Próximo juego en: " + LeftHours + " horas, " + LeftMinutes + " minutos y " +  LeftSeconds +" segundos");
}
$(function() {
	$('.users-xtab > a.AjaxTab').click(
		function(){
			loadingTab();
			$('#user-tab-response').load( this.href  );

			
			/*$('.users-xtab > a.AjaxTab').removeClass('selected');
			$(this).addClass('selected');*/
			$('.users-xtab').parent('li').removeClass('selected');
			$(this).parent().parent().addClass('selected');
			return false;
		}
	);
		$('#next_game_p').everyTime(1000,function(i) {
			if ( $("#next_game_p").text() == "no_games" || $("#next_game_p").text() == "" || !LeftEnabled ){
				$("#next_game_p").css("display", "none" );
				return;
			} else  {
					if ( $("#next_game_p").css("display" ) == "none" )
						$("#next_game_p").css("display", "block" );
				}
			nextGameLeftCountDown();
		});
	$('.users-xtab > a.AjaxTab:first').click();
//	$("#LastUserHome").load( base + "/users/lastRegisteredUser" );
}
);