// --------------------  Otras funciones
function isEmpty(s)
{ return ((s == null) || (s.length == 0))
}


function isWhitespace(s)
{ var i,rs;
  rs = false; 
  if (isEmpty(s)) rs = true; 
  for (i = 0; i < s.length; i++)
  {
    if (s.charAt(i) == " ") rs = true;
  }
  return rs;
}



// --------------------  Comprueba la validez del E-Mail
function isEMail(s)
{  if (isEmpty(s))
       if (isEMail.arguments.length == 1) return false;
       else return (isEMail.arguments[1] == true);

   if (isWhitespace(s)) return false;
   
   var i = 1;
   var sLength = s.length;

   while ((i < sLength) && (s.charAt(i) != "@"))
   { i++
   }
   if ((i >= sLength) || (s.charAt(i) != "@")) return false;
   else i += 2;

   while ((i < sLength) && (s.charAt(i) != "."))
   { i++
   }
   if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
   else return true;   
}




// --------------------  Formulario de registro
function fmChkRegistrarESP() 
    {
        if (document.fmRegistrar.nombre.value == "") 
        {
        alert("Por favor, escriba su Nombre y Apellidos.");
        return false;
        }

		if (document.fmRegistrar.login.value == "") 
        {
        alert("Por favor, indique el Login (nombre de usuario o pseudónimo).");
        return false;
        }
		
		if (document.fmRegistrar.condiciones.checked == false )
		{
		alert("Por favor, debes aceptar la Cláusula de Privacidad antes de continuar");
		return false;
		}
				
		if (!isEMail(document.fmRegistrar.email.value)) {
  		alert("¡La dirección de e-mail no es válida!");
		return false;
		}		
	}
	
	

// --------------------  Formulario de recomendar
function validarRecomendarESP()
{
 if (!isEMail(document.fmRecomendar.email2.value)) {
  alert("¡La dirección de e-mail no es válida!");
  return false;
 }
   else
   {
   alert("Gracias por recomendar esta web.\nSu e-mail se enviará en unos minutos.");
   return true;
   }
 }

 
 
// --------------------  Formulario de opinión
function fmChkOpinionESP() 
{       
        if (document.fmOpinion.Nombre.value == "") {
        alert("Por favor, escriba su Nombre y Apellidos.");
        return false;
        }

		if (!isEMail(document.fmOpinion.Email.value)) {
  		alert("¡La dirección de e-mail no es válida!");
		return false;
		}		
		
		if (document.fmOpinion.condiciones.checked == false )
		{
		alert("Por favor, debes aceptar la Cláusula de Privacidad antes de continuar");
		return false;
		}

		if (document.fmOpinion.Comentarios.value == "") 
        {
        alert("Por favor, introduzca algún comentario u opinión.");
        return false;
        }
		
	}
	
	

// --------------------  Formulario del Foro
function fmChkForoESP() 
{       
        if (document.fmForo.login.value == "") {
        alert("Por favor, escriba su Nombre de Usuario.");
        return false;
        }

		if (document.fmForo.password.value == "") {
  		alert("Por favor, introduzca la Contraseña asignada.");
		return false;
		}		
		
		if (document.fmForo.mensaje.value == "") 
        {
        alert("Por favor, introduzca algún comentario u opinión.");
        return false;
        }
		
	}

	
	
	
// --------------------  Formulario de Olvido 
function fmChkOlvidoESP() 
{       
		if (!isEMail(document.fmOlvido.email.value)) {
  		alert("¡La dirección de e-mail no es válida!");
		return false;
		}			
	}

	
	
// --------------------  Formulario del Cambio de Password
function fmChkCambiaESP() 
{       
        if (document.fmCambia.login.value == "") {
        alert("Por favor, escriba su Nombre de Usuario (login).");
        return false;
        }

		if (document.fmCambia.password.value == "") {
  		alert("Por favor, introduzca la Contraseña actual.");
		return false;
		}		
		
		if (document.fmCambia.password1.value == "") {
  		alert("Por favor, introduzca la nueva Contraseña.");
		return false;
		}		
		
		if (document.fmCambia.password2.value == "") {
  		alert("Por favor, repita la nueva Contraseña.");
		return false;
		}		
		
	}

	

// ------------- AHORA EN INGLES

// --------------------  Formulario de registro ENG
function fmChkRegistrarENG() 
    {
        if (document.fmRegistrar.nombre.value == "") 
        {
        alert("Please, enter your Name and Last name.");
        return false;
        }

		if (document.fmRegistrar.login.value == "") 
        {
        alert("Please, enter the Login (User name or nick).");
        return false;
        }
		
		if (document.fmRegistrar.condiciones.checked == false )
		{
		alert("Please, you must to accept the Privacy Policy and Use before continue");
		return false;
		}
		
		if (!isEMail(document.fmRegistrar.email.value)) {
  		alert("The e-mail address is not valid!");
		return false;
		}		
	}
	
	

// --------------------  Formulario de recomendar ENG
function validarRecomendarENG()
{
 if (!isEMail(document.fmRecomendar.email2.value)) {
  alert("The e-mail address is not valid!");
  return false;
 }
   else
   {
   alert("Thank you for recommend this web site.\nYour e-mail will be send in a few minutes.");
   return true;
   }
 }

 
 
// --------------------  Formulario de opinión ENG
function fmChkOpinionENG() 
{       
        if (document.fmOpinion.Nombre.value == "") {
        alert("Please, enter your Name and Last name.");
        return false;
        }

		if (!isEMail(document.fmOpinion.Email.value)) {
  		alert("The e-mail address is not valid!");
		return false;
		}		
		
		if (document.fmOpinion.condiciones.checked == false )
		{
		alert("Please, you must to accept the Privacy Policy and Use before continue");
		return false;
		}
		
		if (document.fmOpinion.Comentarios.value == "") 
        {
        alert("Please, enter a comment or an opinion.");
        return false;
        }
		
	}
	
	

// --------------------  Formulario del Foro ENG
function fmChkForoENG() 
{       
        if (document.fmForo.login.value == "") {
        alert("Please, enter your User name (login).");
        return false;
        }

		if (document.fmForo.password.value == "") {
  		alert("Please, enter the assigned Password.");
		return false;
		}		
		
		if (document.fmForo.mensaje.value == "") 
        {
        alert("Please, enter a comment or an opinion.");
        return false;
        }
		
	}

	
	
	
// --------------------  Formulario de Olvido ENG
function fmChkOlvidoENG() 
{       
		if (!isEMail(document.fmOlvido.email.value)) {
  		alert("The e-mail address in not valid!");
		return false;
		}			
	}

	
	
// --------------------  Formulario del Cambio de Password ENG
function fmChkCambiaENG() 
{       
        if (document.fmCambia.login.value == "") {
        alert("Please, enter your User name (login)!");
        return false;
        }

		if (document.fmCambia.password.value == "") {
  		alert("Please, enter the old Password.!");
		return false;
		}		
		
		if (document.fmCambia.password1.value == "") {
  		alert("Please, enter the new Password.!");
		return false;
		}		
		
		if (document.fmCambia.password2.value == "") {
  		alert("Please, repeat the new Password.!");
		return false;
		}		
		
	}
	
	

	
	
// ------------- AHORA EN CATALAN

// --------------------  Formulario de registro CAT
function fmChkRegistrarCAT() 
    {
        if (document.fmRegistrar.nombre.value == "") 
        {
        alert("Si us plau, introdueixi el seu Nom i Cognoms.");
        return false;
        }

		if (document.fmRegistrar.login.value == "") 
        {
        alert("Si us plau, introdueixi el Login (Nom d'usuari o pseudònim).");
        return false;
        }
		
		if (document.fmRegistrar.condiciones.checked == false )
		{
		alert("Si us plau, has d'acceptar la Clàusula de Privacitat abans de continuar");
		return false;
		}
		
		if (!isEMail(document.fmRegistrar.email.value)) {
  		alert("L'adreça d'e-mail no és correcta!");
		return false;
		}		
	}
	
	

// --------------------  Formulario de recomendar CAT
function validarRecomendarCAT()
{
 if (!isEMail(document.fmRecomendar.email2.value)) {
  alert("L'adreça d'e-mail no és correcta!");
  return false;
 }
   else
   {
   alert("Gràcies per recomanar aquesta web.\nEl seu e-mail serà enviat en uns minuts.");
   return true;
   }
 }

 
 
// --------------------  Formulario de opinión CAT
function fmChkOpinionCAT() 
{       
        if (document.fmOpinion.Nombre.value == "") {
        alert("Si us plau, introdueixi el seu Nom i Cognoms.");
        return false;
        }

		if (!isEMail(document.fmOpinion.Email.value)) {
  		alert("L'adreça d'e-mail no és correcta!");
		return false;
		}		
		
		if (document.fmOpinion.condiciones.checked == false )
		{
		alert("Si us plau, has d'acceptar la Clàusula de Privacitat abans de continuar");
		return false;
		}
		
		if (document.fmOpinion.Comentarios.value == "") 
        {
        alert("Si us plau, introdueixi quelcom comentari o opinió.");
        return false;
        }
		
	}
	
	

// --------------------  Formulario del Foro CAT
function fmChkForoCAT() 
{       
        if (document.fmForo.login.value == "") {
        alert("Si us plau, introdueixi el seu nom d'Usuari (login).");
        return false;
        }

		if (document.fmForo.password.value == "") {
  		alert("Si us plau, introdueixi la Contrasenya assignada.");
		return false;
		}		
		
		if (document.fmForo.mensaje.value == "") 
        {
        alert("Si us plau, introdueixi quelcom comentari o opinió.");
        return false;
        }
		
	}

	
	
	
// --------------------  Formulario de Olvido CAT
function fmChkOlvidoCAT() 
{       
		if (!isEMail(document.fmOlvido.email.value)) {
  		alert("L'adreça d'e-mail no és correcta!");
		return false;
		}			
	}

	
	
// --------------------  Formulario del Cambio de Password CAT
function fmChkCambiaCAT() 
{       
        if (document.fmCambia.login.value == "") {
        alert("Si us plau, introdueixi el seu nom d'Usuari (login)!");
        return false;
        }

		if (document.fmCambia.password.value == "") {
  		alert("Si us plau, introdueixi la Contrasenya actual.!");
		return false;
		}		
		
		if (document.fmCambia.password1.value == "") {
  		alert("Si us plau, introdueixi la nova Contrasenya.!");
		return false;
		}		
		
		if (document.fmCambia.password2.value == "") {
  		alert("Si us plau, repeteixi la nova Contrasenya.!");
		return false;
		}		
		
	}
	

	

