﻿
var sendmail=false; 

function Create_sendmail()
{
	
	
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  registro = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   registro = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   registro = false;
  }
 }
@end @*/
if (!sendmail && typeof XMLHttpRequest!='undefined') {
	try {
		sendmail = new XMLHttpRequest();
	} catch (e) {
		sendmail=false;
	}
}
if (!sendmail && window.createRequest) {
	try {
		sendmail = window.createRequest();
	} catch (e) {
		sendmail=false;
	}
}


}
    
function fcsendmail()
{
    
	
    var miurl = "admin/scripts/sendmail.php?nombre=" + document.getElementById("Nombre").value + "&email=" + document.getElementById("email").value  + "&cel=" + document.getElementById("Cel").value + "&comentario=" +  document.getElementById("Comentario").value + "&Dir=" +  document.getElementById("Dir").value;

    var  idrespuesta=0;
    Create_sendmail();
    //Permite crear una validacion para que selecciones un item       
    sendmail.onreadystatechange = sendmailHand;
    sendmail.open("GET", miurl , true);
    sendmail.send(null);
}


function sendmailHand()
{
    if(sendmail.readyState == 4)
    {
        if(sendmail.status == 200)
        {
			   //document.getElementById("sendmail").innerHTML = sendmail.responseText
			   alert(sendmail.responseText + " He recibido tu correo, en breve me pondré en contacto contigo !!")
               sendmail = null;
                
        }
    }
}




