// JavaScript Document

//FUCIONES

	// PHP AJAX
	function phpajax(id,path,vars) 
	{
		 $.ajax({
		   type: "POST",
		   url: path,
		   data: vars,
		   success: function(html){
			 $("#"+id).html(html);
		   }
		 });
	}
	
	function ajaxBoolean(path, vars){
		
		var html = $.ajax({
		type: "POST",
		url: path,
		data: vars,
		cache: false,
		async: false
		}).responseText;	
	
		return html;
	}
function goUrl(url){
	location.href = url;
}

function findYourFriend(){
	
	var valor = $("#textfindYourFriend").val();
	alert(valor);
}

function searchGames(){
	var valor = $("#textSearch").val();
	goUrl("search.php?key="+valor);
}

function searchGamesResult(){
	
	var valor = $("#textSearchResult").val();
	var categoria = $("#selectCategories").val();	
	var variables = "";

	if(valor != "")
	{
		variables+= "key="+valor;
	}
	
	if(categoria != "")
	{
		if(variables != "")
		{
			variables+= "&cat="+categoria;
		}
		else
		{
			variables+= "cat="+categoria;
		}
	}

	goUrl("search.php?"+variables)
}

function checkInputsearch()
{
	var valor = $("#textSearch").val();
	if(valor == "")
	{
		$("#textSearch").val("search")
	}
}