/* Fonction qui lance le traitement ajax FR */
function ajaxContactFr() {
	/* Nouvel objet jQuery Ajax */
	$.ajax({
		type : 'POST',
		url : 'inc/sendmail.php',
		timeout : 10000,
		data : 'lang=fr&prenom='+escape($('#contact_prenom').val())+'&'+'nom='+escape($('#contact_nom').val())+'&'+'mail='+escape($('#contact_mail').val())+'&'+'message='+escape($('#contact_message').val()),
		dataType : 'xml',
		beforeSend : function() { $('#retourAjax').html('Chargement en cours...'); },
		success : retourAjaxContact,
		error : function() { $('#retourAjax').html('Une erreur s\'est produite au cours de l\'envoi du message !'); }
	});
	return;
}

/* Fonction qui lance le traitement ajax EN */
function ajaxContactEn() {
	/* Nouvel objet jQuery Ajax */
	$.ajax({
		type : 'POST',
		url : '../inc/sendmail.php',
		timeout : 10000,
		data : 'lang=en&prenom='+escape($('#contact_prenom').val())+'&'+'nom='+escape($('#contact_nom').val())+'&'+'mail='+escape($('#contact_mail').val())+'&'+'message='+escape($('#contact_message').val()),
		dataType : 'xml',
		beforeSend : function() { $('#retourAjax').html('Loading in progress...'); },
		success : retourAjaxContact,
		error : function() { $('#retourAjax').html('An error occurred during sending the message !'); }
	});
	return;
}

function retourAjaxContact(reponse) {
	var root = $(reponse).find('contact');
	$('#retourAjax').html(root.find('message').eq(0).text());
	if(root.attr('valide') == 'true') { /* en erreur */
		$('#formulaire').slideUp('slow');
	}
	return;
}