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 sendMsj(){
	c = document.getElementById('divmail');
	
	//variable=document.nombre_del_form.nombre_del_control.value
	nom=document.fmail.nom.value;
	mail=document.fmail.mail.value;
	tel=document.fmail.tel.value;
	msj=document.fmail.msj.value;
	
	ajax=nuevoAjax();
	c.innerHTML = '<p style="text-align:center;"><img src="esperando.gif" alt="Enviando Mensaje..."/><br /><span style="font-family:Tahoma, Geneva, sans-serif;font-size:14px;color:#FFF;">Enviando Mensaje...</span></p>'; 
	ajax.open("POST", "ctcnau.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("nom="+nom+"&mail="+mail+"&tel="+tel+"&msj="+msj)
}

function borrarCampos(){
	document.fmail.nom.value="";
	document.fmail.mail.value="";
	document.fmail.tel.value="";
	document.fmail.msj.value="";
	document.fmail.nom.value.focus();
}
