function nuevoAjax(){
	var xmlhttp=false;
	try{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(E){
			xmlhttp = false;
		}
	}	
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
function enviarMail(){
       c = document.getElementById('form_news_message');
       ee = document.getElementById('errorEmail');
       en = document.getElementById('errorName');
       ch = document.getElementById('errorConditions');
       var error = 0;
       
       name=document.form_news.name.value;
       email=document.form_news.email.value;
       cond=document.form_news.acceptConditions.checked;
   
       if (name == "") { 
    	   error=1;
    	   en.innerHTML = "&nbsp;***";
       }
       if (email == ""){
    	   error =1;
    	   ee.innerHTML = "&nbsp;***";
       }
       if (cond == false){
    	   error =1;
    	   ch.innerHTML = "&nbsp;***";
       }
    	   
       if (error == 0) {
	       ajax=nuevoAjax();
	       c.innerHTML = '...'; 
	       ajax.open("POST", "mail.php",true);
	       ajax.onreadystatechange=function() {
	       if (ajax.readyState==4) {
	       c.innerHTML = ajax.responseText;
	       }
	       borrarCampos()
	       }
	       ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	       ajax.send("name="+name+"&email="+email)
       } 
}
function borrarCampos(){
       document.form_news.name.value="";
       document.form_news.email.value="";
       document.form_news.acceptConditions.checked=false;
       document.getElementById('errorEmail').innerHTML="";
       document.getElementById('errorName').innerHTML="";
       document.getElementById('errorConditions').innerHTML="";
       
}
