function Form1_Validator(theForm)
{

  var alertsay = ""; 

 if (theForm.user.value == "")
  {
    alert("Introduza o seu email completo.");
    theForm.user.focus();
    return (false);
  }


  // test if valid email address, must have @ and .
  var checkuser = "@.";
  var checkStr = theForm.user.value;
  var userValid = false;
  var userAt = false;
  var userPeriod = false;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkuser.length;  j++)
    {
      if (ch == checkuser.charAt(j) && ch == "@")
        userAt = true;
      if (ch == checkuser.charAt(j) && ch == ".")
        userPeriod = true;
	  if (userAt && userPeriod)
		break;
	  if (j == checkuser.length)
		break;
	}
	// if both the @ and . were in the string
    if (userAt && userPeriod)
    {
		userValid = true
		break;
	}
  }
  if (!userValid)
  {
    alert("O seu login tem de ser feito com o email completo.");
    theForm.user.focus();
    return (false);
  }

  if (theForm.pass.value == "")
  {
    alert("Insira a sua palavra chave.");
    theForm.pass.focus();
    return (false);
  }

  // require at least 3 characters be entered
  if (theForm.pass.value.length < 3)
  {
    alert("A sua palavra chave tem de ser mais longa do que isso!!!");
    theForm.pass.focus();
    return (false);
  }



  return (true);

}
