// JavaScript Document
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;
}

// todo es correcto y ha llegado el momento de poner la información requerida
// en su sitio en la pagina xhtml
function cargarpagina(pagina_requerida,id_contenedor){
	ajax=nuevoAjax();
	ajax.open("GET",pagina_requerida,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4 && (ajax.status == 200 || window.location.href.indexOf ("http") == - 1)) {
			document.getElementById(id_contenedor).style.display='block';
			document.getElementById('loading').style.display='none';
			document.getElementById(id_contenedor).innerHTML = ajax.responseText;
		}else{
			document.getElementById('loading').style.display='block';
			document.getElementById(id_contenedor).style.display='none';
		}
	}
	 ajax.send(null);
}

function comprobarDominio(){
	dominio=document.frmDom.domain.value;
	id_contenedor="estadoDominio";
	ajax=nuevoAjax();
	ajax.open("GET","whois/verificar.php?dominio="+dominio,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4 && (ajax.status == 200 || window.location.href.indexOf ("http") == - 1)) {
			document.getElementById(id_contenedor).style.display='block';
			document.getElementById(id_contenedor).innerHTML = ajax.responseText;
			document.frmDom.domain.value="";
			document.frmDom.domain.focus();
		}else{
			document.getElementById(id_contenedor).style.display='block';
			document.getElementById(id_contenedor).innerHTML = "Por favor, espere...";
		}
	}
	 ajax.send(null);
}

function comprobarDominioPortada(){
	dominio=document.frmDom.domain.value;
	id_contenedor="estadoDominio";
	ajax=nuevoAjax();
	ajax.open("GET","whois/verificar.php?dominio="+dominio+"&id=0",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4 && (ajax.status == 200 || window.location.href.indexOf ("http") == - 1)) {
			document.getElementById(id_contenedor).style.display='block';
			document.getElementById(id_contenedor).innerHTML = ajax.responseText;
			document.frmDom.domain.value="";
			document.frmDom.domain.focus();
		}else{
			document.getElementById(id_contenedor).style.display='block';
			document.getElementById(id_contenedor).innerHTML = "Por favor, espere...";
		}
	}
	 ajax.send(null);
}
