function change_state_bylist(type)
{
	if(type=="ch") val='1';
	if(type=="gi") val='2';
	if(type=="all") val='12';
	
		var currentLocation =  document.location.href;
		if(currentLocation.lastIndexOf( "?" )>0) {
		
		var position_get=currentLocation.lastIndexOf( "?" );
		currentLocation = currentLocation.substring(currentLocation.lastIndexOf( "/" )+1,position_get);
		}
		else
		{
		
		currentLocation = currentLocation.substring(currentLocation.lastIndexOf( "/" )+1,document.location.href.length);
		}
		
		
		
        
						 
		if(val=='1')
		currentLocation='chambres-hotes/'+currentLocation;
		if(val=='2')
		currentLocation='locations/'+currentLocation;
		if(val=='12')
		currentLocation='hebergements/'+currentLocation;
		if(val=='0')
		currentLocation='hebergements/'+currentLocation;
			
		
		adatafield = new Array("val");
  		adatavalue= new Array(val);
  		adata = new Array(adatafield,adatavalue);
	
		ObjAJAX = new Ajax();
		ObjAJAX.setParam ({
		url : "prequests/check_gi-or-ch_from_home.php",
		returnFormat : "txt", 
		method : "POST", 
		data : adata,
		
		
		
		
		asynchronus : true,
		onComplete : "document.location.href='http:
		
	
		});
		ObjAJAX.execute();
}
