var Conexion=false;var Palabra="";var loaderSearch="loaderSearch";function Conectar(){try{Conexion=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){try{Conexion=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){if(!Conexion&&typeof XMLHttpRequest!="undefined"){Conexion=new XMLHttpRequest()}}}}function Contenido(a){if(Conexion.readyState!=4){return}if(Conexion.status==200){if(Conexion.responseText){document.getElementById(a).style.display="block";document.getElementById(a).innerHTML=Conexion.responseText}else{document.getElementById(a).style.display="none"}}else{document.getElementById(a).innerHTML=Conexion.status+"-"+Conexion.statusText}document.getElementById(loaderSearch).style.visibility="hidden";Conexion=false}function Solicitud(a,c,b){if(c&&c!=Palabra){if(Conexion){return}Conectar();if(Conexion){document.getElementById(loaderSearch).style.visibility="visible";Palabra=c;Conexion.open("POST",b,true);Conexion.setRequestHeader("Content-Type","application/x-www-form-urlencoded");Conexion.onreadystatechange=function(){Contenido(a)};date=new Date();Conexion.send("idContenido="+a+"&word="+c+"&"+date.getTime())}else{document.getElementById(a).innerHTML="No disponible"}}}function autocompletar(a,c,b){if(c.length>=1){if(Conexion!=false){document.getElementById(loaderSearch).style.visibility="hidden";Conexion.abort();Conexion=false}Solicitud(a,c,b)}else{document.getElementById(a).style.display="none"}}function selectItem(a,b){document.getElementById("ftxtBusqueda").value=b;autocompletar(a,b)};
