$(document).ready(function() {
	ini_autocomplete();
	$.post("/includes/modules/getSearch.php", { type:"pays", terme:getId("terme_hidden").innerHTML, limit: 10 } , function(dataPays){
		getId("res-pays").innerHTML=dataPays;
		var tabPays=$("#res-pays").find("span.menu_pays");
		var strPays="";
		for(var i=0;i<tabPays.length;i++){
			paystmp=$(tabPays[i]).attr("id").split("pays_");	
			strPays+=paystmp[1];
			if(i!=tabPays.length-1) strPays+="-";
		}
		
		$.post("/includes/modules/getSearch.php", { type:"carnets", terme:getId("terme_hidden").innerHTML, limit: 10, idPays: strPays } , function(data){
			getId("res-carnets").innerHTML=data;
		});
		$.post("/includes/modules/getSearch.php", { type:"albums", terme:getId("terme_hidden").innerHTML, limit: 10, idPays: strPays } , function(data){
			getId("res-albums").innerHTML=data;
		});
		/*$.post("/includes/modules/getSearch.php", { type:"vols", terme:getId("terme_hidden").innerHTML, limit: 10, idPays: strPays } , function(data){
			getId("res-vols").innerHTML=data;
		});
		$.post("/includes/modules/getSearch.php", { type:"hotels", terme:getId("terme_hidden").innerHTML, limit: 10, idPays: strPays } , function(data){
			getId("res-hotels").innerHTML=data;
		});
		$.post("/includes/modules/getSearch.php", { type:"sejours", terme:getId("terme_hidden").innerHTML, limit: 10, idPays: strPays } , function(data){
			getId("res-sejours").innerHTML=data;
		});
		$.post("/includes/modules/getSearch.php", { type:"croisieres", terme:getId("terme_hidden").innerHTML, limit: 10, idPays: strPays } , function(data){
			getId("res-croisieres").innerHTML=data;
		});
		$.post("/includes/modules/getSearch.php", { type:"weekend", terme:getId("terme_hidden").innerHTML, limit: 10, idPays: strPays } , function(data){
			getId("res-weekend").innerHTML=data;
		});*/
	});
});


function ini_autocomplete(){
	$.post("/includes/modules/getAutoComplete.php", {  } , function(data){
		data_complete=data.split("|");
		$("#champ_search").autocomplete(data_complete, {autoFill: true });
	});
}
	
	
function search_function(){
	window.location.href="/"+lang_site+"/recherche/"+getId("champ_search").value+"/";
}
