		var contenuerr;
		var strrecherche;
		$(document).ready( function() {
			$('#menu li:first').css('border','none');
			$('#navigation li:first').css('border','none');
			$('#resultats').hide();
			$('#pagination').hide();
			contenuerr = $('#resultats').html();
			$('#frmrecherche').keyup(function(e) {
				if(e.keyCode == 13) {
					checkdetaillant(0);
				}
			});

			$('#btrecherche').click( function() {
				checkdetaillant(0);
			});
			$('.btpage').live('click', function() {
				$(this).siblings().removeClass('actif');
				$(this).addClass('actif');
				checkdetaillant($(this).text());
				return false;
			});
		});

	function checkdetaillant(nopage) {
		if(nopage == 0) {
			strrecherche = $('#frmrecherche').val();
		}
		$.post('/fr/ajax/' + $('body').attr('id') + '.html', 
			{ recherche: strrecherche,
			  page: nopage },
			function(data) {
				$('#resultats').show();
				if(data) {
					$('#resultats').html('');
					$('#frmrecherche').val('');
					if(data.pages != undefined) {
						pagination(data.pages);
					}
					$.each(data.output, function() {
						affliste(this);
					});
				}
				else {
					$('#resultats').html(contenuerr);
				}
			}, 'json');
	}
	function affliste(fiche) {
		var output = '<div>';
		output+= '<h3>' + fiche.nom + '</h3>';
		output+= '<p>' + fiche.adresse + '<br />';
		output+= fiche.ville + '<br />';
		output+= fiche.telephone + '<br />';
		if(fiche.site_web != null) {
			output+= '<a href="http://' + fiche.site_web + '" target="_blank">' + fiche.site_web + '</a><br />';
		}
		output+= fiche.contact + '</p>';
		output+= '</div>';
		$('#resultats').append(output);
	}
	function pagination(intnbpage) {
		var i;
		var btpage;
		$('#pagination').html('');
		for(i=1;i<=intnbpage;i++) {
			btpage = $('<a></a>');
			$(btpage).attr('href','#');
			$(btpage).addClass('btpage');
			$(btpage).text(i);
			if(i == 1) {
				$(btpage).addClass('actif');
			}
			$('#pagination').append(btpage);
		}
		$('#pagination').show();
	}
