
function getEstiloCapa(idCapa){ 
	capa=null; 
	if (document.layers) capa = eval("document." + idCapa);
	else if (document.all) capa = eval(idCapa + ".style");
	else if (document.getElementById) capa = eval('document.getElementById("'+idCapa+'").style');
	return capa;
}

function muestracapa(nombrecapa)
{
	var estilocapa = getEstiloCapa(nombrecapa);
	if (estilocapa)
	{
		if (estilocapa.display == "block")
		{
			estilocapa.visibility = (document.layers) ? "hide" : "hidden";
			estilocapa.display = "none";
		}else{
			estilocapa.visibility = (document.layers) ? "show" : "visible" ; 
			estilocapa.display = "block";
		}
	}
	return false;
}



 
function encripta(){	 
		
 		if (document.all) 
 		{ 
			var a = document.forms["loginForm"].elements["z3n"].value;
			var b = a+document.forms["loginForm"].elements["marcatiempo"].value;
			document.forms["loginForm"].elements["z3n"].value = hex_md5(b);
			document.forms["loginForm"].elements["k3t"].value = rot13(document.forms["loginForm"].elements["k3t"].value); 
		}else{ 
			var a=document.forms["loginForm"].z3n.value+(""+document.forms["loginForm"].marcatiempo.value+"");
			document.forms["loginForm"].z3n.value = hex_md5(a);	 
			document.forms["loginForm"].k3t.value = rot13(document.forms["loginForm"].k3t.value);			
 		} 
 		return true; 
 }  
  
 // This work is hereby released into the Public Domain. To view a copy of the public domain dedication, visit   http://creativecommons.org/licenses/publicdomain/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford,   California 94305, USA. 
 // origin: 2000-01-08 nospam@geht.net http://tools.geht.net/rot13.html 
 // Use at own risk. 
 var last=""; 
 var rot13map; 
  
 // The problem is that JavaScript 1.0 
 // does not provide a Char to Numeric value conversion 
 // Thus we define a map. 
 // Because there are 64K UniCode characters, this map does not cover all characters. 
 function rot13init() 
 { 
   var map = new Array(); 
   var s   = "abcdefghijklmnopqrstuvwxyz"; 
    
   for (i=0; i<s.length; i++) 
     map[s.charAt(i)]	= s.charAt((i+13)%26); 
   for (i=0; i<s.length; i++) 
     map[s.charAt(i).toUpperCase()]	= s.charAt((i+13)%26).toUpperCase(); 
   return map; 
 } 
  
 function rot13(a) 
 { 
   if (!rot13map) 
     rot13map=rot13init(); 
   s = ""; 
   for (i=0; i<a.length; i++) 
    { 
       var b = a.charAt(i); 
  
       s+= (b>='A' && b<='Z' || b>='a' && b<='z' ? rot13map[b] : b); 
     } 
  
   return s; 
 } 
  

function hechoLogin(responseText, statusText){
	$("#loginformmsj").html("");
	$("#loginformmsj").append(responseText);
	$("#loginformmsj").slideDown();
	return false;
}

function validateLogin(form) {
	var error = "";

    if (!form.nif.value){
        error += "<li>Introduzca el N.I.F. o N.I.E.</li>";
		form.nif.focus();
	}
    if (!form.passwd.value){
		error += "<li>Introduzca la contrase&ntilde;a</li>";
		if (form.passwd.value)
			form.passwd.focus();
	}
	
    if(error.length > 0){
		$("#loginformmsj").html('');
		$("#loginformmsj").append("<ul>" + error + "</ul>");
		$("#loginformmsj").slideDown();
		return false;
	}
	return true;
}
function despliegaLogin()
{
	$("#loginform").slideDown();
}
 

 
