function validaDados(){
	if (document.getElementById("codtpvei").value=="") {
		window.alert("É necessário informar o Tipo de Busca!");
		document.getElementById("codtpvei").focus();
	}
	else if (document.getElementById("codfab").value=="" && document.getElementById("codtpvei").value == 5) {
		window.alert("É necessário informar o Fabricante!");
		document.getElementById("codfab").focus();
	}
	else if (document.getElementById("codcat").value=="" && document.getElementById("codtpvei").value != 5) {
		window.alert("É necessário informar a Categoria!");
		document.getElementById("codcat").focus();
	}
	
	else { 
	    var url = "";
		if (document.getElementById("codtpvei").value == 5 ) {
			var tipo = document.getElementById("codtpvei").value;
			var fabr  = document.getElementById("codfab").value;
			var mode  = document.getElementById("codmod").value;
			var anom  = document.getElementById("anomod").value;
			var ufmo  = document.getElementById("coduf").value;

			if (tipo!="") url = url + "&tp="+tipo;
			if (fabr!="") url = url + "&fa="+fabr;
			if (mode!="") url = url + "&md="+mode;
			if (anom!="") url = url + "&an="+anom;
			if (ufmo!="") url = url + "&uf="+ufmo;
			
		}
		else {
			var tipo = document.getElementById("codtpvei").value;
			var catg  = document.getElementById("codcat").value;
			var ufmo  = document.getElementById("coduf2").value;
			
			if (tipo!="") url = url + "&tp="+tipo;
			if (catg!="") url = url + "&ct="+catg;
			if (ufmo!="") url = url + "&uf="+ufmo;

			
		}
		des_url = "index.php?pg=6"+ url;
		
		document.location.href = des_url;
	}
	
}
