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


ajax="";



function check_domain(dominio)
{
	if(dominio!="" && dominio.length >=3){
		ajax=nuevoAjax();
		ajax.open("GET", "pruebas.php?domain="+dominio,true);
		contenedor1 = document.getElementById('ventana');
		ajax.onreadystatechange=function() {
			if (ajax.readyState==1) {
					$j("#ventana").fadeOut("fast", function(){
					contenedor1.innerHTML = "<div style=\"float:left;width:211px; height:124px; background-image:url(Images/comprobar_07.jpg);\"><div align=\"center\" style=\"margin-top:35px;\"><img src=\"verificando.gif\" width=\"26\" height=\"24\" /> Consultando ...<br /> <strong>Espere por favor.... </strong></div></div></div>";
					$j("#ventana").fadeIn("fast");
					});
			}else {
				if (ajax.readyState==4) {
					respuesta = ajax.responseText
					$j("#ventana").fadeOut("fast", function(){
					if(respuesta.indexOf("Oops!")!=-1){
						respuesta = respuesta.split(" - ");
						contenedor1.innerHTML = "<div class=\"error_msg\">"+respuesta[1]+"</div>";
						//alert(respuesta[1]);
					}else{
						contenedor1.innerHTML = respuesta;
					}
					$j("#ventana").fadeIn("slow");
					ajax="";
															});
				}
			}
		}
		 ajax.send(null);
	}
}


timeoutt="";
function keypressed(domain)
{
	clearTimeout(timeoutt);

	ajax="";
	timeoutt = setTimeout("check_domain('"+domain+"');", 450);
}




