// Validação do form automático de venda
$(document).ready(function() {
   		$("form").submit(function() {
			var nome = jQuery.trim($("#nome").val());
			var email = jQuery.trim($("#email").val());
			var tel = jQuery.trim($("#tel").val());	
			var cidade = jQuery.trim($("#cidade").val());	
			var uf = jQuery.trim($("#uf").val());	
			var fabricante = jQuery.trim($("#fabricante").val());
			var modelo   = jQuery.trim($("#modelo").val());
			var ano      = jQuery.trim($("#ano").val());
			var placa    = jQuery.trim($("#placa").val());
			var km       = jQuery.trim($("#km").val());
			var mensagem = jQuery.trim($("#mensagem").val());
			if(nome != "" && email != "" && tel != "" && cidade != "" && uf != "" && fabricante != "" && modelo != "" && ano != "" && ano != "ANO" && placa != "" && placa != "PLACA" && km != "" && km != "KM" && mensagem != "") {
				return true;
			} else {
				if(nome == "") { alert("O campo Nome é de preenchimento obrigatório."); return false; $("#nome").focus(); }
				if(email == "") { alert("O campo Email é de preenchimento obrigatório."); return false; $("#email").focus(); }
				if(tel == "") { alert("O campo Telefone é de preenchimento obrigatório."); return false; $("#tel").focus(); }
				if(cidade == "") { alert("O campo Cidade é de preenchimento obrigatório."); return false; $("#cidade").focus(); }
				if(uf == "") { alert("O campo Estado é de preenchimento obrigatório."); return false; $("#uf").focus(); }
				if(fabricante == "") { alert("O campo Fabricante é de preenchimento obrigatório."); return false; $("#fabricante").focus(); }
				if(modelo == "") { alert("O campo Modelo é de preenchimento obrigatório."); return false; $("#modelo").focus(); }
				if(ano == "" || ano == "ANO") { alert("Favor inserir o ano do seu veículo."); return false; $("#ano").focus(); }
				if(placa == "" || placa == "PLACA") { alert("Favor inserir a placa do seu veículo."); return false; $("#placa").focus(); }
				if(km == "" || km == "KM") { alert("Favor inserir a quilometragem do seu veículo."); return false; $("#km").focus(); }
				if(mensagem == "") { alert("O campo Mensagem é de preenchimento obrigatório."); return false; $("#mensagem").focus(); }  
			}
		});
});
