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_newsletter(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);
	}
	
	if (theForm.data_nascimento.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Data Nascimento\".");
	theForm.data_nascimento.focus();
	return (false);
	}
	
	if (theForm.morada.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Morada\".");
	theForm.morada.focus();
	return (false);
	}
	
	if (theForm.telefone.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Telefone\".");
	theForm.telefone.focus();
	return (false);
	}
	
	if (theForm.categoria.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Categoria\".");
	theForm.categoria.focus();
	return (false);
	}
	
	if (theForm.viatura.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Viatura\".");
	theForm.viatura.focus();
	return (false);
	}
	
	if (theForm.entrada_inicial.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Entrada Inicial\".");
	theForm.entrada_inicial.focus();
	return (false);
	}
	
	if (theForm.prazo.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Prazo\".");
	theForm.prazo.focus();
	return (false);
	}
	
	if (theForm.valor_residual.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Valor Residual\".");
	theForm.valor_residual.focus();
	return (false);
	}
	
	if (theForm.seguro_credito.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Seguro Credito\".");
	theForm.seguro_credito.focus();
	return (false);
	}
	
	if (theForm.responsabilidade_civil.value.length == "")
	{
	alert("Por favor escreva os seus dados para o campo \"Responsabilidade Civil\".");
	theForm.responsabilidade_civil.focus();
	return (false);
	}
		
	return (true);
}
  


