function zonaprivada_home()
{
	document.write('      <div class="intranet">');
	document.write('        <form name="form_vip" method="post" action="privada_zonaentrar.asp" onSubmit="return comprueba_acceso();">');
	document.write('        <h1>Zona Privada</h1>');
	document.write('        <select id="zonaprivada" name="zonaprivada" class="caja">');
	document.write('          <option value="" selected="selected">Elige tu categoria</option>');
	document.write('          <!-- <option value="4">Club</option> -->');
	document.write('          <option value="5">Federado</option>');
	document.write('          <!-- <option value="3">Prensa</option> -->');
	document.write('        </select>');
	document.write('        Usuario<input id="usuario" name="usuario" class="caja" maxlength="15" type="text" />');
	document.write('        Password<input id="clave" name="clave" class="caja" maxlength="15" type="password" />');
	document.write('        <input type="image" src="images/login.gif" alt="" class="img_right" id="Submit" name="Submit" />');
	document.write('        </form>');
	document.write('      </div>'); 
}

function comprueba_acceso()
{
  if(document.getElementById("zonaprivada").value!="")
  {
    txt_zonaprivada=document.getElementById("zonaprivada").value;
    if(document.getElementById("usuario").value!="")
    {
      txt_usuario=document.getElementById("usuario").value;
      if(document.getElementById("clave").value!="")
      {
        txt_clave=document.getElementById("clave").value;
        form_vip.submit();
        return true;
      }
      else
      {
        alert("El campo password está vacío");
        return false;
      }
    }
    else
    {
      alert("El campo usuario está vacío");
      return false;
    }
  }
  else
  {
    alert("Debe seleccionar una categoría");
    return false;
  }
}

function usuario(nombre)
{
	document.write('    <div style="float:left">');
	document.write('         <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#da0e0d">');
	document.write('            <tr>');
	document.write('               <td class="nomTPV">&nbsp;' + nombre + '</td><td class="nomTPV" ALIGN="RIGHT"><ACRONYM TITLE="Desconecta al usuario de la parte privada"><A HREF="JavaScript:desconectar()" CLASS="txt_tpv">Desconexión</A></ACRONYM>&nbsp;</td>');
	document.write('            </tr>');
	document.write('         </table>');
	document.write('    </div>');
}

function pie()
{
	document.write('    <div style="background-color:#DD2024">');
	document.write('      <img src="images/pagina_bottom.gif" alt="" width="979" /><br />');
	document.write('    </div>');
	document.write('    <div id="footer">');
	document.write('      <div class="footer_links">');
	document.write('        <a href="avisolegal.asp" title="Aviso legal">Aviso legal</a>');      
	document.write('        <a href="mapaweb.asp" title="Mapa del web">Mapa del web</a>');           
	document.write('        <a href="creditos.asp" title="Creditos">Creditos</a>');
	document.write('      </div>');
	document.write('      <img src="images/icon_faram_footer.png" alt="" /><br />');
	document.write('      <span class="direccion">');
	document.write('        Calle Valero Ripol, 15<br />');
	document.write('        50018 Zaragoza<br />');
	document.write('        Telf: 976 730 970<br />');
	document.write('        Fax: 976 741 483');
	document.write('        <p>&nbsp;</p>');
	document.write('      </span>');
	document.write('    </div>');
}

function cambio()
{
  if (document.getElementById("zonaprivada").value=="3")
  { 
    alert("Estamos trabajando en la construccion de esta zona privada. En breve estará disponible. Gracias");
  }
}


		var UsuarioError = "0";

		function handleHttpResponse() 
		{ 
			if (http.readyState == 4) 
			{ 
			   if (http.status == 200) 
			   { 
				  if (http.responseText.indexOf('invalid') == -1) 
				  {
					 results = http.responseText.split("|"); 
					 UsuarioError = results[0];
					 enProceso = false;
				  }
			   }
			}
		}

		function verificaUsuario() 
		{
			if (!enProceso && http) 
			{
			   var zonaprivada = escape(document.getElementById("zonaprivada").value);
			   var usuario = escape(document.getElementById("usuario").value);
			   var clave = escape(document.getElementById("clave").value);
			   var url = "operacions_ajax.asp?id=1&zonaprivada="+zonaprivada+"&usuario="+usuario+"&clave="+clave;
			   http.open("GET", url, true);
			   http.onreadystatechange = handleHttpResponse;
			   enProceso = true;
			   http.send(null);
			}
		}

		function getHTTPObject() {
			var xmlhttp;
			/*@cc_on
			@if (@_jscript_version >= 5)
			   try {
				  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			   } catch (e) {
				  try {
					 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				  } catch (E) { xmlhttp = false; }
			   }
			@else
			xmlhttp = false;
			@end @*/
			if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			   try {
				  xmlhttp = new XMLHttpRequest();
			   } catch (e) { xmlhttp = false; }
			}
			return xmlhttp;
		}

		var enProceso = false;
		var http = getHTTPObject();

		function comprueba_acceso2() 
		{ 
		 
		  if(document.getElementById("zonaprivada").value!="")
		  {
			txt_zonaprivada=document.getElementById("zonaprivada").value;
			if(document.getElementById("usuario").value!="")
			{
			  txt_usuario=document.getElementById("usuario").value;
			  if(document.getElementById("clave").value!="")
			  {
				txt_clave=document.getElementById("clave").value;

				if (document.getElementById("zonaprivada").value=="5")
				{
					verificaUsuario();
					if (confirm("¿Usuario Correcto?")) 
					  { 
						if (UsuarioError == "1") {alert("Usuario Erróneo"); return false; }
						if (UsuarioError == "2") {alert("No tienes licencia vigente"); return false; }
						form_vip.submit();
						return true;
					  }
				}
				else {form_vip.submit(); return true;}
			  }
			  else
			  {
				alert("El campo password está vacío");
				return false;
			  }
			}
			else
			{
			  alert("El campo usuario está vacío");
			  return false;
			}
		  }
		  else
		  {
			alert("Debe seleccionar una categoría");
			return false;
		  }

	   }	
