function valida() 
  {            
var pw1 = document.avarias.email.value;
var pw2 = document.avarias.email_again.value;

                        
				if (document.avarias.Nome.value !="")
				{
					if (document.avarias.Nome.value.length < 4)
					{
						alert("Por favor preencha o nome completo.");
						document.avarias.Nome.focus();
						return false;
					}
				}
				else
				    {
					alert("Por favor preencha o nome.");
					document.avarias.Nome.focus(); 
					return false;
					}
					
					if (document.avarias.local.value !="")
				{
					if (document.avarias.local.value.length < 5)
					{
						alert("Por favor, insira o local o mais completo possivel.");
						document.avarias.local.focus();
						return false;
					}
				}
				else
				{
					alert("Por favor, insira o local.");
					document.avarias.local.focus();
					return false;
				}
				if (document.avarias.Localidade.value == -1)
				{
					
					alert("Por favor, escolha a localidade.");
					document.avarias.Localidade.focus();
					return false;
				}
				if (document.avarias.email.value !="")
				{
					email=document.avarias.email.value;
					if (email.indexOf("@",0) == -1)
					{
						alert("Por favor, preencha o E-mail completo.");
						document.avarias.email.focus();
						return false;
					}
				}
				else
				{
					alert("Por favor, preencha o E-mail.");
					document.avarias.email.focus();
					return false;
				}	
				if (document.avarias.email_again.value !="")
				{
					email=document.avarias.email_again.value;
					if (email.indexOf("@",0) == -1)
					{
						alert("Por favor, comfirme o E-mail correctamente.");
						document.avarias.email_again.focus();
						return false;
					}
				}
				else
				{
					alert("Por favor, confirme o E-mail.");
					document.avarias.email_again.focus();
					return false;
				}	
                  if (pw1 != pw2)
                                   {
                alert ("Verifique, o E-mail não é igual!");
                return false;
                 }
                 
               }
