
function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}


function FormValidator(theForm)
{

	if (theForm.nome.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Nome\".");
	theForm.nome.focus();
	return (false);
	}
	
	if (theForm.email.value.length >0)
	{
    if (!isEmailAddr(theForm.email.value))
    {
      alert("Por favor escreva um endereço de email completo no formato oseunome@oseudominio.com");
      theForm.email.focus();
      return (false);
    }
	}
	
	if (theForm.email.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Email\".");
	theForm.email.focus();
	return (false);
	}
	
	return (true);
}
  


