function valida(theForm) {

    if (theForm.nome.value == ""){
        alert("ERRO:\nNome não informado.");
        theForm.nome.focus();
        return false;
    }
    
    if (theForm.empresa.value == ""){
        alert("ERRO:\nEmpresa não informado.");
        theForm.empresa.focus();
        return false;
    }

    if(theForm.email.value == "" && theForm.fone.value == ""){
         alert("ERRO:\nÉ necessário informar um e-mail\nou o número de um telefone para contato.");
         theForm.email.focus();
         return false;
    }else{

        if (theForm.email.value != ""){
            re=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
            if(!re.test(theForm.email.value)){
                alert("ERRO:\nEndereço eletrônico inválido.");
                theForm.email.focus();
                return false;
            }
         }
    }
     
    if (theForm.mensagem.value == ""){
        alert("ERRO:\nNenhuma mensagem informada.");
        return false;
    }
    
    return true;
}
