
function check_mail()
{
	var test = "" + document.formulaire.mail.value;
	a = true;
	if (document.formulaire.mail.value.length == 0)
		a = false; 
	else if (document.formulaire.mail.value.length > 0)
	{ 
		isthere = false;
		for(var k = 0; k < test.length;k++) 
		{ 
			if (test.substring(k,k+1) == "@")
				isthere = true;
		}
		if (!isthere)
			a = false;
	}
	
	if (!a)
		alert("Veuillez vérifier votre e-mail");
	else 
		maFonctionAjax(document.formulaire.mail.value);
}


function maFonctionAjax(mail)
{
  var OAjax;
  if (window.XMLHttpRequest)
	  OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject)
	  OAjax = new ActiveXObject('Microsoft.XMLHTTP');


  OAjax.onreadystatechange = function()
  {
      if (OAjax.readyState == 4 && OAjax.status==200)
	  {
			alert(OAjax.responseText);
	  }
  }
/*
  OAjax.open('POST',"http://nws.naltis.com/ajouter_NWM.php",true);
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('email='+mail+'&id=148');  
*/
  OAjax.open('GET',"ajouter_abonne.php?email="+mail+"&id=162",true);
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send(null);                 
} 

