// Moteur de recherche
$(document).ready(function() {
	$("#kps_moteur .kps_moteur-details a").toggle(
		function() {
			$("#kps_moteur fieldset").removeClass("kps_moteur_simple");
			$("#kps_moteur .kps_moteur-detail-form").removeClass("kps_none");
			$("#kps_moteur .kps_moteur-submit-1").addClass("kps_none");
			$(this)
				.html('Moins de crit&egrave;res')
				.css("background", "url(../images/pictos/fleche-grise-mini-on.png) no-repeat 0 3px");	
			return false;
		}, 
		function() {
			$("#kps_moteur fieldset").addClass("kps_moteur_simple");
			$("#kps_moteur .kps_moteur-detail-form").addClass("kps_none");
			$("#kps_moteur .kps_moteur-submit-1").removeClass("kps_none");
			$(this)
				.html('Plus de crit&egrave;res')
				.css("background", "url(../images/pictos/fleche-grise-mini.png) no-repeat 0 3px");
			
			return false;
		}
	);
	
	$('#kps_moteur-champ-pays').change(function() {
		if ($(this).val() == '60') {
			$('.kps_moteur-champ-region').removeClass('kps_none');
		} else {
			$('.kps_moteur-champ-region').addClass('kps_none');
			$('#kps_moteur-champ-region').val('0');
		}
	});
	
	
	$('#kps_moteur-champ-continent').change(function() {
		if($('#kps_moteur-champ-continent').val() == '99') {
			$('#kps_moteur-champ-loc').removeAttr('disabled');
			$('#kps_moteur-champ-ou').attr('disabled', true);
			$('#kps_moteur-champ-ou').hide();
			$('#kps_moteur-champ-loc').show();
		}
		else if($('#kps_moteur-champ-continent').val() != '0') {
			$('#kps_moteur-champ-ou').removeAttr('disabled');
			$('#kps_moteur-champ-loc').attr('disabled', true);
			$('#kps_moteur-champ-loc').hide();
			$('#kps_moteur-champ-ou').show();
		}
		else {
			$('#kps_moteur-champ-loc').attr('disabled', true);
			$('#kps_moteur-champ-ou').attr('disabled', true);
			$('#kps_moteur-champ-loc').hide();
			$('#kps_moteur-champ-ou').show();
		}
	});
});
