function ValidaLogin(theForm)
{

  if (theForm.Email.value == "")
  {
    alert("Por favor escribe tu dirección de correo.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Email.value.length > 255)
  {
    alert("El email no debe exceder 255 caracteres.");
    theForm.Email.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-@._-";
  var checkStr = theForm.Email.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("La dirección de correo electrónico no es valida.");
    theForm.Email.focus();
    return (false);
  }
  
  var string=theForm.Email.value;
  if ( ( string.indexOf("@") == -1 ) || ( string.indexOf(".") == -1 ) )
  {
    alert("La dirección de correo electrónico no es valida.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Password.value == "")
  {
    alert("Por favor escribe tu password.");
    theForm.Password.focus();
    return (false);
  }
}

function ValidaRegistro(theForm)
{

  if (theForm.Nombre.value == "")
  {
    alert("Por favor escribe tu nombre.");
    theForm.Nombre.focus();
    return (false);
  }

  if (theForm.Nombre.value.length > 255)
  {
    alert("El nombre no debe exceder 255 caracteres.");
    theForm.Nombre.focus();
    return (false);
  }

  if (theForm.Email.value == "")
  {
    alert("Por favor escribe tu dirección de correo.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Email.value.length > 255)
  {
    alert("El email no debe exceder 255 caracteres.");
    theForm.Email.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-@._-";
  var checkStr = theForm.Email.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("La dirección de correo electrónico no es valida.");
    theForm.Email.focus();
    return (false);
  }
  
  var string=theForm.Email.value;
	if ( ( string.indexOf("@") == -1 ) || ( string.indexOf(".") == -1 ) )
	{
		alert("La dirección de correo electrónico no es valida.");
		theForm.Email.focus();
		return (false);
	}

  if (theForm.Edad.value == "")
  {
    alert("Por favor escribe tu edad.");
    theForm.Edad.focus();
    return (false);
  }

  if (theForm.Edad.value.length > 3)
  {
    alert("Por favor revisa tu edad.");
    theForm.Edad.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.Edad.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Por favor escribe con digitos tu edad.");
    theForm.Edad.focus();
    return (false);
  }

  var chkVal = allNum;
  var prsVal = parseInt(allNum);
  if (chkVal != "" && !(prsVal <= "150" && prsVal >= "1"))
  {
    alert("Por favor revisa tu edad.");
    theForm.Edad.focus();
    return (false);
  }

  if (theForm.Estudios.selectedIndex < 0)
  {
    alert("Selecciona tu grado máximo de estudios.");
    theForm.Estudios.focus();
    return (false);
  }

  if (theForm.Estudios.selectedIndex == 0)
  {
    alert("Selecciona tu grado máximo de estudios.");
    theForm.Estudios.focus();
    return (false);
  }
/*
  if (theForm.Password.value == "")
  {
    alert("Por favor escribe tu password.");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Password.value.length < 4)
  {
    alert("El password debe ser mayor de 4 caracteres y menor de 16.");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Password.value.length > 16)
  {
    alert("El password debe ser mayor de 4 caracteres y menor de 16.");
    theForm.Password.focus();
    return (false);
  }
*/
  if (theForm.Ciudad.value == "")
  {
    alert("Por favor escribe la ciudad donde vives.");
    theForm.Ciudad.focus();
    return (false);
  }

  if (theForm.Ciudad.value.length > 255)
  {
    alert("Por favor no excedas 255 caracteres.");
    theForm.Ciudad.focus();
    return (false);
  }

  if (theForm.Estado.selectedIndex < 0)
  {
    alert("Por favor selecciona un estado.");
    theForm.Estado.focus();
    return (false);
  }

  if (theForm.Estado.selectedIndex == 0)
  {
    alert("Por favor selecciona un estado.");
    theForm.Estado.focus();
    return (false);
  }
  return (true);
}