$().ready(function()
{
	path		= $(".header a").attr('href');
	divMoteur	= "#moteur div#moteurContainer .criteres";
	
	/* === <CALENDRIER> === */
		var dates = $("#date_dpt, #date_retour").datepicker({
			minDate: 0,
			firstDay:1,
			onSelect: function(selectedDate) {
				var dpt = "date_dpt";
				var option = this.id == dpt ? "minDate" : "maxDate",	instance = $( this ).data( "datepicker" );
				date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat,selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		});
	/* === </CALENDRIER> === */
	
	
	/* === <MOTEUR> === */
		$(":input").each(function(){ this.setAttribute("autocomplete", "off");});
		
		$('#moteur div#moteurContainer li').click(function() {
			type			= $(this).attr('alt');
			
			/* === Page MOTEUR chargée dans le fragment du moteur === */
				if (type == "vol")
					$(location).attr('href', path + "index.php");
				else if (type == "hotel")
					$(location).attr('href', path + "discount-hotel.php");
				else if (type == "week-end")
					$(location).attr('href', path + "discount-week-end.php");
				else if (type == "voiture")
					$(location).attr('href', path + "discount-location-voiture.php");
			/* === Page MOTEUR chargée dans le fragment du moteur === */
			
			/* === Lien sur une page selon la rubrique === */
				/*
				var_vp			= $("#vp").attr('value');
				var_page		= $("#page").attr('value');
				var_type_page	= $("#type_page").attr('value');
				$("#moteur div#moteurContainer").load(
					path + "inc/moteur.php",
					{ type:type, var_vp:var_vp, var_page:var_page, var_type_page:var_type_page }
				);
				return false;
				*/
			/* === Lien sur une page selon la rubrique === */
		});
	/* === </MOTEUR> === */
	
	
	/* === <AUTO COMPLETION> === */
		$("#provenance").autocomplete({
			source: path + "inc/jquery/searchCity.php",
			minLength: 2
		});
		$("#destination").autocomplete({
			source: path + "inc/jquery/searchCity.php",
			minLength: 2
		});
	/* === </AUTO COMPLETION> === */
});
