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('subbuffer');
   
       //variable=documenet.nombre_del_form.nombre_del_control.value
       nombre=document.formulario.nombre.value;
       correo=document.formulario.correo.value;
       asunto=document.formulario.asunto.value;
       mensaje=document.formulario.mensaje.value;
   
       ajax=nuevoAjax();
       c.innerHTML = '<p style="text-align:center;">enviando mail <img src="image/loading.gif" align="absmiddle"/></p>'; 
       ajax.open("POST", "sendmail.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("nombre="+nombre+"&correo="+correo+"&asunto="+asunto+"&mensaje="+mensaje)
}
function borrarCampos(){
       document.formulario.nombre.value="";
       document.formulario.correo.value="";
       document.formulario.mensaje.value="";
       document.formulario.nombre.focus();
}