function validaForm(n){
 //função que verifica a existencia de campos
	function verificaCampo(obj) {
		try {
			eval('foo = ' + obj + '.value;')
		}
		catch (e) {
			return false;
		}
		return true;
	}
 //validar nome
	if ((n.nome.value == "")||(n.nome.value.length < 3)){
		alert("Favor informar a razao social da Empresa.");
		n.nome.focus();
		return false;
	}
	
	if ((n.contato.value == "")||(n.contato.value.length < 3)){
		alert("Favor informar o nome do contato.");
		n.contato.focus();
		return false;
	}

	if (n.crm.value == ""){
		alert("Favor informar o numero do CRM");
		n.crm.focus();
		return false;
	}

   if ((n.cnpj.value == "")||(n.cnpj.value.length < 14)){
		alert("Favor informar o CNPJ.");
		n.cnpj.focus();
		return false;
	}
  if ((n.fone.value == "")||(n.fone.value.length < 14)){
		alert("Favor informar o telefone.");
		n.fone.focus();
		return false;
	}

	if (n.email.value == ""){
		alert("Favor informar o e-mail.");
		n.email.focus();
		return false;
	}
      if ((n.endereco.value == "")||(n.endereco.value.length < 3)){
		alert("Favor informar o endereco.");
		n.endereco.focus();
		return false;
	}

   //campo cidade
	Campo = verificaCampo('n.municipio');
		if (Campo) {
             if ((n.municipio.value == "")||(n.municipio.value.length < 2)){
				alert("Favor informar o municipio.");
				n.municipio.focus();
				return false;
			}
		}


	//campo UF
	Campo = verificaCampo('n.uf');
		if (Campo) {
             if ((n.uf.value == "")||(n.uf.value.length < 2)){
				alert("Favor informar o Estado(UF).");
				n.uf.focus();
				return false;
			}
		}
     //campo cep
	Campo = verificaCampo('n.cep');
		if (Campo) {
			if (n.cep.value.length < 9){
                alert("Favor informar o CEP.");
				n.cep.focus();
				return false;
			}
		}
   	//campo mensagem
	Campo = verificaCampo('n.mensagem');
		if (Campo) {
			if (n.mensagem.value == ""){
				alert("Favor escrever uma mensagem.");
				n.mensagem.focus();
				return false;
			}
		}


// O formulário está correto. Enviar submit( ).
	//return true;
	n.submit();
}
// ****************************************************

