﻿
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 sendmailfn()
{
    
	
    var miurl = "scripts/sendmail.php?name=" + document.getElementById("pname").value + "&para=" + document.getElementById("pemailTo").value + "&email=" + document.getElementById("pemailFrom").value  + "&cel=" + document.getElementById("ptelefono").value + "&comentario=" +  document.getElementById("pmensaje").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 sendEmail()
{
    
	var ruta = document.location.href
    var miurl = "admin/scripts/sendmail.php?para=" + document.getElementById("emailpara").value + "&email=" + document.getElementById("emailde").value + "&comentario=" +  document.getElementById("cmt").value + "&tipo=2&url=" +  ruta.replace("?","ttt")  + ""
    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 fcsendmail()
{
    
    var miurl = "admin/scripts/sendmail.php?name=" + document.getElementById("name").value + "&correo=" + document.getElementById("email").value  + "&celular=" + document.getElementById("celular").value  + "&personas=" + document.getElementById("personas").value  + "&fecha=" + document.getElementById("fecha").value + "&mensaje=" + document.getElementById("mensaje").value + "&celebracion=" + document.getElementById("celebracion").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
			   if (sendmail.responseText == 'ok'){
			   		alert(" Hemos recibido su correo, en breve nos pondremos en contacto con usted");
			   }else{
				   alert(" Error al enviar el mensaje: " + sendmail.responseText);
			   }
               sendmail = null;
                
        }
    }
}
//getlugares()




