var xmlHttp
function mostrar(valor){
    enviarSeleccion (valor);
}
function enviarTest(){
    enviarSeleccion (valor);
}
function unsubscribe(){
    var email = document.getElementById("mailemail").value;
    var lang = "eng";
    borrar (email, lang);
}
function desinscripcion(){
    var email = document.getElementById("mailemail").value;
    var lang = "esp";
    borrar (email, lang);
}
function inscribirse(){
    var nombre = document.getElementById("mailer_name").value;
    var email = document.getElementById("mailer_email").value;
    var lang = "esp";
    insertar (nombre, email, lang);
}
function subscribe(){
    var nombre = document.getElementById("mailer_name").value;
    var email = document.getElementById("mailer_email").value;
    var lang = "eng";
    insertar (nombre, email, lang);
}
function borrar(email, lang){
  conexion=nuevoAjax();
  conexion.open("GET","assets/modules/mailing/addelete.php?delmail="+email+"&lang"+lang, true);
  conexion.onreadystatechange=function(){
      if (conexion.readyState==4){
        document.getElementById('temailer_form').innerHTML=conexion.responseText;
        }
  }
  conexion.send(null);
}
function insertar(name, email, lang){
  conexion=nuevoAjax();
  conexion.open("GET","assets/modules/mailing/addelete.php?name="+name+"&email="+email+"&lang="+lang, true);
  conexion.onreadystatechange=function(){
      if (conexion.readyState==4){
        document.getElementById('temailer_form').innerHTML=conexion.responseText;
        }
  }
  conexion.send(null);
}
function enviarSeleccion(item){
  conexion=nuevoAjax();
  conexion.open("GET","verResult.php?id="+item, true);
  conexion.onreadystatechange=function(){
      if (conexion.readyState==4){
        document.getElementById('resultado').innerHTML=conexion.responseText;
        document.getElementById('resultado2').innerHTML=conexion.responseText;
        }
  }
  conexion.send(null);
}

function procesarEventos()
{
  var resultado = document.getElementById("resultado");
  if(conexion.readyState == 4)
  {
    resultado.innerHTML = conexion.responseText;
    alert("resultadoASFASFASDF inner html"+ resultado.innerHTML);
  }
  else
  {
       alert("ELSE");
    detalles.innerHTML = 'Cargando...';
  }
}



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;
}