var req;
var id_html;
var filtro1;

function Acha(tela,filtro,id_htm){
    id_html = null;
    id_html = id_htm;
    filtro1 = filtro;
    //alert(filtro);
    loadXMLDoc(tela,filtro);
}
function loadXMLDoc(url,filtro){
    req = null;
    //document.getElementById("aguarde").style.display='block';
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processa;
        req.open("GET", url+'?'+filtro, true);
        req.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processa;
            req.open("GET", url+'?'+filtro, true);
            req.send();
        }
    }
}
function processa(){
    // apenas quando o estado for "completado"
    if (req.readyState == 4) {
        // apenas se o servidor retornar "OK"
        if (req.status == 200) {
            // retornado nela, como texto HTML
            //alert(id_html);
            document.getElementById('Inicio').innerHTML = "";
            document.getElementById(id_html).innerHTML = req.responseText;
            if (filtro1.substring(0,1)=="#"){
              window.location.href=filtro1;
            }
            //document.getElementById("aguarde").style.display='none';
        } else {
            //alert("Houve um problema ao obter os dados:\n" + req.statusText);
            alert("Houve um problema ao obter os dados:\n");
        }
    }
}
//Função Voltar
function voltar(tela){
   // alert(tela);
    go(tela);
}
function Adiciona_trans(Id, Nome){
   //alert("hahah");
   document.pedido1.id_trans.value=Id;
   document.pedido1.nome_transportadora.value=Nome;
   document.getElementById(id_html).innerHTML = "";
   return false;
}

