function buscaAjax(formulario)
 {	

	//alert(formulario);
	var url = "txtidformulario="+formulario;
	var concatenador = "";
 	for (var i= 0; i < document.getElementById(formulario).length; i++) {
		
		if (document.getElementById(formulario).elements.item(i).type != "button"){
		   if (document.getElementById(formulario).elements.item(i).type == "checkbox") 
			url += "&"+document.getElementById(formulario).elements.item(i).name+"="+document.getElementById(formulario).elements.item(i).checked;
		  else	
			url += "&"+document.getElementById(formulario).elements.item(i).name+"="+document.getElementById(formulario).elements.item(i).value;
			
		}
	}
	 var oHTTPRequest = createXMLHTTP(); 
     oHTTPRequest.open("post", "include/resultadobusca2.asp", true); 
     oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     document.getElementById('conteudopesq').innerHTML =carregando();
	 oHTTPRequest.onreadystatechange=function(){
      if (oHTTPRequest.readyState==4){// abaixo o texto gerado no arquivo executa.asp e colocado no div
         document.all.conteudopesq.innerHTML = oHTTPRequest.responseText;}}
		 
		 
      // oHTTPRequest.send("txtnumpage="+ strpagina +"&txttiponegocio="+ strtiponegocio+"&txttipo="+tipo   +"&txtmarca="+ strmarca +"&txtmodelo="+ strmodelo +"&txtversao="+ strversao +"&txtano="+strano+"&txtconbustivel="+ strconbustivel +"&txtkm="+ strkm +"&txtcambio="+ strcambio +"&txtcor="+ strcor +"txtpreco="+ srtpreco2 +"&txtvideo="+ strvideo +"&txtfoto="+ strfoto +"&txtcomercial="+ strcomercial +"&txtparticular="+ strparticular +"&txtc=1&txtcatbusca="+ strcatbusca +"&txtbusca="+ escape(strbusca) +"&txtbuscaoculta="+ encodeURI(strbuscaoculta) +"&txtcodanunciante="+strempresa+"&txtmais=<%= request.QueryString("txtmais")%>");
	 oHTTPRequest.send(url);
	 //document.getElementById("msg").innerHTML = url;
  	 
 }
 function carregando() {         var msg = "<img style='float:left;margin:150px 0 0 350px;' src='img/progresso.gif'>";        return msg;    }
 
  function chamaBuscaAjax(codempresa){
	if(codempresa != 0){
		buscaAjax('frmempresa');
	}else{
		alert("Selecione uma empresa");
	}
}
 
function navegarPesquisa(valor,idFormulario){
	document.getElementById("txtnumpage").value = valor;
	buscaAjax(idFormulario);
	
}

function buscaEmpresa(codAnunciante){
	
	if (codAnunciante == 0){
		document.getElementById("IDPARTICULAR").disabled = false;
		document.getElementById("TxtCodigoAnunciante").value = "";
	}
	else{
		document.getElementById("IDPARTICULAR").disabled = true;
		document.getElementById("TxtCodigoAnunciante").value = codAnunciante;
		
	}
		
		
}

    