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", "check.php?dom="+dominio,true);
		contenedor1 = document.getElementById('response');
		ajax.onreadystatechange=function() {
			if (ajax.readyState==1) {
					$j("#response").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\" /> Verificando dominio/s...<br /> <strong>Espere por favor. </strong></div></div></div>";
					$j("#response").fadeIn("fast");
					});
			}else {
				if (ajax.readyState==4) {
					respuesta = ajax.responseText
					$j("#response").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("#response").fadeIn("slow");
					ajax="";
															});
				}
			}
		}
		 ajax.send(null);
	}
}
timeoutt="";
function keypressed(){
	clearTimeout(timeoutt);
	document.getElementById('dominio_estanlibres').value = document.getElementById('dominio_estanlibres').value.replace("http://", "");
	document.getElementById('dominio_estanlibres').value = document.getElementById('dominio_estanlibres').value.replace("www.", "");
	ajax="";
	timeoutt = setTimeout("check_domain('"+document.getElementById('dominio_estanlibres').value+"');", 450);
}
function get_whois(dominio){
	if(dominio!="" && dominio.length >=3){
		ajax=nuevoAjax();
		ajax.open("GET", "whois.php?dom="+dominio,true);
		contenedor1 = document.getElementById('response_whois');
		ajax.onreadystatechange=function() {
			if (ajax.readyState==1) {
				$j("#response").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\" /> Verificando dominio/s...<br /> <strong>Espere por favor. </strong></div></div></div>";
					$j("#response").fadeIn("fast");
					});
			}else {
				if (ajax.readyState==4) {
					respuesta = ajax.responseText
					ajax="";
				}
			}
		}
		 ajax.send(null);
	}
}