$(document).ready(function(){
	
	$(".module_reservation").each(function(){
		moduleReservation=$(this);
		var selectThematique=moduleReservation.find("select[name=thematique]");
		var selectForfait=moduleReservation.find("select[name=FSTBKNGCode]");
		var selectYear=moduleReservation.find("select[name=fromYear]");
		var btnSubmit=moduleReservation.find("input[type=button]");
		selectThematique.change(function(){
			$.post("ajax/module_reservation.php",{update:"forfait",val:selectThematique.val()},function(response){
				selectForfait.html(response);
			});
		});
		
		selectForfait.change(function(){
			
			$.post("ajax/module_reservation.php",{update:"thematique",val:selectForfait.val()},function(id){
				selectThematique.children("option[value="+id+"]").attr("selected","selected")
			});
			if(selectForfait.val()!=0){

				$.post("ajax/module_reservation.php",{update:"action",val:selectForfait.val()},function(url){
					
					if(url!=''){
						moduleReservation.attr("action",url+'.html');
						moduleReservation.removeAttr("target");
						moduleReservation.submit();
					}
				});
			}
		});
		
		selectYear.click(function(){
			update_departure();
		});
		
		btnSubmit.click(function(){
			hhotelDispoprice(this.form);
			
		});
		
		
		
		
	});
	
	
	
});