function usuario(nombre)
{
	document.write('    <div style="float:left">');
	document.write('         <table width="746" border="0" cellspacing="0" cellpadding="0" bgcolor="#72C336">');
	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 id="footer">');
	document.write('    <br />');
	document.write('    <strong>FEDERACION EXTREMEÑA DE MOTOCICLISMO</strong>'); 
	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="contacto.asp" title="Contacto">Contacto</a>-->');       
	document.write('      <a href="creditos.asp" title="Creditos">Creditos</a>');
	document.write('    </div>');
	document.write('    <br />');
	document.write('    C/ Artesania s/n');
	document.write('    <br />');
	document.write('    Pueblonuevo de Miramontes');
	document.write('    <br />');
	document.write('    10318 - CACERES');
	document.write('    <br />');
	document.write('    Teléfono: 927 573 293<br />');
	document.write('    Fax: 927 573 074<br />');
	document.write('    <br />');
	document.write('  </div>');
}

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('        <div class="secciones">Intranet</div>'); 
	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');
  document.write('        <input id="usuario" name="usuario" class="caja" maxlength="15" type="text">');
  document.write('        Password');
  document.write('        <input id="clave" name="clave" class="caja" maxlength="15" type="password">');
  document.write('        <input name="Submit" id="Submit" type="submit" class="patrocina" value="Entrar" /><!--<FONT COLOR="#FF0000">Intranet cerrada por problemas técnicos</FONT>--> ');
	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 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;
		  }

	   }	
