
//pour connaitre la position d'un élément
jQuery.fn.extend({
	findPos : function() {
		obj = $(this).get(0);
		var curleft = obj.offsetLeft || 0;
		var curtop = obj.offsetTop || 0;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
		return {x:curleft,y:curtop};
	}
});

/*
* Selects an option by value
*
* @name     selectOptions
* @author   Mathias Bank (http://www.mathias-bank.de)
* @param    value specifies, which options should be selected
* @example  jQuery("#myselect").selectOptions("val1");
*
*/
jQuery.fn.selectOptions = function(value) {
	
	this.each(
		function()	{
			if(this.nodeName.toLowerCase() != "select") return;

			// get number of options
			var optionsLength = this.options.length;

			if(value)
			{
				for(var i = 0; i<optionsLength; i++) {
					if (this.options[i].value == value) {
						this.options[i].selected = true;
					};
				}
			}

			else
			{
			
				this.options[0].selected = true;
			
			}
		}
	)
	
	return this;
}

function verif(email) { // vérif validité email par REGEXP
				var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/
				return (reg.exec(email)!=null)
	}
function load_news_letter()
	{
		$('.ok').hide();
		//on controle le mail au fur et à mesure de son entrée
		$('input#mail').keyup(function(){
			if(verif($(this).val())) $('.ok').show();
			else $('.ok').hide();
		});
		$('form#newsletter_form').submit(function(){
			if(verif($('input#mail').val()))
			{
				
				$.ajax({
					type: "POST",
					url: 'proxy.php',
					data: {what: 'newsletter', 
						   mail: $('input#mail').val(),
						   ip: $('#ip').val(),
						   demande:$("input[@type=radio][@checked][@name=demande]").val()
						   },
					success: function(msg){
						//alert(msg);
						//vider le champ mail
						$('input#mail').val("");
						alert(msg);
						$('.ok').hide();
						//confirm(msg);
						
					}
				});
			}
		});
	}


function moteur_sejour(type,id_pays)
{
	$(document).ready(function(){
		load_news_letter();					   
		
			  
			//$('#circuit').attr("checked","circuit");
		 $("#sejour [@name=sejour][@type=radio][@checked]").each(function() { order=this.value; });
		$('#circuit:radio').click(
			function (){

			//alert($('#circuit').val());
			//$('#recherche').attr("src","");
				$('#recherche').css("display","none");
				$('.loading').css("display","block");
				//$('#recherche').attr("disabled","true");
				
		//$('#formmoteur').attr("action","./liste_circuit.php");	
		if($('#circuit').val()=="circuit_es")
			$('#txt_recherche').empty().append('BÚSQUEDA DE CIRCUITOS');
		else if($('#circuit').val()=="circuit_it")
			$('#txt_recherche').empty().append('RICERCA DI TOURS');
		else
			$('#txt_recherche').empty().append('RECHERCHE DE CIRCUITS');
		//$('#sejour').attr("value","circuit");
		type=$('#circuit').val();
		//type="circuit";
		//var transDNSValue = $("'#sejour':checked").val();	
	 //if($("input[@id='sejour']:checked").val()=="circuit")
		if($('#circuit').val()=="circuit" || $('#circuit').val()=="circuit_es" || $('#circuit').val()=="circuit_it" || $('#circuit').val()=="circuit_fr")
		//if(type=="circuit")
		{
			//alert($('#sejour').val());
		//charge dynamiquement le combo dest de moteur
		$.ajax({
			type: "POST",
			url: 'proxy.php',
			data: {what:'combodestinationcircuit',id_pays:id_pays},
			success: function(msg){
				if(msg.length>0)
				{
					if(document.all) $('#destination').empty().append(msg);
					else $('#destination').empty().append(msg).selectOptions(id_pays);
				}
	
				//charge du combo DEPART lors de l'affichage de la page en fonction de la destination (pays)
				
				$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what: 'combodatecircuit', dep:$('#destination').val() },
							success: function(msg){
								if(msg.length>0)
								{
									if(document.all) $('#cbdate').empty().append(msg);
									else $('#cbdate').empty().append(msg).selectOptions();
								}
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodepartcircuit',  dest:$('#destination').val(),date:$('#cbdate').val()},
						success: function(msg){
							if(msg.length>0)
							{
								if(document.all) $('#depart').empty().append(msg);
								else $('#depart').empty().append(msg).selectOptions();
							}
						 },
									error: function(msg){//Erreur s'il y a un probleme su le combo depart
										//alert(msg);
										$("#depart").attr("disabled","true");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo date 
									//alert(msg);
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","true");
									}
							});
				
				//Si on change la combo destination:Champ modifié==>Combo depart,Combo date,Combo jour
				$('#destination').change( 
					function(dep)
					{
						$('#recherche').css("display","none");	
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo depart
						//alert("ici");
						$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: {what: 'combodatecircuit', dep:$('#destination').val() },
									success: function(msg){
										if(msg.length>0)
										{
											if(document.all) $('#cbdate').empty().append(msg);
											else $('#cbdate').empty().append(msg).selectOptions();
										}
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepartcircuit', dest: $('#destination').val(),date:$('#cbdate').val() },
							success: function(msg){
								if(msg.length>0)
								{
									if(document.all) $('#depart').empty().append(msg);
									else $('#depart').empty().append(msg).selectOptions();
								}
							},
									error:function(msg){
										//alert('erreur 333');
										$("#depart").attr("disabled","true");
									//	$("#cbdate").attr("disabled","true");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
								//	$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
				
				
				//Si on change la combo de depart: Champ modifié ==>Combo date,Combo jour
				$('#cbdate').change(
					function(date)
					{
						$('#recherche').css("display","none");
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo date
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: { what: 'combodepartcircuit', dest: $('#destination').val(),date:$('#cbdate').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#depart').empty().append(msg);
										else $('#depart').empty().append(msg).selectOptions();
									}
														
						  		},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
			},
			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","true");
				$("#depart").attr("disabled","true");
				$("#cbdate").attr("disabled","true");
				//$("#jour").attr("disabled","true");
			}
			   
		});
		
		
	}//fin radio
	$('#formmoteur').attr("action","./liste_circuit.php");	
	});//fin radio
		
		
	
		
		$('#sejour:radio').click(
					
			
			function (){
				$('#recherche').css("display","none");
				$('.loading').css("display","block");
		//$('#formmoteur').attr("action","./liste_sejour.php");
		if($('#sejour').val()=="sejour_es")
			$('#txt_recherche').empty().append('BÚSQUEDA DE ESTANCIAS');
		else if($('#sejour').val()=="sejour_it")
			$('#txt_recherche').empty().append('RICERCA DI SOGGIORNI');
		else
			$('#txt_recherche').empty().append('RECHERCHE DE SEJOURS');
		
		//alert($('#sejour').val());
		//$('#sejour').attr("value","sejour");
		type=$('#sejour').val();
		//type="sejour";
		//var transDNSValue = $("'#sejour':checked").val();	
	 //if($("input[@id='sejour']:checked").val()=="circuit")
		if($('#sejour').val()=="sejour" || $('#sejour').val()=="sejour_es" || $('#sejour').val()=="sejour_it" || $('#sejour').val()=="sejour_fr")
		//if(type=="sejour")
		{
			//alert($('#sejour').val());
		//charge dynamiquement le combo dest de moteur
		$.ajax({
			type: "POST",
			url: 'proxy.php',
			data: {what:'combodestination',id_pays:id_pays},
			success: function(msg){
				if(msg.length>0)
				{
					if(document.all) $('#destination').empty().append(msg);
					else $('#destination').empty().append(msg).selectOptions(id_pays);
				}
	
				//charge du combo DEPART lors de l'affichage de la page en fonction de la destination (pays)
				$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodate', dep:$('#destination').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions();
									}
					
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodepart',  dest:$('#destination').val(),date:$('#cbdate').val()},
						success: function(msg){
							if(msg.length>0)
							{
								if(document.all) $('#depart').empty().append(msg);
								else $('#depart').empty().append(msg).selectOptions();
							}
						 },
									error: function(msg){//Erreur s'il y a un probleme su le combo date
										//alert(msg);
										$("#depart").attr("disabled","true");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","true");
									}
							});
				
				//Si on change la combo destination:Champ modifié==>Combo depart,Combo date,Combo jour
				$('#destination').change( 
					function(dep)
					{
						$('#recherche').css("display","none");	
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo depart
						$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: {what: 'combodate', dep:$('#destination').val() },
									success: function(msg){
										if(msg.length>0)
										{
											if(document.all) $('#cbdate').empty().append(msg);
											else $('#cbdate').empty().append(msg).selectOptions();
										}
										
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepart', dest: $('#destination').val(),date:$('#cbdate').val() },
							success: function(msg){
								if(msg.length>0)
								{
									if(document.all) $('#depart').empty().append(msg);
									else $('#depart').empty().append(msg).selectOptions();
								}
							},
									error:function(msg){
										//alert('erreur 333');
										//$("#destination").attr("disabled","true");
										$("#depart").attr("disabled","true");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
				
				
				//Si on change la combo de depart: Champ modifié ==>Combo date,Combo jour
				$('#cbdate').change(
					function(date)
					{
						$('#recherche').css("display","none");	
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo date
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: { what: 'combodepart', dest: $('#destination').val(),date:$('#cbdate').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#depart').empty().append(msg);
										else $('#depart').empty().append(msg).selectOptions();
									}
						},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
				},
			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","true");
				$("#depart").attr("disabled","true");
				$("#cbdate").attr("disabled","true");
				//$("#jour").attr("disabled","true");
			}
			   
		});
		
		
	}//fin radio
	$('#formmoteur').attr("action","./liste_sejour.php");
	});//fin radion
		
	//WEEK END	
	//if($('#sejour:radio').is(':checked'))
		
		$('#weekend:radio').click(
					
			/*function (){
				alert("RECHERCHE NON DISPONIBLE \nWEEK END!!");
				if(type=='sejour')
					$('#sejour').attr("checked","checked");
				else
					$('#circuit').attr("checked","checked");*/
		function (){
				$('#recherche').css("display","none");
				$('.loading').css("display","block");
		//$('#formmoteur').attr("action","./liste_sejour.php");
		if($('#weekend').val()=="weekend_es")
			$('#txt_recherche').empty().append('BÚSQUEDA DE FINAL DE SEMANA');
		else if($('#weekend').val()=="weekend_it")
			$('#txt_recherche').empty().append('RICERCA DI WEEK-END');
		else
			$('#txt_recherche').empty().append('RECHERCHE DE WEEK-ENDS');
		//alert($('#weekend').val());
		//$('#sejour').attr("value","weekend");
		type=$('#weekend').val();
		//type="weekend";
		//var transDNSValue = $("'#sejour':checked").val();	
	 //if($("input[@id='sejour']:checked").val()=="circuit")
		if($('#weekend').val()=="weekend" || $('#weekend').val()=="weekend_es" || $('#weekend').val()=="weekend_it" || $('#weekend').val()=="weekend_fr")
		//if(type=="weekend")
		{
			//alert($('#sejour').val());
		//charge dynamiquement le combo dest de moteur
		$.ajax({
			type: "POST",
			url: 'proxy.php',
			data: {what:'combodestination_week_end',id_pays:id_pays},
			success: function(msg){
				
			if(msg=='pasderesultat')
			{
					if($('#weekend').val()=="weekend_it")
						alert("RICERCA NON DISPONIBILE \nWEEK END!!");
					else if($('#weekend').val()=="weekend_fr")
						alert("RECHERCHE NON DISPONIBLE \nWEEK END!!");
					else
						alert("INVESTIGACIÓN NO DISPONIBLE \nESCAPADAS!!");
					
					if(type=='circuit' || type=='circuit_es' || type=='circuit_it' || type=='circuit_fr')
					{
						$('#circuit').attr("checked","checked");
						if($('#circuit').val()=="circuit_es")
							$('#txt_recherche').empty().append('BÚSQUEDA DE CIRCUITOS');
						else if($('#circuit').val()=="circuit_it")
							$('#txt_recherche').empty().append('RICERCA DI TOURS');
						else
							$('#txt_recherche').empty().append('RECHERCHE DE CIRCUITS');
						
					}
					else
					{
						$('#sejour').attr("checked","checked");
						if($('#sejour').val()=="sejour_es")
							$('#txt_recherche').empty().append('BÚSQUEDA DE ESTANCIAS');
						else if($('#sejour').val()=="sejour_it")
							$('#txt_recherche').empty().append('RICERCA DI SOGGIORNI');
						else
							$('#txt_recherche').empty().append('RECHERCHE DE SEJOURS');
					}
			}
			else
			{
				if(msg.length>0)
				{
					if(document.all) $('#destination').empty().append(msg);
					else $('#destination').empty().append(msg).selectOptions(id_pays);
				}
				
				//charge du combo DEPART lors de l'affichage de la page en fonction de la destination (pays)
				$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodate_week_end', dep:$('#destination').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions();
									}
					
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodepart_week_end',  dest:$('#destination').val(),date:$('#cbdate').val()},
						success: function(msg){
							if(msg.length>0)
							{
								if(document.all) $('#depart').empty().append(msg);
								else $('#depart').empty().append(msg).selectOptions();
							}
						 },
									error: function(msg){//Erreur s'il y a un probleme su le combo date
										//alert(msg);
										$("#depart").attr("disabled","true");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","true");
									}
							});
					
				
				//Si on change la combo destination:Champ modifié==>Combo depart,Combo date,Combo jour
				$('#destination').change( 
					function(dep)
					{
						$('#recherche').css("display","none");	
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo depart
						$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: {what: 'combodate_week_end', dep:$('#destination').val() },
									success: function(msg){
										if(msg.length>0)
										{
											if(document.all) $('#cbdate').empty().append(msg);
											else $('#cbdate').empty().append(msg).selectOptions();
										}
										
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepart_week_end', dest: $('#destination').val(),date:$('#cbdate').val() },
							success: function(msg){
								if(msg.length>0)
								{
									if(document.all) $('#depart').empty().append(msg);
									else $('#depart').empty().append(msg).selectOptions();
								}
							},
									error:function(msg){
										//alert('erreur 333');
										//$("#destination").attr("disabled","true");
										$("#depart").attr("disabled","true");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
				
				
				//Si on change la combo de depart: Champ modifié ==>Combo date,Combo jour
				$('#cbdate').change(
					function(dep)
					{
						$('#recherche').css("display","none");	
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo date
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: { what: 'combodepart_week_end', dest: $('#destination').val(),date:$('#cbdate').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#depart').empty().append(msg);
										else $('#depart').empty().append(msg).selectOptions();
									}
												
						  		},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
			}//Fin else
			},
			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","true");
				$("#depart").attr("disabled","true");
				$("#cbdate").attr("disabled","true");
				//$("#jour").attr("disabled","true");
			}
		
			   
		});
		
		
	}//fin radio
	$('#formmoteur').attr("action","./liste_sejour.php");
	
	});
	
	
		
	//FIN WEEK END
	
		if(type=='sejour' || type=='sejour_es' || type=='sejour_it' || type=='sejour_fr')
		{
			$('#recherche').css("display","none");	
			$('.loading').css("display","block");
			//$('#formmoteur').attr("action","./liste_sejour.php");
			
			if($('#sejour').val()=="sejour_es")
				$('#txt_recherche').empty().append('BÚSQUEDA DE ESTANCIAS');
			else if($('#sejour').val()=="sejour_it")
				$('#txt_recherche').empty().append('RICERCA DI SOGGIORNI');
			else
				$('#txt_recherche').empty().append('RECHERCHE DE SEJOURS');
		$.ajax({
			type: "POST",
			url: 'proxy.php',
			data: {what:'combodestination',id_pays:id_pays},
			success: function(msg){
				if(msg.length>0)
				{
					if(document.all) $('#destination').empty().append(msg);
					else $('#destination').empty().append(msg).selectOptions(id_pays);
				}
	
				//charge du combo DEPART lors de l'affichage de la page en fonction de la destination (pays)
				
					$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodate', dep:$('#destination').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions();
									}
									
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodepart',  dest:$('#destination').val(),date:$('#cbdate').val()},
						success: function(msg){
							if(msg.length>0)
							{
								if(document.all) $('#depart').empty().append(msg);
								else $('#depart').empty().append(msg).selectOptions();
							}
					 },
									error: function(msg){//Erreur s'il y a un probleme su le combo date
										//alert(msg);
										$("#depart").attr("disabled","true");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									$("#cbdate").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									}
							});
				
				//Si on change la combo destination:Champ modifié==>Combo depart,Combo date,Combo jour
				$('#destination').change( 
					function(dep)
					{
						$('#recherche').css("display","none");
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo depart
						
						$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: {what: 'combodate', dep:$('#destination').val() },
									success: function(msg){
										if(msg.length>0)
										{
											if(document.all) $('#cbdate').empty().append(msg);
											else $('#cbdate').empty().append(msg).selectOptions();
										}
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepart', dest:$('#destination').val(),date:$('#cbdate').val() },
							success: function(msg){
								if(msg.length>0)
								{
									if(document.all) $('#depart').empty().append(msg);
									else $('#depart').empty().append(msg).selectOptions();
								}
							},
									error:function(msg){
										//alert('erreur 333');
										//$("#destination").attr("disabled","true");
										$("#depart").attr("disabled","true");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","true");
								//	$("#jour").attr("disabled","true");
								}					
							});
					} );
				
				
				//Si on change la combo de depart: Champ modifié ==>Combo date,Combo jour
				$('#cbdate').change(
					function(date)
					{
						$('#recherche').css("display","none");	
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo date
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: { what: 'combodepart', dest: $('#destination').val(),date:$('#cbdate').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#depart').empty().append(msg);
										else $('#depart').empty().append(msg).selectOptions();
									}
												
						  		},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
			},
			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","true");
				$("#depart").attr("disabled","true");
				$("#cbdate").attr("disabled","true");
				//$("#jour").attr("disabled","true");
			}
			   
							   });
			$('#formmoteur').attr("action","./liste_sejour.php");
		}
		else if(type=='circuit' || type=='circuit_es' || type=='circuit_it' || type=='circuit_fr')
		{
			$('#recherche').css("display","none");	
			$('.loading').css("display","block");
			//$('#formmoteur').attr("action","./liste_circuit.php");	
			if($('#circuit').val()=="circuit_es")
				$('#txt_recherche').empty().append('BÚSQUEDA DE CIRCUITOS');
			else if($('#circuit').val()=="circuit_it")
				$('#txt_recherche').empty().append('RICERCA DI TOURS');
			else
				$('#txt_recherche').empty().append('RECHERCHE DE CIRCUITS');
		$.ajax({
			type: "POST",
			url: 'proxy.php',
			data: {what:'combodestinationcircuit',id_pays:id_pays},
			success: function(msg){
				if(msg.length>0)
				{
					if(document.all) $('#destination').empty().append(msg);
					else $('#destination').empty().append(msg).selectOptions(id_pays);
				}
	
				//charge du combo DEPART lors de l'affichage de la page en fonction de la destination (pays)
				$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodatecircuit', dep:$('#destination').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions();
									}
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodepartcircuit',  dest:$('#destination').val(),date:$('#cbdate').val()},
						success: function(msg){
							if(msg.length>0)
							{
								if(document.all) $('#depart').empty().append(msg);
								else $('#depart').empty().append(msg).selectOptions();
							}
						 },
									error: function(msg){//Erreur s'il y a un probleme su le combo date
										//alert(msg);
										$("#depart").attr("disabled","true");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									$("#cbdate").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									}
							});
				
				//Si on change la combo destination:Champ modifié==>Combo depart,Combo date,Combo jour
				$('#destination').change( 
					function(dep)
					{
						$('#recherche').css("display","none");
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo depart
						
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what: 'combodatecircuit', dep:$('#destination').val() },
							success: function(msg){
								if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions();
									}
										
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepartcircuit', dest:$('#destination').val(), date:$('#cbdate').val() },
							success: function(msg){
								if(msg.length>0)
								{
									if(document.all) $('#depart').empty().append(msg);
									else $('#depart').empty().append(msg).selectOptions();
								}
							},
									error:function(msg){
										//alert('erreur 333');
										//$("#destination").attr("disabled","true");
										$("#depart").attr("disabled","true");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
				
				
				//Si on change la combo de depart: Champ modifié ==>Combo date,Combo jour
				$('#cbdate').change(
					function(dest)
					{
						$('#recherche').css("display","none");
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo date
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: { what: 'combodepartcircuit', dest: $('#destination').val(),date:$('#cbdate').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#depart').empty().append(msg);
										else $('#depart').empty().append(msg).selectOptions();
									}
														
						  		},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
				},
			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","true");
				$("#depart").attr("disabled","true");
				$("#cbdate").attr("disabled","true");
			//	$("#jour").attr("disabled","true");
			}
			   
		});
			
			
		$('#formmoteur').attr("action","./liste_circuit.php");		
		} //FIN ELSE CIRCUIT
		else
		{
			$('#recherche').css("display","none");	
			$('.loading').css("display","block");
			//$('#formmoteur').attr("action","./liste_sejour.php");
			if($('#weekend').val()=="weekend_es")
				$('#txt_recherche').empty().append('BÚSQUEDA DE FINAL DE SEMANA');
			else if($('#weekend').val()=="weekend_it")
				$('#txt_recherche').empty().append('RICERCA DI WEEK-END');
			else
				$('#txt_recherche').empty().append('RECHERCHE DE WEEK-END');
		$.ajax({
			type: "POST",
			url: 'proxy.php',
			data: {what:'combodestination_week_end',id_pays:id_pays},
			success: function(msg){
				if(msg.length>0)
				{
					if(document.all) $('#destination').empty().append(msg);
					else $('#destination').empty().append(msg).selectOptions(id_pays);
				}
	
				//charge du combo DEPART lors de l'affichage de la page en fonction de la destination (pays)
				
					$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodate_week_end', dep:$('#destination').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions();
									}
									
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodepart_week_end',  dest:$('#destination').val(),date:$('#cbdate').val()},
						success: function(msg){
							if(msg.length>0)
							{
								if(document.all) $('#depart').empty().append(msg);
								else $('#depart').empty().append(msg).selectOptions();
							}
						 },
									error: function(msg){//Erreur s'il y a un probleme su le combo date
										//alert(msg);
										$("#depart").attr("disabled","true");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									$("#cbdate").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									}
							});
				
				//Si on change la combo destination:Champ modifié==>Combo depart,Combo date,Combo jour
				$('#destination').change( 
					function(dep)
					{
						$('#recherche').css("display","none");
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo depart
						
						$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: {what: 'combodate_week_end', dep:$('#destination').val() },
									success: function(msg){
										if(msg.length>0)
										{
											if(document.all) $('#cbdate').empty().append(msg);
											else $('#cbdate').empty().append(msg).selectOptions();
										}
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepart_week_end', dest: $('#destination').val(),date:$('#cbdate').val() },
							success: function(msg){
								if(msg.length>0)
								{
									if(document.all) $('#depart').empty().append(msg);
									else $('#depart').empty().append(msg).selectOptions();
								}
							},
									error:function(msg){
										//alert('erreur 333');
										//$("#destination").attr("disabled","true");
										$("#depart").attr("disabled","true");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","true");
								//	$("#jour").attr("disabled","true");
								}					
							});
					} );
				
				
				//Si on change la combo de depart: Champ modifié ==>Combo date,Combo jour
				$('#cbdate').change(
					function(dep)
					{
						$('#recherche').css("display","none");	
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo date
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: { what: 'combodepart_week_end', dest: $('#destination').val(),date:$('#cbdate').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#depart').empty().append(msg);
										else $('#depart').empty().append(msg).selectOptions();
									}
										
						  		},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
				},

			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","true");
				$("#depart").attr("disabled","true");
				$("#cbdate").attr("disabled","true");
				//$("#jour").attr("disabled","true");
			}
			   
							   });
			$('#formmoteur').attr("action","./liste_sejour.php");
	
		}
		//FIN ELSE WEEK_END
		$('#depart').ajaxStop(function(){ 
				//$('#recherche').attr("src","./images/fr/recherche.jpg");
				$('#recherche').css("display","block");
				$('.loading').css("display","none");
				//$('#recherche').attr("disabled","false");
		});
		
	});//***
	} 
	
	

function form_devis_fiche(sejour,date,default_adulte)
{
	
	$(document).ready(function(){
				
				$.ajax({
					type: "POST",
					url: 'proxy.php',
					data: {what:'combovilledepart',sejour:sejour},
					success: function(msg){
					if(msg.length>0)
						{
							if(document.all) $('#id_ville_depart').empty().append(msg);
							else $('#id_ville_depart').empty().append(msg).selectOptions();
						}
				
				$.ajax({
					type: "POST",
					url: 'proxy.php',
					data: {what:'combodepartfiche',sejour:sejour,date:date,id_ville:$('#id_ville_depart').val()},
					success: function(msg){
					if(msg.length>0)
						{
							if(document.all) $('#date_depart').empty().append(msg);
							else $('#date_depart').empty().append(msg).selectOptions();
						}
						
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what:'combochambre' , sejour:sejour , depart:$('#date_depart').val(),id_ville:$('#id_ville_depart').val()},
						success: function(msg){
							if(msg.length>0)
							{
								if(document.all) $('#chambre').empty().append(msg);
								else $('#chambre').empty().append(msg).selectOptions();
							}
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what:'combo_nbr_adulte' , sejour:sejour , depart:$('#date_depart').val(),id_chambre:$("#chambre").val()},
							
							success: function(msg){
								if(msg.length>0)
								{
									
									if(document.all) $('#nbr_adulte').empty().append(msg);
									else $('#nbr_adulte').empty().append(msg).selectOptions(default_adulte);
								}
								$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what:'combotest_enfant' , sejour:sejour , depart:$('#date_depart').val(),id_chambre:$("#chambre").val()},
								success: function(msg){
									if(msg=='existe')
									{
										
										$('#nbr_enfant').css("display","block");
									}
									else
									{
										$('#nbr_enfant').css("display","none");
										//$('#hidden_nbr_enfant').empty().append('<input type="hidden" name="nbr_enfant" value="0" />');	
									}
								},
									error: function(msg){
									//alert(msg);
									$("#nbr_enfant").attr("disabled","true");
									}
									  
								});
							},
							error: function(msg){
							//alert(msg);
							$("#nbr_adulte").attr("disabled","true");
							}
								  
						});
						
						},
						error: function(msg){
						//alert(msg);
						$("#chambre").attr("disabled","true");
						}
							  
					});
					},
						error: function(msg){
						//alert(msg);
						$("#date_depart").attr("disabled","true");
						}
							  
					});
				
				$('#id_ville_depart').change(
					function(id_ville)
					{
						
						$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what:'combodepartfiche',sejour:sejour,date:date,id_ville:$('#id_ville_depart').val()},
						success: function(msg){
							
						if(msg.length>0)
							{
								if(document.all) $('#date_depart').empty().append(msg);
								else $('#date_depart').empty().append(msg).selectOptions();
							}	
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: { what: 'combochambre', sejour:sejour,depart:$('#date_depart').val(),id_ville:$('#id_ville_depart').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#chambre').empty().append(msg);
										else $('#chambre').empty().append(msg).selectOptions();
										
									}
							$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what:'combo_nbr_adulte' , sejour:sejour , depart:$('#date_depart').val(),id_chambre:$("#chambre").val()},
							success: function(msg){
								if(msg.length>0)
								{
									if(document.all) $('#nbr_adulte').empty().append(msg);
									else $('#nbr_adulte').empty().append(msg).selectOptions(default_adulte);
								}
								$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: { what: 'combotest_enfant', sejour:sejour,depart:$('#date_depart').val(),id_chambre:$("#chambre").val() },
									success: function(msg){
										if(msg=='existe')
										{
											
											$('#nbr_enfant').css("display","block");
										}
										else
											$('#nbr_enfant').css("display","none");
									},
									error: function(msg){
									//alert(msg);
									$("#date_depart").attr("disabled","true");
								
									}
							 	});
							},
								error: function(msg){
								//alert(msg);
								$("#nbr_adulte").attr("disabled","true");
								
								}
							 });	
						},
						error: function(msg){
								//alert(msg);
								$("#nbr_adulte").attr("disabled","true");
								
								}
							 });	
						},
							error: function(msg){
							//alert(msg);
							$("#nbr_adulte").attr("disabled","true");
							$("#date_depart").attr("disabled","true");
							$("#chambre").attr("disabled","true");
							}
						});
											 
					});
						
				$('#date_depart').change(
					function(depart)
					{
						//Chargement du nouveau valeur dans combo date
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: { what: 'combochambre', sejour:sejour,depart:$('#date_depart').val(),id_ville:$('#id_ville_depart').val() },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#chambre').empty().append(msg);
										else $('#chambre').empty().append(msg).selectOptions();
										
									}
							$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what:'combo_nbr_adulte' , sejour:sejour , depart:$('#date_depart').val(),id_chambre:$("#chambre").val()},
							success: function(msg){
								if(msg.length>0)
								{
									if(document.all) $('#nbr_adulte').empty().append(msg);
									else $('#nbr_adulte').empty().append(msg).selectOptions(default_adulte);
								}
								$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: { what: 'combotest_enfant', sejour:sejour,depart:$('#date_depart').val(),id_chambre:$("#chambre").val() },
									success: function(msg){
										if(msg=='existe')
										{
											
											$('#nbr_enfant').css("display","block");
										}
										else
											$('#nbr_enfant').css("display","none");
									},
									error: function(msg){
									//alert(msg);
									$("#date_depart").attr("disabled","true");
								
									}
							 	});
							},
								error: function(msg){
								//alert(msg);
								$("#nbr_adulte").attr("disabled","true");
								
								}
							 });	
						},
							error: function(msg){
							//alert(msg);
							$("#nbr_adulte").attr("disabled","true");
							$("#date_depart").attr("disabled","true");
							$("#chambre").attr("disabled","true");
							}
						});
					});
				
				$('#chambre').change(
					function(id_chambre)
					{
						//Chargement du nouveau valeur dans combo date
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: { what:'combo_nbr_adulte' , sejour:sejour , depart:$('#date_depart').val(),id_chambre:$("#chambre").val() },
								success: function(msg){
									
									if(msg.length>0)
									{
										if(document.all) $('#nbr_adulte').empty().append(msg);
										else $('#nbr_adulte').empty().append(msg).selectOptions(default_adulte);
										
									}
								$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: { what: 'combotest_enfant', sejour:sejour,depart:$('#date_depart').val(),id_chambre:$("#chambre").val() },
									success: function(msg){
										if(msg=='existe')
										{
											
											$('#nbr_enfant').css("display","block");
										}
										else
											$('#nbr_enfant').css("display","none");
									},
									error: function(msg){
									//alert(msg);
									$("#nbr_enfant").attr("disabled","true");
								
									}
							 	});
								},
									error: function(msg){
									//alert(msg);
									$("#nbr_adulte").attr("disabled","true");
								
									}
							 });
					});
				},
				error: function(msg){
						//alert(msg);
						$("#date_depart").attr("disabled","true");
						$("#chambre").attr("disabled","true");
						$("#nbr_adulte").attr("disabled","true");
						}
							   
				
				
				});
							   
			  });
	
}
function choix_date_devis_gratuit_sejour(date, sejour,promo,id_ville)
{
	
	$("#date_depart").attr("value",date);
	//$('#nbr_enfant').css("display","none");
	$(document).ready(function(){
			//Chargement du nouveau valeur dans combo date
			$.ajax({
				type: "POST",
				url: 'proxy.php',
				data: { what: 'combovilledepart', sejour:sejour,id_ville:id_ville,promo:promo },
				success: function(msg){
					if(msg.length>0)
					{
						
						if(document.all) $('#id_ville_depart').empty().append(msg);
						else $('#id_ville_depart').empty().append(msg).selectOptions(id_ville);				
					}
			 $.ajax({
				type: "POST",
				url: 'proxy.php',
				data: { what: 'combochambre', sejour:sejour,depart:$('#date_depart').val(),promo:promo,id_ville:id_ville },
				success: function(msg){
					if(msg.length>0)
					{
						if(document.all) $('#chambre').empty().append(msg);
						else $('#chambre').empty().append(msg).selectOptions();				
					}
				$.ajax({
				type: "POST",
				url: 'proxy.php',
				data: { what: 'combotest_enfant', sejour:sejour,depart:$('#date_depart').val(),promo:promo,id_chambre:$("#chambre").val() },
				success: function(msg){
					if(msg=='existe')
					{
						//alert(msg);
						$('#nbr_enfant').css("display","block");
						//if(document.all) $('#chambre').empty().append(msg);
						//else $('#chambre').empty().append(msg).selectOptions();				
					}
					else
						$('#nbr_enfant').css("display","none");
					
				},
				error: function(msg){
					//alert(msg);
					$("#nbr_enfant").attr("disabled","true");
					//$("#chambre").attr("disabled","true");
				}
			});
				},
				error: function(msg){
					//alert(msg);
					$("#date_depart").attr("disabled","true");
					$("#chambre").attr("disabled","true");
				}
			});
		  },
		  error: function(msg){
					//alert(msg);
					$("#id_ville_depart").attr("disabled","true");
					$("#id_ville_depart").attr("disabled","true");
				}
			});
    });
	
}
function choix_date_devis_gratuit_circuit(date,id_circuit)
{
	//$("#date_depart").attr("value",date);
	form_devis_fiche_circuit(id_circuit,date);
}

function choix_option(id_option,type,id)
{
	$("#extension").attr("value",id_option);
	//$('#extension0').attr("checked",id_option);
	//$('#extension1').attr("checked",id_option);
	//$('#extension2').attr("checked",id_option);
	//$('#extension3').attr("checked",id_option);
	//$('#extension4').attr("checked",id_option);
	//$('#extension5').attr("checked",id_option);
	//$('#extension6').attr("checked",id_option);
	
}

function form_devis_fiche_circuit(id_circuit,date)
{
	$(document).ready(function(){
				
			
				$.ajax({
					type: "POST",
					url: 'proxy.php',
					data: {what:'combovillecircuit',id_circuit:id_circuit},
					success: function(msg){
					if(msg.length>0){
							if(document.all) $('#id_ville_depart').empty().append(msg);
							else $('#id_ville_depart').empty().append(msg).selectOptions();
					}
				$.ajax({
					type: "POST",
					url: 'proxy.php',
					data: {what:'combodepartfiche_circuit',id_circuit:id_circuit,date:date},
					success: function(msg){
					if(msg.length>0){
							if(document.all) $('#date_depart').empty().append(msg);
							else $('#date_depart').empty().append(msg).selectOptions(date);
					}
						$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what:'combochambreCircuit',id_circuit:id_circuit,date:$('#date_depart').val(),id_ville:$('#id_ville_depart').val()},
						success: function(msg){
						if(msg.length>0){
								if(document.all) $('#chambre').empty().append(msg);
								else $('#chambre').empty().append(msg).selectOptions();
						}
						
							$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what:'combo_nbr_adulte_circuit' , id_circuit:id_circuit , depart:$('#date_depart').val()},
								
								success: function(msg){
									if(msg.length>0){
										if(document.all) $('#nbr_adulte').empty().append(msg);
										else $('#nbr_adulte').empty().append(msg).selectOptions("2");
									}
							$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: { what: 'combotest_enfant_circuit', id_circuit:id_circuit,depart:$('#date_depart').val() },
									success: function(msg){
										if(msg=='existe')
										{
											
											$('#nbr_enfant').css("display","block");
										}
										else
											$('#nbr_enfant').css("display","none");
									},
									error: function(msg){
									//alert(msg);
									$("#nbr_enfant").attr("disabled","true");
								
									}
							 	});
								
							},
							error: function(msg){
							//alert(msg);
							$("#nbr_adulte").attr("disabled","true");
							}
								  
						});
					},
						error: function(msg){
										//alert(msg);
						$("#chambre").attr("disabled","true");
									
						}
					});
					},
					error: function(msg){
									//alert(msg);
					$("#date_depart").attr("disabled","true");
								
					}
				});
				
				$('#id_ville_depart').change(
					function(id_ville){
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what:'combodepartfiche_circuit',id_circuit:id_circuit,date:date},
							success: function(msg){
							if(msg.length>0){
									if(document.all) $('#date_depart').empty().append(msg);
									else $('#date_depart').empty().append(msg).selectOptions(date);
							}
								$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what:'combochambreCircuit',id_circuit:id_circuit,date:$('#date_depart').val(),id_ville:$('#id_ville_depart').val()},
								success: function(msg){
								if(msg.length>0){
										if(document.all) $('#chambre').empty().append(msg);
										else $('#chambre').empty().append(msg).selectOptions();
								}
								
								$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what:'combo_nbr_adulte_circuit' , id_circuit:id_circuit , depart:$('#date_depart').val()},
							success: function(msg){
								if(msg.length>0){
									if(document.all) $('#nbr_adulte').empty().append(msg);
									else $('#nbr_adulte').empty().append(msg).selectOptions("2");
								}
							$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: { what: 'combotest_enfant_circuit', id_circuit:id_circuit,depart:$('#date_depart').val() },
									success: function(msg){
										if(msg=='existe')
										{
											
											$('#nbr_enfant').css("display","block");
										}
										else
											$('#nbr_enfant').css("display","none");
									},
									error: function(msg){
									//alert(msg);
									$("#nbr_enfant").attr("disabled","true");
								
									}
							 	});
							},
							error: function(msg){
								//alert(msg);
								$("#nbr_adulte").attr("disabled","true");
								
							}
						});
						},
							error: function(msg){
								//alert(msg);
								$("#chambre").attr("disabled","true");
								
							}
						});
								
						},
							error: function(msg){
								//alert(msg);
								$("#date_depart").attr("disabled","true");
								
							}
						});
					
					});
						
				$('#date_depart').change(
					function(depart){
						
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what:'combochambreCircuit',id_circuit:id_circuit,date:$('#date_depart').val(),id_ville:$('#id_ville_depart').val()},
								success: function(msg){
								if(msg.length>0){
										if(document.all) $('#chambre').empty().append(msg);
										else $('#chambre').empty().append(msg).selectOptions();
								}
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what:'combo_nbr_adulte_circuit' , id_circuit:id_circuit , depart:$('#date_depart').val()},
							success: function(msg){
								if(msg.length>0){
									if(document.all) $('#nbr_adulte').empty().append(msg);
									else $('#nbr_adulte').empty().append(msg).selectOptions("2");
								}
							$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: { what: 'combotest_enfant_circuit', id_circuit:id_circuit,depart:$('#date_depart').val() },
									success: function(msg){
										if(msg=='existe')
										{
											
											$('#nbr_enfant').css("display","block");
										}
										else
											$('#nbr_enfant').css("display","none");
									},
									error: function(msg){
									//alert(msg);
									$("#nbr_enfant").attr("disabled","true");
								
									}
							 	});
							},
							error: function(msg){
								//alert(msg);
								$("#nbr_adulte").attr("disabled","true");
								
							}
						});
						},
							error: function(msg){
								//alert(msg);
								$("#chambre").attr("disabled","true");
								
							}
						});
						  		
					  });
					},
					error: function(msg){
							//alert(msg);
							$("#id_ville_depart").attr("disabled","true");
							$("#date_depart").attr("disabled","true");
							$("#nbr_adulte").attr("disabled","true");
							$("#chambre").attr("disabled","true");
					}
								  
					
				});
		});
}

