function NL_get_xmlhttp() {
  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 NL_enviar(xmlhttp,metodo,url,async,callback) {
 url += "?email=" + document.getElementById('NL').email.value;
 xmlhttp.open(metodo, url, async);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==1) {
   document.getElementById("Conting").innerHTML="<div style='width:100%;text-align:center'><img src='/web/imatges/xcargando.gif' alt='Cargando...' style='margin:auto' /></div>";
  }
 
  if (xmlhttp.readyState==4) {
   callback(xmlhttp);
  }
 }
 xmlhttp.send(null);
}

function NL_XMLHttpRequest(NL_link) {
	xmlhttp=NL_get_xmlhttp()
	NL_enviar(xmlhttp,"GET",NL_link,true,NL_recibirRespuesta);
}

function NL_recibirRespuesta(xmlhttp) {
	val=""
	for(i in xmlhttp) {
		try {
		val+="xmlhttp."+i+"="+xmlhttp[i]+"\n"
		} catch(e) {}
	}
	if(xmlhttp.status==404) { alert("Esta pagina no existe")}
	document.getElementById("DivNewsletter").innerHTML=xmlhttp.responseText;
}

function NL_XMLHttpRequest2(NL_link) {
	xmlhttp=NL_get_xmlhttp()
	NL_enviar(xmlhttp,"POST",NL_link,true,NL_recibirRespuesta2);
}

function NL_recibirRespuesta2(xmlhttp) {
	val=""
	for(i in xmlhttp) {
		try {
		val+="xmlhttp."+i+"="+xmlhttp[i]+"\n"
		} catch(e) {}
	}
	if(xmlhttp.status==404) { alert("Esta pagina no existe")}
	document.getElementById("Conting").innerHTML=xmlhttp.responseText;
}
