webhosting = {
free : "0"
,to_reg:"0"
,dominio:"com.ar"
,t:"solicitud1"

,InnerHtml:'<table width="473" cellspacing="0" cellpadding="18" border="0" bgcolor="#fafafa" style="border: 1px solid rgb(208, 208, 208);">\
                <tbody>\
                  <tr>\
                    <td width="100%">\
                      <table width="100%" cellspacing="0" cellpadding="0" border="0" style="margin:18px;">\
                        <tbody>\
                          <tr>\
                            <td width="70%" valign="top">\
			    	http://www.\
				<input onkeypress="if((event.which ? event.which : event.keyCode)==13) {document.getElementById(\'buscar\').click(); return false}" id="nombre" name="dom_nombre" maxlength="19" style="width: 200px;" class="azul"/>\
				<div style="padding:15px 0 0 0 ;">\
                                <input type="radio" onclick="webhosting.dominio=(this.value)" name="dom" value="com" id="r1"/>.com \
		                <input type="radio" onclick="webhosting.dominio=(this.value)" name="dom" value="net" id="r2"/>.net \
				<input type="radio" onclick="webhosting.dominio=(this.value)" name="dom" value="org" id="r3"/>.org \
				<input type="radio" onclick="webhosting.dominio=(this.value)" checked="" name="dom" value="com.ar" id="r4"/>.com.ar  \
				</div>\
		            </td>\
                            <td width="30%" valign="top"><button id="buscar" onclick="webhosting.searchDomain()" style="" class="botones" type="button">Comprobar</button></td>\
                          </tr>\
                        </tbody>\
                    </table></td>\
                  </tr>\
                </tbody>\
              </table>\
        <div style="visibility: hidden;" id="post_result">\
              <p>A continuaci&oacute;n podr&aacute; verificar si el dominio seleccionado est&aacute; registrado de no ser as&iacute;<br>\
Haga click en &ldquo;Registrar&rdquo; y solicite su registro.\
</p>\
              <table width="473" cellspacing="1" cellpadding="3" border="0" style="border: 1px solid rgb(208, 208, 208);">\
                <tbody>\
                  <tr height="25" bgcolor="#eeeeee">\
                    <td align="center" class="verdana12"><b>Nombre de Dominio</b></td>\
                    <td align="center" class="verdana12"><b>Resultado</b></td>\
                    <td align="center" class="verdana12"><b> </b></td>\
                  </tr>\
                  <tr height="20" bgcolor="#fbfbfb" onmouseout="webhosting.tr.onmouseout(this)" onmouseover="webhosting.tr.onmouseover(this)">\
                    <td align="center" class="verdana12"><span id="dominio_full_name"/></td>\
                    <td align="center" class="verdana12"><font color="green"><span id="whois_result"/></font></td>\
                    <td align="center" class="verdana12"><div style="visibility: hidden;" id="bt_reg"><a onclick="webhosting.registrar()" href="#">Registrar</a></div></td>\
                  </tr></tbody></table>\
		  </div>\
		<div id="searching" style="border: 1px solid black; position: absolute; top: 430px; left: 400px; width: 180px; height: 40px; background-color: rgb(255, 255, 255); visibility: hidden;">\
		  	<div align="center" style="margin: 2px; background-color: rgb(135, 182, 76); height: 25px; font-family: verdana,arial; font-size: 11px; padding-top: 11px; color: white; position: static;" id="in_sh"><b>Buscando ...</b></div>\
		</div>'
,ToHtml:function(){
	return this.InnerHtml;
}
,registrar:function(){
	webhosting.to_reg="1";
	location.href="/ContratarWebHosting.Form.aspx";
	return false;
}
,searchDomain:function(){
	document.getElementById("searching").style.visibility="visible";
	searchDomain(document.getElementsByName("dom_nombre")[0].value,webhosting.dominio)
}
,tr:{
	onmouseover:function(obj){
		if (!obj) obj =this;
		obj.style.background="#f7f7f7"
	}
	,onmouseout:function(obj){
		if (!obj) obj =this;
		obj.style.background="#fbfbfb"
	}
}
}

var request = false;
var whois_url='/ajax.process_whois.aspx';
try
 {
 request = new XMLHttpRequest();
 }
 catch (trymicrosoft)
 {
 try
 {
 request = new ActiveXObject("Msxml2.XMLHTTP");
 }
 catch (othermicrosoft)
 {
 try
 {
 request = new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (failed)
 {
 request = false;
 }
 }
 }

if (!request)
{
	alert("Puede que tenga problemas para enviar este formulario");
}
function searchDomain(nombre,dominio)
{
	var q_string='n='+escape(nombre)+'&d='+escape(dominio);
	var url = whois_url;

	request.open("GET", url+'?'+q_string, true);
	request.onreadystatechange = setWhoisResult;
	request.send(null);
}

function setWhoisResult()
{
	if(request.readyState == 4)
	{
		var resultText='';
		if(request.responseText==1)
		{
			resultText='LIBRE';
			//document.getElementById('bt_reg').style.display='block';
			document.getElementById('bt_reg').style.visibility='visible';
		}
		else
		{
			if(request.responseText==0)
			{
				resultText='OCUPADO';
			}
			else
			{
				alert('Ocurrió un error al ejecutar el requerimiento');
			}
		}
		document.getElementById('dominio_full_name').innerHTML='www.'+document.getElementsByName("dom_nombre")[0].value+'.'+webhosting.dominio;
		document.getElementById('whois_result').innerHTML=resultText;
		//document.getElementById('post_result').style.display='block';
		document.getElementById('post_result').style.visibility='visible';
		document.getElementById("searching").style.visibility="hidden";
	}
}
