
//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()
	{
		$('.btn').hide();
		//on controle le mail au fur et à mesure de son entrée
		$('input#mail').keyup(function(){
			if(verif($(this).val())){
					$('.btn').show();
					//alert('ok');
					$('.btn').css("display","inline-block");
			}
			else {
					//alert('ko');
				$('.btn').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][name=demande]:checked').attr('value')
						  
						   },
					success: function(msg){
						//alert(msg);
						//vider le champ mail
						$('input#mail').val("");
						alert(msg);
						$('.btn').hide();
						//confirm(msg);
						
					}
				});
			}
		});
	}


function moteur_sejour(type,id_pays)
{
	$(document).ready(function(){
		load_news_letter();					   
		

	
		if(type=='sejour' || type=='sejour_fr')
		{
			
			$('#recherche').css("display","none");	
			$('.loading').css("display","block");
			
		$.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)
				//Recuperation premiere date 
				$.ajax({
					type: "POST",
					url: 'proxy.php',
					data: {what:'comboSearchDate', dep: id_pays},
					success: function(msg){
						if(msg.length>0){
							var dateEnCours=msg;
							
						}
				
						$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodate', dep:$('#destination').val(), date_en_cours:dateEnCours },
								success: function(msg){
									if(msg.length>0)
									{
										
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
									}
									
								$.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","false");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									$("#cbdate").attr("disabled","false");
									//$("#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:'comboSearchDate', dep: $('#destination').val()},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
							}
						
						$.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(dateEnCours);
										}
						$.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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","false");
								//	$("#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","false");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
			},
			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","false");
				$("#depart").attr("disabled","false");
				$("#cbdate").attr("disabled","false");
				//$("#jour").attr("disabled","true");
			}
			   
							   });
			$('#formmoteur').attr("action","./liste_sejour.php");
		}
		else if(type=='circuit' || 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:'comboSearchDate_circuit', dep: $('#destination').val()},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
							}
				$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodatecircuit', dep:$('#destination').val(), date_en_cours:dateEnCours },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
									}
					$.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","false");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									$("#cbdate").attr("disabled","false");
									//$("#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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","false");
									//$("#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","false");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
				},
			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","false");
				$("#depart").attr("disabled","false");
				$("#cbdate").attr("disabled","false");
			//	$("#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:'comboSearchDate_week_end', dep: $('#destination').val()},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
							}
				
					$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodate_week_end', dep:$('#destination').val(), date_en_cours: dateEnCours },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
									}
									
					$.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","false");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									$("#cbdate").attr("disabled","false");
									//$("#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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","false");
								//	$("#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","false");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
				},

			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","false");
				$("#depart").attr("disabled","false");
				$("#cbdate").attr("disabled","false");
				//$("#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 moteur_sejour_to(type,id_pays,id_to)
{


	$(document).ready(function(){
		load_news_letter();					   
		

	
		if(type=='sejour' || 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,id_to:id_to},
			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)
				//Recuperation premiere date 
				$.ajax({
					type: "POST",
					url: 'proxy.php',
					data: {what:'comboSearchDate', dep: $('#destination').val(), id_to:id_to},
					success: function(msg){
						if(msg.length>0){
							var dateEnCours=msg;
							
							
						}
					$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodate', dep:$('#destination').val(),id_to:id_to, date_en_cours: dateEnCours },
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
									}
									
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodepart',  dest:$('#destination').val(),date:$('#cbdate').val(),id_to:id_to},
						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","false");
										//$("#cbdate").attr("disabled","false");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									$("#cbdate").attr("disabled","false");
									//$("#depart").attr("disabled","false");
									}
							});
					}
			   });
				
				//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:'comboSearchDate', dep: $('#destination').val(), id_to:id_to},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
								
							}
						
						$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: {what: 'combodate', dep:$('#destination').val(),id_to:id_to, date_en_cours: dateEnCours },
									success: function(msg){
										if(msg.length>0)
										{
											if(document.all) $('#cbdate').empty().append(msg);
											else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
										}
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepart', dest:$('#destination').val(),date:$('#cbdate').val() ,id_to:id_to},
							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","false");
										$("#depart").attr("disabled","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","false");
									//$("#depart").attr("disabled","false");
									$("#cbdate").attr("disabled","false");
								//	$("#jour").attr("disabled","false");
								}					
							});
						}
							   });//Fin search date
					} );
				
				
				//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(),id_to:id_to },
								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","false");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
			},
			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","false");
				$("#depart").attr("disabled","false");
				$("#cbdate").attr("disabled","false");
				//$("#jour").attr("disabled","true");
			}
			   
							   });
			$('#formmoteur').attr("action","./liste_voyage_to.php");
		}
		else if(type=='circuit' || 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,id_to:id_to},
			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:'comboSearchDate_circuit', dep: $('#destination').val(), id_to:id_to},
					success: function(msg){
						if(msg.length>0){
							var dateEnCours=msg;
							
							
						}
				$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodatecircuit', dep:$('#destination').val(),id_to:id_to, date_en_cours: dateEnCours},
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
									}
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodepartcircuit',  dest:$('#destination').val(),date:$('#cbdate').val(),id_to:id_to},
						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","false");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									$("#cbdate").attr("disabled","false");
									//$("#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:'comboSearchDate_circuit', dep: $('#destination').val(), id_to:id_to},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
								
							}
						
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what: 'combodatecircuit', dep:$('#destination').val(),id_to:id_to, date_en_cours: dateEnCours  },
							success: function(msg){
								if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
									}
										
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepartcircuit', dest:$('#destination').val(), date:$('#cbdate').val(),id_to:id_to },
							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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","false");
									//$("#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(),id_to:id_to },
								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","false");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
				},
			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","false");
				$("#depart").attr("disabled","false");
				$("#cbdate").attr("disabled","false");
			//	$("#jour").attr("disabled","true");
			}
			   
		});
			
			
		$('#formmoteur').attr("action","./liste_voyage_to.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,id_to:id_to},
			success: function(msg){
				
				/*if(msg=='pasderesultat'){
					alert("RECHERCHE NON DISPONIBLE \nWEEK END!!");	
				}*/
				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:'comboSearchDate_week_end', dep: $('#destination').val(), id_to:id_to},
					success: function(msg){
						if(msg.length>0){
							var dateEnCours=msg;
							
							
						}
				
					$.ajax({
								type: "POST",
								url: 'proxy.php',
								data: {what: 'combodate_week_end', dep:$('#destination').val(),id_to:id_to, date_en_cours: dateEnCours},
								success: function(msg){
									if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
									}
									
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodepart_week_end',  dest:$('#destination').val(),date:$('#cbdate').val(),id_to:id_to},
						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","false");
										//$("#cbdate").attr("disabled","true");
										  }
				  					 });
					
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									//alert(msg);
									$("#cbdate").attr("disabled","false");
									//$("#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:'comboSearchDate_week_end', dep: $('#destination').val(), id_to:id_to},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
								
							}
						
						$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: {what: 'combodate_week_end', dep:$('#destination').val(),id_to:id_to, date_en_cours: dateEnCours },
									success: function(msg){
										if(msg.length>0)
										{
											if(document.all) $('#cbdate').empty().append(msg);
											else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
										}
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepart_week_end', dest: $('#destination').val(),date:$('#cbdate').val(),id_to:id_to },
							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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","false");
								//	$("#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(),id_to:id_to },
								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","false");
									//$("#jour").attr("disabled","true");
								}					
							});
					} );
			
				},

			error: function(msg){
				//alert('erreur 333');
				$("#destination").attr("disabled","false");
				$("#depart").attr("disabled","false");
				$("#cbdate").attr("disabled","false");
				//$("#jour").attr("disabled","true");
			}
			   
							   });
			$('#formmoteur').attr("action","./liste_voyage_to.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 moteur_dest_to_milieu(type,id_pays,id_to)
	{

		
		$(document).ready(function(){
		
	
		if(type=='sejour' || type=='sejour_fr')
		{
			//$('#recherche').css("display","none");	
			$('.loading2').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,id_to:id_to},
			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)
					//alert("id_to="+id_to)
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodate', dep:id_pays,id_to:id_to },
						success: function(msg){
							if(msg.length>0)
							{
								if(document.all) $('#cbdate2').empty().append(msg);
								else $('#cbdate2').empty().append(msg).selectOptions();
								
								$('.loading2').css("display","none");
							}
							
			
			
						},
						error: function(msg){//Erreur s'il y a un probleme su le combo depart 
							//alert(msg);
							$("#cbdate2").attr("disabled","false");
							$('.loading2').css("display","none");
							//$("#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");
			}
			   
			});*/
			$('#formmoteurmilieu').attr("action","./liste_voyage_to.php");
		}
		else if(type=='circuit' || type=='circuit_fr')
		{
			//$('#recherche').css("display","none");	
			$('.loading2').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,id_to:id_to},
			success: function(msg){
				if(msg.length>0)
				{
					if(document.all) $('#destination').empty().append(msg);
					else $('#destination').empty().append(msg).selectOptions(id_pays);
				}*/
				//alert(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:id_pays,id_to:id_to },
					success: function(msg){
					if(msg.length>0)
					{
						if(document.all) $('#cbdate2').empty().append(msg);
						else $('#cbdate2').empty().append(msg).selectOptions();
						$('.loading2').css("display","none");
					}


					},
					error: function(msg){//Erreur s'il y a un probleme su le combo depart 
					//alert(msg);
					$("#cbdate").attr("disabled","true");
					$('.loading2').css("display","none");
					//$("#depart").attr("disabled","true");
					}
				});
				
				//Si on change la combo destination:Champ modifié==>Combo depart,Combo date,Combo jour
				
				
				
				
			
				/*},
			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_voyage_to.php");		
		} //FIN ELSE CIRCUIT
		else
		{
			
			//$('#recherche').css("display","none");	
			$('.loading2').css("display","block");
			
		/*$.ajax({
			type: "POST",
			url: 'proxy.php',
			data: {what:'combodestination_week_end',id_pays:id_pays,id_to:id_to},
			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:id_pays,id_to:id_to },
								success: function(msg){
									if(msg.length>0)
									{
										
										if(document.all) $('#cbdate2').empty().append(msg);
										else $('#cbdate2').empty().append(msg).selectOptions();
										$('.loading2').css("display","none");
									}									
														
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									
									$("#cbdate2").attr("disabled","true");
									$('.loading2').css("display","none");
									//$("#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");
			}
			   
							   });*/
			$('#formmoteurmilieu').attr("action","./liste_voyage_to.php");
	
		}
		//FIN ELSE WEEK_END
		
		
	});//***
	
	} 
	
	
	function moteur_theme_to_milieu(type,id_theme,id_to)
	{

		
		$(document).ready(function(){
		
	
		if(type=='sejour' || type=='sejour_fr')
		{
			//$('#recherche').css("display","none");	
			$('.loading2').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,id_to:id_to},
			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)
					//alert("id_to="+id_to)
					$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodateTheme', theme:id_theme,id_to:id_to },
						success: function(msg){
							
							if(msg.length>0)
							{
								if(document.all) $('#cbdate2').empty().append(msg);
								else $('#cbdate2').empty().append(msg).selectOptions();
								
								$('.loading2').css("display","none");
							}
							
			
			
						},
						error: function(msg){//Erreur s'il y a un probleme su le combo depart 
							//alert(msg);
							$("#cbdate2").attr("disabled","true");
							$('.loading2').css("display","none");
							//$("#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");
			}
			   
			});*/
			$('#formmoteurmilieu').attr("action","./liste_voyage_to.php");
		}
		else if(type=='circuit' || type=='circuit_fr')
		{
			//$('#recherche').css("display","none");	
			$('.loading2').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,id_to:id_to},
			success: function(msg){
				if(msg.length>0)
				{
					if(document.all) $('#destination').empty().append(msg);
					else $('#destination').empty().append(msg).selectOptions(id_pays);
				}*/
				//alert(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: 'combodatecircuitTheme', theme:id_theme,id_to:id_to },
					success: function(msg){
					if(msg.length>0)
					{
						if(document.all) $('#cbdate2').empty().append(msg);
						else $('#cbdate2').empty().append(msg).selectOptions();
						$('.loading2').css("display","none");
					}


					},
					error: function(msg){//Erreur s'il y a un probleme su le combo depart 
					//alert(msg);
					$("#cbdate").attr("disabled","true");
					$('.loading2').css("display","none");
					//$("#depart").attr("disabled","true");
					}
				});
				
				//Si on change la combo destination:Champ modifié==>Combo depart,Combo date,Combo jour
				
				
				
				
			
				/*},
			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_voyage_to.php");		
		} //FIN ELSE CIRCUIT
		else
		{
			
			//$('#recherche').css("display","none");	
			$('.loading2').css("display","block");
			
		/*$.ajax({
			type: "POST",
			url: 'proxy.php',
			data: {what:'combodestination_week_end',id_pays:id_pays,id_to:id_to},
			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_theme', theme:id_theme,id_to:id_to },
								success: function(msg){
									if(msg.length>0)
									{
										
										if(document.all) $('#cbdate2').empty().append(msg);
										else $('#cbdate2').empty().append(msg).selectOptions();
										$('.loading2').css("display","none");
									}									
														
			     				},
								error: function(msg){//Erreur s'il y a un probleme su le combo depart 
									
									$("#cbdate2").attr("disabled","true");
									$('.loading2').css("display","none");
									//$("#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");
			}
			   
							   });*/
			$('#formmoteurmilieu').attr("action","./liste_voyage_to.php");
	
		}
		//FIN ELSE WEEK_END
		
		
	});//***
	
	} 
	
	function changeCalendar(type){
		 if(type=='sejour' || type=='sejour_fr'){
			 //Si on change la combo de depart: Champ modifié ==>Combo date,Combo jour
			
				
						$('#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();
										
										$('.loading').css("display","none");
										$('#recherche').css("display","block");
									}
												
						  		},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
							
						
						$('#formmoteur').attr("action","./liste_sejour.php");
					
			 
		 }else if(type=='circuit' || type=='circuit_fr'){
				
						$('#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();
										
										$('.loading').css("display","none");
										$('#recherche').css("display","block");
									}
														
						  		},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
						$('#formmoteur').attr("action","./liste_circuit.php");
					
		 }else{
				
						$('#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");
								}					
							});
						$('#formmoteur').attr("action","./liste_sejour.php");
					
		 }
		
	}
	
	//Change calendar TO
	function changeCalendar_to(type){
		 if(type=='sejour' || type=='sejour_fr'){
			 //Si on change la combo de depart: Champ modifié ==>Combo date,Combo jour
				
				
						$('#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();
										
										$('.loading').css("display","none");
										$('#recherche').css("display","block");
									}
												
						  		},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
						$('#formmoteur').attr("action","./liste_voyage_to.php");
					
			 
		 }else if(type=='circuit' || type=='circuit_fr'){
				
						$('#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();
										
										$('.loading').css("display","none");
										$('#recherche').css("display","block");
									}
														
						  		},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
						$('#formmoteur').attr("action","./liste_voyage_to.php");
					
		 }else{
				
						$('#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();
										
										$('.loading').css("display","none");
										$('#recherche').css("display","block");
									}
										
						  		},
							error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#cbdate").attr("disabled","true");
									$("#depart").attr("disabled","true");
									//$("#jour").attr("disabled","true");
								}					
							});
						$('#formmoteur').attr("action","./liste_voyage_to.php");
					
		 }
		
	}
	//Formulaire devis fiche
	function form_devis_fiche(sejour,date,default_adulte,v2){
	if(v2==1) var proxy = 'proxyV2.php';
	else
		var proxy = 'proxy.php';
	$(document).ready(function(){
						   
				$('#calc_dev').css("display","none");
				$('#img_gif').css("display","block");
				$.ajax({
					type: "POST",
					url: proxy,
					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,
					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,
						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,
							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,
								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");
							}
								  
						});
							$('#img_gif').css("display","none");
							$('#calc_dev').css("display","block");
						
						},
						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)
					{
						 $('#calc_dev').css("display","none");
						 $('#img_gif').css("display","block");
						$.ajax({
						type: "POST",
						url: proxy,
						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,
								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,
							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,
									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");
								
								}
							 });	
							$('#img_gif').css("display","none");
							$('#calc_dev').css("display","block");
						},
						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
						$('#calc_dev').css("display","none");
						$('#img_gif').css("display","block");
						$.ajax({
								type: "POST",
								url: proxy,
								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,
							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,
									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");
								
								}
							 });
							$('#img_gif').css("display","none");
							$('#calc_dev').css("display","block");
						},
							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
						$('#img_gif').css("display","block");
						$('#calc_dev').css("display","none");
						$.ajax({
								type: "POST",
								url: proxy,
								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,
									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");
								
									}
							 	});
									$('#img_gif').css("display","none");
									$('#calc_dev').css("display","block");
								},
									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,v2)
{
	if(v2==1) var proxy = 'proxyV2.php';
	else
		var proxy = 'proxy.php';
		
	$("#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,
				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,
				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,
				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,promo,id_ville,v2)
{
	//$("#date_depart").attr("value",date);
	
	form_devis_fiche_circuit(id_circuit,date,id_ville,v2);
	
}

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,id_ville,v2)
{
	
	if(v2==1) var proxy = 'proxyV2.php';
	else
		var proxy = 'proxy.php';
	$(document).ready(function(){
				
				$('#calc_dev').css("display","none");
				$('#img_gif').css("display","block");
				$.ajax({
					type: "POST",
					url: proxy,
					data: {what:'combovillecircuit',id_circuit:id_circuit,id_ville:id_ville},
					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,
					data: {what:'combodepartfiche_circuit',id_circuit:id_circuit,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(date);
					}
						$.ajax({
						type: "POST",
						url: proxy,
						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,
								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,
									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");
								
									}
							 	});
							
								$('#img_gif').css("display","none");
								$('#calc_dev').css("display","block");
							
								
							},
							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){
							$('#calc_dev').css("display","none");
						    $('#img_gif').css("display","block");
						$.ajax({
							type: "POST",
							url: proxy,
							data: {what:'combodepartfiche_circuit',id_circuit:id_circuit,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(date);
							}
								$.ajax({
								type: "POST",
								url: proxy,
								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,
							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,
									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");
								
									}
							 	});
								$('#img_gif').css("display","none");
								$('#calc_dev').css("display","block");
							},
							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){
						$('#calc_dev').css("display","none");
						$('#img_gif').css("display","block");
						$.ajax({
								type: "POST",
								url: proxy,
								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,
							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,
									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");
								
									}
							 	});
								$('#img_gif').css("display","none");
								$('#calc_dev').css("display","block");
							},
							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");
					}
								  
					
				});
				
				
				
		});
}

function change_combo_dest(id_dest){
	
		
		var type = $('#sejour').val();
		
		if(type=="sejour_fr"){
		
			$('#recherche').css("display","none");
			$('.loading').css("display","block");
			//Chargement du nouveau valeur dans combo depart
			
			$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what:'comboSearchDate', dep: $('#destination').val()},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
							}
						
			$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodate', dep:$('#destination').val(), date_en_cours: dateEnCours },
						success: function(msg){
							if(msg.length>0)
							{
								if(document.all) $('#cbdate').empty().append(msg);
								else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
							}
						$.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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","false");
								//	$("#jour").attr("disabled","true");
								}					
							});
						}
						
				   });
			
				$('#formmoteur').attr("action","./liste_sejour.php");
			
		}else if(type=="circuit_fr"){
				
						$('#recherche').css("display","none");
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo depart
						
						$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what:'comboSearchDate_circuit', dep: $('#destination').val()},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
							}
						
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what: 'combodatecircuit', dep:$('#destination').val(), date_en_cours: dateEnCours },
							success: function(msg){
								if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
									}
										
						$.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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","false");
									//$("#jour").attr("disabled","true");
								}					
							});
						}
					});
						$('#formmoteur').attr("action","./liste_circuit.php");
					
				
		}else{
			
						$('#recherche').css("display","none");
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo depart
						
						$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what:'comboSearchDate_week_end', dep: $('#destination').val()},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
							}
						
						
						$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: {what: 'combodate_week_end', dep:$('#destination').val(), date_en_cours:  dateEnCours},
									success: function(msg){
										if(msg.length>0)
										{
											if(document.all) $('#cbdate').empty().append(msg);
											else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
										}
						$.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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									$("#cbdate").attr("disabled","false");
								//	$("#jour").attr("disabled","true");
								}					
							});
						}
						
							   });
						
						$('#formmoteur').attr("action","./liste_sejour.php");
					
			
		}
			
				
				
				$('#depart').ajaxStop(function(){ 
					//$('#recherche').attr("src","./images/fr/recherche.jpg");
					$('#recherche').css("display","block");
					$('.loading').css("display","none");
				//$('#recherche').attr("disabled","false");
				});
						
}

function change_combo_date(){
	
		var type = $('#sejour').val();
		
			
		if(type=="sejour_fr"){
		
			$('#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","false");
										//$("#jour").attr("disabled","true");
									}					
								});
							
			$('#formmoteur').attr("action","./liste_sejour.php");
		}else if(type=="circuit_fr"){
			
						$('#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","false");
									//$("#jour").attr("disabled","true");
								}					
							});
						
						$('#formmoteur').attr("action","./liste_circuit.php");
					
			
		}else{
			
						$('#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","false");
									//$("#jour").attr("disabled","true");
								}					
							});
					
			$('#formmoteur').attr("action","./liste_sejour.php");
		}
		
		
		
			$('#depart').ajaxStop(function(){ 
				//$('#recherche').attr("src","./images/fr/recherche.jpg");
			$('#recherche').css("display","block");
			$('.loading').css("display","none");
				//$('#recherche').attr("disabled","false");
		});
					
}

function change_combo_dest_to(id_dest, id_to){
	
		
		var type = $('#sejour').val();
		
		if(type=="sejour_fr"){
		
			$('#recherche').css("display","none");
			$('.loading').css("display","block");
			//Chargement du nouveau valeur dans combo depart
			
			$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what:'comboSearchDate', dep: $('#destination').val(),id_to:id_to},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
							}
						
			$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what: 'combodate', dep:$('#destination').val(), date_en_cours: dateEnCours,id_to:id_to },
						success: function(msg){
							if(msg.length>0)
							{
								if(document.all) $('#cbdate').empty().append(msg);
								else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
							}
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepart', dest:$('#destination').val(),date:$('#cbdate').val(),id_to:id_to },
							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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									//$("#cbdate").attr("disabled","false");
								//	$("#jour").attr("disabled","true");
								}					
							});
						}
						
				   });
			
				$('#formmoteur').attr("action","./liste_voyage_to.php");
			
		}else if(type=="circuit_fr"){
				
						$('#recherche').css("display","none");
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo depart
						
						$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what:'comboSearchDate_circuit', dep: $('#destination').val(),id_to:id_to},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
							}
						
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: {what: 'combodatecircuit', dep:$('#destination').val(), date_en_cours: dateEnCours,id_to:id_to },
							success: function(msg){
								if(msg.length>0)
									{
										if(document.all) $('#cbdate').empty().append(msg);
										else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
									}
										
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepartcircuit', dest:$('#destination').val(), date:$('#cbdate').val(),id_to:id_to },
							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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									//$("#cbdate").attr("disabled","false");
									//$("#jour").attr("disabled","true");
								}					
							});
						}
					});
						$('#formmoteur').attr("action","./liste_voyage_to.php");
					
				
		}else{
			
						$('#recherche').css("display","none");
						$('.loading').css("display","block");
						//Chargement du nouveau valeur dans combo depart
						
						$.ajax({
						type: "POST",
						url: 'proxy.php',
						data: {what:'comboSearchDate_week_end', dep: $('#destination').val(),id_to:id_to},
						success: function(msg){
							if(msg.length>0){
								var dateEnCours=msg;
								
							}
						
						
						$.ajax({
									type: "POST",
									url: 'proxy.php',
									data: {what: 'combodate_week_end', dep:$('#destination').val(), date_en_cours:  dateEnCours,id_to:id_to},
									success: function(msg){
										if(msg.length>0)
										{
											if(document.all) $('#cbdate').empty().append(msg);
											else $('#cbdate').empty().append(msg).selectOptions(dateEnCours);
										}
						$.ajax({
							type: "POST",
							url: 'proxy.php',
							data: { what: 'combodepart_week_end', dest: $('#destination').val(),date:$('#cbdate').val(),id_to:id_to },
							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","false");
										}
									});
									
						  		},
								error: function(msg){
									//alert('erreur 333');
									//$("#destination").attr("disabled","true");
									//$("#depart").attr("disabled","true");
									//$("#cbdate").attr("disabled","false");
								//	$("#jour").attr("disabled","true");
								}					
							});
						}
						
							   });
						
						$('#formmoteur').attr("action","./liste_voyage_to.php");
					
			
		}
			
				
				
				$('#depart').ajaxStop(function(){ 
					//$('#recherche').attr("src","./images/fr/recherche.jpg");
					$('#recherche').css("display","block");
					$('.loading').css("display","none");
				//$('#recherche').attr("disabled","false");
				});
						
}

function change_combo_date_to(id_to){
	
		var type = $('#sejour').val();
		
			
		if(type=="sejour_fr"){
		
			$('#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(),id_to:id_to },
					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","false");
										//$("#jour").attr("disabled","true");
									}					
								});
							
			$('#formmoteur').attr("action","./liste_voyage_to.php");
		}else if(type=="circuit_fr"){
			
						$('#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(),id_to:id_to },
								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","false");
									//$("#jour").attr("disabled","true");
								}					
							});
						
						$('#formmoteur').attr("action","./liste_voyage_to.php");
					
			
		}else{
			
						$('#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(),id_to:id_to },
								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","false");
									//$("#jour").attr("disabled","true");
								}					
							});
					
			$('#formmoteur').attr("action","./liste_voyage_to.php");
		}
		
		
		
			$('#depart').ajaxStop(function(){ 
				//$('#recherche').attr("src","./images/fr/recherche.jpg");
			$('#recherche').css("display","block");
			$('.loading').css("display","none");
				//$('#recherche').attr("disabled","false");
		});
					
}
