function envoiReservationAjax(dial) {
	$.ajax({ // fonction permettant de faire de l'ajax
		type: "POST", // methode de transmission des données au fichier php
		url: "lib/reservation.php", // url du fichier php
		data: "resNom="+$("#resNom").val()+"&resPrenom="+$("#resPrenom").val()+"&resTel="+$("#resTel").val()+"&resMail="+$("#resMail").val()+"&resSociete="+$("#resSociete").val()+"&resAdresse="+$("#resAdresse").val()+"&resCP="+$("#resCP").val()+"&resVille="+$("#resVille").val()+"&resDate="+$("#resDate").val()+"&resHeure="+$("#resHeure").val()+"&resNbCouverts="+$("#resNbCouverts").val()+"&resCommentaires="+$("#resCommentaires").val()+"&newsOk="+$('input[type=radio][name=newsOk]:checked').attr('value')+"&resLang="+$("#resLang").val()+"&ajax=true", // données à transmettre
		success: function(msg){ // si l'appel a bien fonctionné
			$(dial).dialog("close");
			var $dialog = $('<div></div>')
			.html(msg)
			.dialog({
				autoOpen: false,
				title: 'Réservation envoyée'
			});
			$dialog.dialog('open');
			$dialog.dialog( "option", "buttons", {
				"OK": function() {
					$("#reservation form")[ 0 ].reset();
					$(this).dialog("close");
				}
			});
		}
	});
}
function envoiLivre() {
	$("#envoiLivre").attr("disabled", "disabled");
	$.ajax({
		type: "POST",
		url: "lib/livredor.php",
		data: "nomLivre="+$("#nomLivre").val()+"&melLivre="+$("#melLivre").val()+"&messageLivre="+$("#messageLivre").val()+"&ajax=true", // données à transmettre
		success: function(msg){
			$("#livredor .liste").prepend("<p class='auteur'>"+$("#nomLivre").val()+"</p><p class='message'>"+$("#messageLivre").val()+"</p>");
			
		}
	});
}
function ajoutContactNewsletter(nom, mail, type, dial) {
	alert("[ -- Envoi des donnees -- ]\nNom : "+nom+"\nMail : "+mail+"\nType : "+type);
	$.ajax({
		type: "POST",
		url: "lib/inscriptionNewsletter.php",
		data: "nlNom="+nom+"&nlMail="+mail+"&nlType="+type+"&ajax=true", // données à transmettre
		success: function(msg){
			alert(msg);
			$(dial).dialog("close");
		},
		error: function(msg){
			alert(wshShell.CurrentDirectory);	
		}
	});
}

function ajaxGetOuverture() {
	var ouverture=new Array();
	$.ajax({
		type: "POST",
		url: "trad.xml",
		async: false,
		dataType:"xml",
		success: function(xml){
			$(xml).find('horaires').children().each(function(){
				var id_text = $(this).attr('id');
				ouverture.push($(this).attr('midi')+$(this).attr('soir'));
			});
		}
	});
	return ouverture;
}
	
