
// Gestion des onglets de classement

$(document).ready(function () {

	$('#name_filter').click(function () { 
		$('#number_filter').removeClass('actif');
		$('#note_filter').removeClass('actif');	
		$('#name_filter').addClass('actif');	

		MAJ_session('PAGINATION_LANGUAGE_AGENCIES',0);		
		
		//On met à jour la variable de session FILTER
		MAJ_session('FMA_sort','NOM_AGENCE ASC');
					
		ajax_FMA_affiche_liste()
	});
	
});





function ajax_FMA_affiche_liste()
{
	$('#find_my_agency_content').html('');
	

	//On affiche les écoles
	$('#find_my_agency_content').addClass('sablier');
	$.ajax(
		   {
			   type:'POST',
			   url: '/rw-ajax/find_my_agency.ajax.php',
			   data: "func=list",
			   dataType: 'text',
			   success: function(reponse) { $('#find_my_agency_content').html(reponse); },
			   error: function(error){$('#find_my_agency_content').html('<font color=red><b>Erreur durant le traitement Ajax (url : \"ajax/find_my_agency.ajax.php\")</b></font>');},
			   async:  false			   
		   });
	$('#find_my_agency_content').removeClass('sablier');	


	ajax_FMA_affiche_number();

}


function ajax_FMA_filtre_city()
{
	//On met à jour la liste city
	$.ajax(
		   {
			   type:'POST',
			   url: '/rw-ajax/find_my_agency.ajax.php',
			   data: {func:'MAJ_liste_city'},
			   dataType: 'text',
			   success: function(reponse) { $('#FMA_city_list').html(reponse);  },
			   error: function(error){ $('#FMA_city_list').html('<font color=red><b>Erreur</b></font>'); },
			   async:  false			   
		   });
}


function ajax_FMA_affiche_number()
{
	$('#FMA_nb_results').html('');	
	
	//On affiche le nombre d'écoles trouvées
	$.ajax(
		   {
			   type:'POST',
			   url: '/rw-ajax/find_my_agency.ajax.php',
			   data: "func=count",
			   dataType: 'text',
			   success: function(reponse) { $('#FMA_nb_results').html(reponse);  },
			   error: function(error){ $('#FMA_nb_results').html('<font color=red><b>Erreur</b></font>'); },
			   async:  false			   
		   });
}


function ajax_FMA_affiche_number_sql()
{
	$('#FMA_nb_results').html('');		
	
	//On affiche le nombre d'écoles trouvées
	$.ajax(
		   {
			   type:'POST',
			   url: '/rw-ajax/find_my_agency.ajax.php',
			   data: "func=count_with_sql",
			   dataType: 'text',
			   success: function(reponse) { $('#FMA_nb_results').html(reponse);  },
			   error: function(error){ $('#FMA_nb_results').html('<font color=red><b>Erreur</b></font>'); },
			   async:  false			   
		   });
}

