function getXhr(){
	var xhr = null;
	if(window.XMLHttpRequest){
		xhr = new XMLHttpRequest(); 
	} else if(window.ActiveXObject){ 
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
	} else { 
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		xhr = false; 
	} 
	return xhr;
} 

///////////////////////////////////////////////////////
//////////////// MODULE INSCRIPTION ///////////////////
///////////////////////////////////////////////////////
function inscriptionUser() {
	var xhr = getXhr();
	var addmail = document.frm_nws.newsletter.value;

	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
		var affich_info=xhr.responseText;
		document.getElementById('alertInscription').innerHTML = affich_info;
		}
	}
	
	xhr.open("POST","includes/services/serv_inscription.php",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=iso-8859-1');
	xhr.send("mailUser="+addmail);

} 


///////////////////////////////////////////////////////
//////////////////MODULE CONTACT //////////////////////
///////////////////////////////////////////////////////
function contactUser() {
	var xhr = getXhr();
	var nom = document.form_subscribe.firstname.value;
	var prenom = document.form_subscribe.lastname.value;
	var addmail = document.form_subscribe.email.value;
	var objet = document.form_subscribe.obj.value;
	var msg = document.form_subscribe.buzz.value;
	
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			var affich_info=xhr.responseText;
			document.getElementById('alertContact').innerHTML = affich_info;
		}
	}

	xhr.open("POST","includes/services/serv_contact.php",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=iso-8859-1');
	xhr.send("nomUser="+nom+"&prenomUser="+prenom+"&mailUser="+addmail+"&objtUser="+objet+"&msgUser="+msg);

}
