function keyUp() {
			valor = document.getElementById("texto").value;
			if(valor.length >= 3) {
				if(document.getElementById("estab").checked) {
				var tipo = "estab";				
				} else {
				var tipo = "segm";				
				}

				$("#load").load("ajax.php?prev="+valor+"&tipo="+tipo);
				$("#load").fadeIn("slow");
			} else if(valor.length < 3) {
				$("#load").fadeOut("fast");
			}
		}
		
		function fechar() {
		$("#load").fadeOut("fast");	
		}
		
		function inserir(txt) {
			document.getElementById("texto").value = txt;
			$("#load").fadeOut("fast");		
		}
		
		function search() {
		if(document.getElementById("texto").value == "") {
			$("#resposta").html('<div id="total"><div id="alerta"><p>Para que você possa realiza a pesquisa é necessário digitar alguma paravra no campo de texto!</p>&nbsp;<input type="button" onclick="fecharAlerta()" value="Fechar" /></div></div>');
			$("#alerta").toggle("slow");
		} else {
		$("#resposta").html("<p>Carregando pesquisa...</p><br/><br/><br/>");
		$.post("ajax.php",
			$("#formSer").serialize()+'&search='+1, 
			function(data)	{
			$("#resposta").html(data);
			});
		}
		return false;
		}
		

		function fecharAlerta() {
		$("#alerta").slideUp("fast");
		$("#total").fadeOut("slow");		
		}

		function validar() {
			var erro = new Array();
			if(document.getElementById("texto").value == "") {
			erro.push("Digite alguma palavra para pesquisar");
			}
			if(document.getElementById("filtro").value == "") {
			erro.push(" escolha uma cidade.");
			}
			
			if(erro.length > 0) {
			alert("Erro!\r\n"+erro);
			return false;
			}
			
		}
