fila=[]; // Esvasia a Array Fila
ifila=0; // Zera a variável de Loop


function GM_FilaAjax_Adm(Campo,Consulta,Refe,Selecionado){
    fila[fila.length]=[Campo,Consulta,Refe,Selecionado]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDaDosPacotesNovoAjax()   // Compara quat.Fila, Executa a Primeira ação da Fila
}


function GM_FilaAjax_Adm2(Campo,Consulta,Refe,Selecionado){
    fila[fila.length]=[Campo,Consulta,Refe,Selecionado]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDaDosPacotesNovoAjax2()   // Compara quat.Fila, Executa a Primeira ação da Fila
}

function GM_FilaAjax_B2bRodoviario_1(Campo,Consulta,Refe,Selecionado){
    fila[fila.length]=[Campo,Consulta,Refe,Selecionado]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDaDosPacotesRODOVIARIOBuscaTarifas()   // Compara quat.Fila, Executa a Primeira ação da Fila
}


//==== EXCLUSÃO DE DATAS DE PACOTES DE MELHOR IDADE B2B OPERADORAS ====\\
  function GM_AjaxExcluirData_PacoteMelhorIDADE(vID_Pacote,vDT_Excluir,vStatus){
    fila[fila.length]=[vID_Pacote,vDT_Excluir,vStatus]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_ExcluiDT_PacoteMelhorIDADE()   // Compara quat.Fila, Executa a Primeira ação da Fila
  }


// ====================================================================\\


function GM_FilaAjax_AdmMunicipiosInsumos(Campo,Consulta,Refe,Selecionado){
    fila[fila.length]=[Campo,Consulta,Refe,Selecionado]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDaDosMunicipioInsumos()   // Compara quat.Fila, Executa a Primeira ação da Fila
}



// PACOTES MELHOR IDADE (ADM) BUSCA MUNICIPIOS \\

function GM_FilaAjax_Adm_Municipios_PMI(Campo,Consulta,Refe,Selecionado){
    fila[fila.length]=[Campo,Consulta,Refe,Selecionado]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDaDos_Municipio_PMI()   
}


function GM_FilaAjax_Adm_Municipios_AgenciasBusca(Campo,Consulta,Refe,Selecionado){
    fila[fila.length]=[Campo,Consulta,Refe,Selecionado]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDados_Municipios_AGENCIA_BUSCA_ADM()  
}

// ------------------------------------------- \\





function GM_FilaAjax(Campo,Consulta,Refe,Selecionado){
    fila[fila.length]=[Campo,Consulta,Refe,Selecionado]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDaDosAjax()   // Compara quat.Fila, Executa a Primeira ação da Fila
}

function GM_FilaAjax2(Campo,Consulta,Refe,Selecionado){
    fila[fila.length]=[Campo,Consulta,Refe,Selecionado]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDaDosAjax2()   // Compara quat.Fila, Executa a Primeira ação da Fila
}


function GM_FilaAjaxIndex(Campo,Consulta,Refe,Selecionado){
    fila[fila.length]=[Campo,Consulta,Refe,Selecionado]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDaDosAjaxIndex()   // Compara quat.Fila, Executa a Primeira ação da Fila
}


function GM_FilaAjaxBusca(Campo,Consulta,Refe,Selecionado){
    fila[fila.length]=[Campo,Consulta,Refe,Selecionado]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDaDosAjaxBusca()   // Compara quat.Fila, Executa a Primeira ação da Fila
}


function GM_AjaxMarcaLidaFila(TipoStatus,IdCampoStaus,IdTabElo,IdMensagem){
    fila[fila.length]=[TipoStatus,IdCampoStaus,IdTabElo,IdMensagem]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_MarcaItegreSe_Lida()   // Compara quat.Fila, Executa a Primeira ação da Fila
}




function GM_AjaxConsultaLogin(Tx_Login){
    fila[fila.length]=[Tx_Login]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_BuscaLogin()   // Compara quat.Fila, Executa a Primeira ação da Fila
}


//==== EXCLUSÃO DE DATAS DE PACOTES DE MELHOR IDADE B2B OPERADORAS ====\\

  function GM_ExcluiDT_PacoteMelhorIDADE(){
     
     
      ometodo = getMetodo();
	    xmlhttp = getHTTPObject();
	    url_asp = "";
	    if (ifila != fila.length) {
	      var vID_Pacote = fila[ifila][0];
	      var vDT_Excluir = fila[ifila][1];
        var vStatus = fila[ifila][2];
        
        
        url_asp = "../extranet/ajax_consulta.asp?controle=29&ID_Pacote="+vID_Pacote+"&DT_Excluir="+vDT_Excluir+"&Status="+vStatus;
	      xmlhttp.open(ometodo,url_asp,true);
	      xmlhttp.onreadystatechange=function(){
	      if(xmlhttp.readyState == 4) {
           var vRetorno = xmlhttp.responseText;

           document.getElementById("retorno_inclusao_exclusao").innerHTML="";
		       var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
           document.getElementById("retorno_inclusao_exclusao").innerHTML=vRetorno;
            
            
        }
        
        ifila++;// Soma 1 na Fila
        if(ifila<fila.length){
          GM_AjaxExcluirData_PacoteMelhorIDADE(vID_Pacote,vDT_Excluir,vStatus);
        }
        else{
          fila=[];
          ifila = 0;
        }
  }
  xmlhttp.send(null);
	return false;
	}  

}
// ------------------------------------------- \\


//==| INCLUSÃO DE DATA DE SAÍDA |==|

  function GM_Ajax_INCLUIRData_PacoteMelhorIDADE(ID_PACOTE,DT_ADD){
  
      ometodo = getMetodo();
	    xmlhttp = getHTTPObject();
	    url_asp = "";
      var vID_Pacote = ID_PACOTE;
      var vDT_ADD = DT_ADD;
	
    	url_asp = "../extranet/ajax_consulta.asp?controle=30&ID_Pacote="+vID_Pacote+"&DT_ADD="+vDT_ADD+"";
     
      var Rnd = GM_Random();
      if(url_asp.indexOf("?")>=0){
	      // já tem parametros vindos na url
	      url_asp = url_asp + "&rnd=" + Rnd;
      }
      else{ 
	      url_asp = url_asp + "?rnd=" + Rnd;
      }

      
      xmlhttp.open(ometodo,url_asp,true);
      xmlhttp.onreadystatechange=function(){
	          if(xmlhttp.readyState == 4) {
             var vRetorno = xmlhttp.responseText;
             document.getElementById("retorno_inclusao_exclusao").innerHTML="";
	           var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
             document.getElementById("retorno_inclusao_exclusao").innerHTML=vRetorno;

           }
      }
      xmlhttp.send(null);
      return false;
}


//-----\\

function GM_MarcaItegreSe_Lida(){
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
	if (ifila != fila.length) {
	  var vTipoStatus = fila[ifila][0];
	  var vIdCampoStatus = fila[ifila][1];
    var vIdTabElo = fila[ifila][2];     // Carrega a variável 'Campo de Retorno'
    var vIdMensagem = fila[ifila][3];  // Carrega a variável 'Tipo de Consulta'
    
    
    url_asp = "../extranet/ajax_consulta.asp?controle=22&IdTabElo="+vIdTabElo+"&IdMensagem="+vIdMensagem+"&TipoStatus="+vTipoStatus;

    

    xmlhttp.open(ometodo,url_asp,true);
	  xmlhttp.onreadystatechange=function(){
		  if(xmlhttp.readyState == 4) {
		      
		      document.getElementById(vIdCampoStatus).innerHTML="Lida";
		      
		       //var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
	         ifila++;// Soma 1 na Fila
           if(ifila<fila.length){
              GM_AjaxMarcaLidaFila(vTipoStatus,vIdCampoStatus,vIdTabElo,vIdMensagem);
           }
           else{
	          fila=[];
	          ifila = 0;
           }
	      }  
	   }
    xmlhttp.send(null);
	  return false;
	}  
	
	
	
	

}



function GM_AjaxMostraTextoFila(IdMensagem,IdCampoStatus,IdTabElo){
    fila[fila.length]=[IdMensagem,IdCampoStatus,IdTabElo]// Preenche a Array Fila
    if((ifila+1)==fila.length)AjaxMostraTextoMensagem()   // Compara quat.Fila, Executa a Primeira ação da Fila
}




function AjaxMostraTextoMensagem(){
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
	
	if (ifila != fila.length) {
	  var vIdMensagem = fila[ifila][0];
	  var vIdCampoStatus = fila[ifila][1];
	  var vIdTabElo = fila[ifila][2];
	

    url_asp = "../extranet/ajax_consulta.asp?controle=23&IdMensagem="+vIdMensagem+"&IdTabElo="+vIdTabElo;

    xmlhttp.open(ometodo,url_asp,true);
	  xmlhttp.onreadystatechange=function(){
		  if(xmlhttp.readyState == 4) {
          
          var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		      var vSepara = vRetorno.split("*"); 
		      var vMarca = vSepara[0];
		      var vTexto = vSepara[1];
  

          
		      document.getElementById("Mensagem").innerHTML=vTexto;
          
          if(vIdCampoStatus!="0" && vIdTabElo!="0"){  
            if(vMarca!="Respondida"){
              document.getElementById(vIdCampoStatus).innerHTML=vMarca;
            }
          }

          ifila++;// Soma 1 na Fila
           if(ifila<fila.length){
               setTimeout("GM_AjaxMostraTextoFila('"+vIdMensagem+"')",20)
           }
           else{
	          fila=[];
	          ifila = 0;
           }
          
	      }  
	   }
    xmlhttp.send(null);
	  return false;
  }

}




function GM_AlimentaDaDosMunicipioInsumos(){
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
  
  if (ifila != fila.length) {
    var vOCampo = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
    var vAConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
    var vAReferenc = fila[ifila][2];  // Carrega a variável 'Referência (UF)'
    var vSeleciona = fila[ifila][3];  // Carrega a variável 'Campo já selecionado'
    if(vAConsulta=="MunicipioDestino"){
      url_asp = "../extranet/ajax_consulta.asp?controle=25&uf="+vAReferenc;
    }
    xmlhttp.open(ometodo,url_asp,true);
	  xmlhttp.onreadystatechange=function(){
		  if(xmlhttp.readyState == 4) {
		      
		      document.getElementById(vOCampo).options.length = 1;// Zera a ComboBox 'Selecione'
		      var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		      var vId_Nome = vRetorno.split('*');   // Splita as linhas
		       //insere os novos valores
           for(var i=0; i < vId_Nome.length-1; i++) {
               var Lista = vId_Nome[i].split('|'); //separa ID do Nome pelo Split Barra(|)
               var vId = Lista[0];      // Carrega a variável 'Id'
               var vNome = Lista[1];    // Carrega a variável 'Nome'
               var vCapital = Lista[2]; // No caso de pesquisa de cidades, usa a informação se é capital
               opcoes = document.createElement("option");// Cria o elemento '<option>'
               opcoes.value = vId;  // Carrega o Option criado com o 'ID'
               opcoes.text = vNome; // Carrega o Option criado com o 'Nome'
             
               if(vSeleciona!=""){
                   if (vSeleciona == vId){// Verifica 
                       opcoes.setAttribute("selected", "true");
                   }
               }
               else{
                   if(vCapital=="1" && vSeleciona != vId){// Caso seja capital, seleciona
                     opcoes.setAttribute("selected", "true");
                   }
               }
		           document.getElementById(vOCampo).options.add(opcoes);// Monta a Primeira Linha da ComboBox
	          }
	         ifila++;// Soma 1 na Fila
           if(ifila<fila.length){
            if(vAConsulta="MunicipioDestino"){
              setTimeout("GM_AlimentaDados('2')",20)
            }
           }
           else{
	          fila=[];
	          ifila = 0;
           }
	      }  
	   }
    xmlhttp.send(null);
	  return false;
	} 


}



// ----------| PACOTES MELHOR IDADE |------------------ \\

  function GM_AlimentaDaDos_Municipio_PMI(){
        ometodo = getMetodo();
	      xmlhttp = getHTTPObject();
	      url_asp = "";
        
        if (ifila != fila.length) {
          var vOCampo = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
          var vAConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
          var vAReferenc = fila[ifila][2];  // Carrega a variável 'Referência (UF)'
          var vSeleciona = fila[ifila][3];  // Carrega a variável 'Campo já selecionado'
          if(vAConsulta=="MunicipioOrigem"){
            url_asp = "../extranet/ajax_consulta.asp?controle=28&uf="+vAReferenc;
          }
          
          if(vAConsulta=="MunicipioDestino"){
            url_asp = "../extranet/ajax_consulta.asp?controle=28&uf="+vAReferenc;
          }
          
          
          xmlhttp.open(ometodo,url_asp,true);
	        xmlhttp.onreadystatechange=function(){
		        if(xmlhttp.readyState == 4) {
      		      
		            document.getElementById(vOCampo).options.length = 0;// Zera a ComboBox 'Selecione'
		            var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		            var vId_Nome = vRetorno.split('*');   // Splita as linhas
		             //insere os novos valores
                 for(var i=0; i < vId_Nome.length-1; i++) {
                     var Lista = vId_Nome[i].split('|'); //separa ID do Nome pelo Split Barra(|)
                     var vId = Lista[0];      // Carrega a variável 'Id'
                     var vNome = Lista[1];    // Carrega a variável 'Nome'
                     var vCapital = Lista[2]; // No caso de pesquisa de cidades, usa a informação se é capital
                     opcoes = document.createElement("option");// Cria o elemento '<option>'
                     opcoes.value = vId;  // Carrega o Option criado com o 'ID'
                     opcoes.text = vAReferenc +"-"+vNome; // Carrega o Option criado com o 'Nome'
                   

		                 document.getElementById(vOCampo).options.add(opcoes);// Monta a Primeira Linha da ComboBox
	                }
	               ifila++;// Soma 1 na Fila
                 if(ifila<fila.length){
                  if(vAConsulta="MunicipioDestino"){
                    setTimeout("GM_AlimentaDados_Municipios_PMI('1')",20)
                  }
                  if(vAConsulta="MunicipioOrigem"){
                    setTimeout("GM_AlimentaDados_Municipios_PMI('2')",20)
                  }
                  
                 }
                 else{
	                fila=[];
	                ifila = 0;
                 }
	            }  
	         }
          xmlhttp.send(null);
	        return false;
	      }
  }



  function GM_AlimentaDados_Municipios_AGENCIA_BUSCA_ADM(){
        ometodo = getMetodo();
	      xmlhttp = getHTTPObject();
	      url_asp = "";
        
        if (ifila != fila.length) {
          var vOCampo = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
          var vAConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
          var vAReferenc = fila[ifila][2];  // Carrega a variável 'Referência (UF)'
          var vSeleciona = fila[ifila][3];  // Carrega a variável 'Campo já selecionado'
          if(vAConsulta=="Municipio"){
            url_asp = "../extranet/ajax_consulta.asp?controle=28&uf="+vAReferenc;
          }
                  
          
          xmlhttp.open(ometodo,url_asp,true);
	        xmlhttp.onreadystatechange=function(){
		        if(xmlhttp.readyState == 4) {
      		      
		            document.getElementById(vOCampo).options.length = 1;// Zera a ComboBox 'Selecione'
		            var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		            var vId_Nome = vRetorno.split('*');   // Splita as linhas
		             //insere os novos valores
                 for(var i=0; i < vId_Nome.length-1; i++) {
                     var Lista = vId_Nome[i].split('|'); //separa ID do Nome pelo Split Barra(|)
                     var vId = Lista[0];      // Carrega a variável 'Id'
                     var vNome = Lista[1];    // Carrega a variável 'Nome'
                     var vCapital = Lista[2]; // No caso de pesquisa de cidades, usa a informação se é capital
                     opcoes = document.createElement("option");// Cria o elemento '<option>'
                     opcoes.value = vId;  // Carrega o Option criado com o 'ID'
                     opcoes.text = vNome; // Carrega o Option criado com o 'Nome'
                     
                     if(vSeleciona!=""){
                         if (vSeleciona == vId){// Verifica 
                             opcoes.setAttribute("selected", "true");
                         }
                     }
                     else{
                         if(vCapital=="1" && vSeleciona != vId){// Caso seja capital, seleciona
                           opcoes.setAttribute("selected", "true");
                         }
                     }
                     

		                 document.getElementById(vOCampo).options.add(opcoes);// Monta a Primeira Linha da ComboBox
	                }
	               ifila++;// Soma 1 na Fila
                 if(ifila<fila.length){
                  if(vAConsulta="Municipio"){
                    setTimeout("GM_AlimentaDados_Municipios_AGENCIA_BUSCA('1')",20)
                  }

                  
                 }
                 else{
	                fila=[];
	                ifila = 0;
                 }
	            }  
	         }
          xmlhttp.send(null);
	        return false;
	      }
  
  
  
  }






// ---------------------------------------------------- \\





function GM_AlimentaDaDosPacotesNovoAjax(){
  
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
  
  if (ifila != fila.length) {
    var vOCampo = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
    var vAConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
    var vAReferenc = fila[ifila][2];  // Carrega a variável 'Referência (UF)'
    var vSeleciona = fila[ifila][3];  // Carrega a variável 'Campo já selecionado'
    if(vAConsulta=="MunicipioOrigem"){
      url_asp = "../extranet/ajax_consulta.asp?controle=13&uf="+vAReferenc;
    }
    if(vAConsulta=="MunicipioDestino"){
      url_asp = "../extranet/ajax_consulta.asp?controle=14&uf="+vAReferenc;
    }
    

    xmlhttp.open(ometodo,url_asp,true);
	  xmlhttp.onreadystatechange=function(){
		  if(xmlhttp.readyState == 4) {
		      
		      document.getElementById(vOCampo).options.length = 1;// Zera a ComboBox 'Selecione'
		      var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		      var vId_Nome = vRetorno.split('*');   // Splita as linhas
		       //insere os novos valores
           for(var i=0; i < vId_Nome.length-1; i++) {
               var Lista = vId_Nome[i].split('|'); //separa ID do Nome pelo Split Barra(|)
               var vId = Lista[0];      // Carrega a variável 'Id'
               var vNome = Lista[1];    // Carrega a variável 'Nome'
               var vCapital = Lista[2]; // No caso de pesquisa de cidades, usa a informação se é capital
               opcoes = document.createElement("option");// Cria o elemento '<option>'
               opcoes.value = vId;  // Carrega o Option criado com o 'ID'
               opcoes.text = vNome; // Carrega o Option criado com o 'Nome'
             
               if(vSeleciona!=""){
                   if (vSeleciona == vId){// Verifica 
                       opcoes.setAttribute("selected", "true");
                   }
               }
               else{
                   if(vCapital=="1" && vSeleciona != vId){// Caso seja capital, seleciona
                     opcoes.setAttribute("selected", "true");
                   }
               }
		           document.getElementById(vOCampo).options.add(opcoes);// Monta a Primeira Linha da ComboBox
	          }
	         ifila++;// Soma 1 na Fila
           //if(vAConsulta=="MunicipioOrigem")setTimeout("GM_AlimentaDados('1');",20)// se for Município destino Recarrega o Município
           if(ifila<fila.length){
            if(vAConsulta="MunicipioOrigem"){
              setTimeout("GM_AlimentaDados('1')",20)
            }
            if(vAConsulta="MunicipioDestino"){
              setTimeout("GM_AlimentaDados('2')",20)
            }
           }
           else{
	          fila=[];
	          ifila = 0;
           }
	      }  
	   }
    xmlhttp.send(null);
	  return false;
	}  
	
}


function GM_AlimentaDaDosPacotesRODOVIARIOBuscaTarifas(){
  
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
  
  if (ifila != fila.length) {
    var vOCampo = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
    var vAConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
    var vAReferenc = fila[ifila][2];  // Carrega a variável 'Referência (UF)'
    var vSeleciona = fila[ifila][3];  // Carrega a variável 'Campo já selecionado'
    if(vAConsulta=="MunicipioOrigem"){
      url_asp = "../extranet/ajax_consulta.asp?controle=26&uf="+vAReferenc;
    }
    if(vAConsulta=="MunicipioDestino"){
      url_asp = "../extranet/ajax_consulta.asp?controle=27&uf="+vAReferenc;
    }
    xmlhttp.open(ometodo,url_asp,true);
	  xmlhttp.onreadystatechange=function(){
		  if(xmlhttp.readyState == 4) {
		      
		      document.getElementById(vOCampo).options.length = 1;// Zera a ComboBox 'Selecione'
		      var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		      var vId_Nome = vRetorno.split('*');   // Splita as linhas
		       //insere os novos valores
           for(var i=0; i < vId_Nome.length-1; i++) {
               var Lista = vId_Nome[i].split('|'); //separa ID do Nome pelo Split Barra(|)
               var vId = Lista[0];      // Carrega a variável 'Id'
               var vNome = Lista[1];    // Carrega a variável 'Nome'
               var vCapital = Lista[2]; // No caso de pesquisa de cidades, usa a informação se é capital
               opcoes = document.createElement("option");// Cria o elemento '<option>'
               opcoes.value = vId;  // Carrega o Option criado com o 'ID'
               opcoes.text = vNome; // Carrega o Option criado com o 'Nome'
             
               if(vSeleciona!=""){
                   if (vSeleciona == vId){// Verifica 
                       opcoes.setAttribute("selected", "true");
                   }
               }
               else{
                   if(vCapital=="1" && vSeleciona != vId){// Caso seja capital, seleciona
                     opcoes.setAttribute("selected", "true");
                   }
               }
		           document.getElementById(vOCampo).options.add(opcoes);// Monta a Primeira Linha da ComboBox
	          }
	         ifila++;// Soma 1 na Fila
           //if(vAConsulta=="MunicipioOrigem")setTimeout("GM_AlimentaDados('1');",20)// se for Município destino Recarrega o Município
           if(ifila<fila.length){
            if(vAConsulta="MunicipioOrigem"){
              setTimeout("GM_AlimentaDados('1')",20)
            }
            if(vAConsulta="MunicipioDestino"){
              setTimeout("GM_AlimentaDados('2')",20)
            }
           }
           else{
	          fila=[];
	          ifila = 0;
           }
	      }  
	   }
    xmlhttp.send(null);
	  return false;
	}  


}



function GM_AlimentaDaDosPacotesNovoAjax2(){
  
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
  
  if (ifila != fila.length) {
    var vOCampo = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
    var vAConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
    var vAReferenc = fila[ifila][2];  // Carrega a variável 'Referência (UF)'
    var vSeleciona = fila[ifila][3];  // Carrega a variável 'Campo já selecionado'
    if(vAConsulta=="MunicipioOrigem"){
      url_asp = "../extranet/ajax_consulta.asp?controle=15&uf="+vAReferenc;
    }
    if(vAConsulta=="MunicipioDestino"){
      url_asp = "../extranet/ajax_consulta.asp?controle=16&uf="+vAReferenc;
    }
    xmlhttp.open(ometodo,url_asp,true);
	  xmlhttp.onreadystatechange=function(){
		  if(xmlhttp.readyState == 4) {
		      
		      document.getElementById(vOCampo).options.length = 1;// Zera a ComboBox 'Selecione'
		      var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		      var vId_Nome = vRetorno.split('*');   // Splita as linhas
		       //insere os novos valores
           for(var i=0; i < vId_Nome.length-1; i++) {
               var Lista = vId_Nome[i].split('|'); //separa ID do Nome pelo Split Barra(|)
               var vId = Lista[0];      // Carrega a variável 'Id'
               var vNome = Lista[1];    // Carrega a variável 'Nome'
               var vCapital = Lista[2]; // No caso de pesquisa de cidades, usa a informação se é capital
               opcoes = document.createElement("option");// Cria o elemento '<option>'
               opcoes.value = vId;  // Carrega o Option criado com o 'ID'
               opcoes.text = vNome; // Carrega o Option criado com o 'Nome'
             
               if(vSeleciona!=""){
                   if (vSeleciona == vId){// Verifica 
                       opcoes.setAttribute("selected", "true");
                   }
               }
               else{
                   if(vCapital=="1" && vSeleciona != vId){// Caso seja capital, seleciona
                     opcoes.setAttribute("selected", "true");
                   }
               }
		           document.getElementById(vOCampo).options.add(opcoes);// Monta a Primeira Linha da ComboBox
	          }
	         ifila++;// Soma 1 na Fila
           //if(vAConsulta=="MunicipioOrigem")setTimeout("GM_AlimentaDados('1');",20)// se for Município destino Recarrega o Município
           if(ifila<fila.length){
            if(vAConsulta="MunicipioOrigem"){
              setTimeout("GM_AlimentaDados('1')",20)
            }
            if(vAConsulta="MunicipioDestino"){
              setTimeout("GM_AlimentaDados('2')",20)
            }
           }
           else{
	          fila=[];
	          ifila = 0;
           }
	      }  
	   }
    xmlhttp.send(null);
	  return false;
	}  
	
}








function GM_AlimentaDaDosAjax(){
	ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
	
	if (ifila != fila.length) {// Abaixo coloca na <label contador> o Progresso da Ação
      //document.getElementById("contador").innerHTML = 'Carregando... ('+ (ifila+1) + ' - ' + Math.round(((ifila + 1) / fila.length) * 100) + '%)'; // mostra progresso

	    var vOCampo = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
	    var vAConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
	    var vAReferenc = fila[ifila][2];  // Carrega a variável 'Referência (Id)'
	    var vSeleciona = fila[ifila][3];  // Carrega a variável 'Campo já selecionado'

    		  
	    if(vAConsulta=="MunicipioOrigem"){ // -> Busca Cidade por Estado Ogigem
	      url_asp = "ajax_consulta.asp?controle=1&uf="+vAReferenc;
	    }
	    else if(vAConsulta=="MunicipioDestino"){ // -> Busca Cidade por Estado Destino
	      url_asp = "ajax_consulta.asp?controle=1&uf="+vAReferenc;
	    }
	    else if(vAConsulta=="Receptivo"){ // -> Busca Receptivos por Cidade Destino
	      url_asp = "ajax_consulta.asp?controle=2&id_cidade="+vAReferenc;
	    }
	    else if(vAConsulta=="Hotel"){ // -> Busca Hotel por Cidade Destino
	      url_asp = "ajax_consulta.asp?controle=3&id_cidade="+vAReferenc;
	    }
	    else if(vAConsulta=="MunicipioOrigemDesativado"){
	      url_asp = "ajax_consulta.asp?controle=4&id="+vAReferenc;
	    }
	    else if(vAConsulta=="TarifasMH"){ // -> Busca Tarifas pelo Meio de Hospedagem
	      url_asp = "ajax_consulta.asp?controle=5&idMH="+vAReferenc;
	    }
	    else if(vAConsulta=="VooDeIda"){
        url_asp = "ajax_consulta.asp?controle=6&IdCia="+vAReferenc[0]+"&SiglaOrigem="+vAReferenc[1]+"&SiglaDestino="+vAReferenc[2];
	    }
	    else if(vAConsulta=="VooDeVolta"){
        url_asp = "ajax_consulta.asp?controle=6&IdCia="+vAReferenc[0]+"&SiglaOrigem="+vAReferenc[1]+"&SiglaDestino="+vAReferenc[2];
	    }
	    else if(vAConsulta=="MunicipioEscolhaIntegrese"){
	      url_asp = "ajax_consulta.asp?controle=21&uf="+vAReferenc+"&IdTipoElo="+vSeleciona;
	    }
	    
	    

	    xmlhttp.open(ometodo,url_asp,true);
	    xmlhttp.onreadystatechange=function(){
		    if(xmlhttp.readyState == 4) {
		      document.getElementById(vOCampo).options.length = 1;// Zera a ComboBox 'Selecione'
		      var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		      var vId_Nome = vRetorno.split('*');   // Splita as linhas
		       //insere os novos valores
           for(var i=0; i < vId_Nome.length-1; i++) {
             var Lista = vId_Nome[i].split('|'); //separa ID do Nome pelo Split Barra(|)
             var vId = Lista[0];      // Carrega a variável 'Id'
             var vNome = Lista[1];    // Carrega a variável 'Nome'
             var vCapital = Lista[2]; // No caso de pesquisa de cidades, usa a informação se é capital
             opcoes = document.createElement("option");// Cria o elemento '<option>'
             opcoes.value = vId;  // Carrega o Option criado com o 'ID'
             opcoes.text = vNome; // Carrega o Option criado com o 'Nome'
             
             if(vSeleciona!=""){
                 if (vSeleciona == vId){// Verifica 
                     opcoes.setAttribute("selected", "true");
                 }                 
             }
             else{
                if(vOCampo!="municipio_escolha"){
                   if(vCapital=="1" && vSeleciona != vId){// Caso seja capital, seleciona
                     opcoes.setAttribute("selected", "true");
                   }
                }
             
             }
             
             if(vAConsulta=="MunicipioOrigemDesativado"){ // Se for a chamada pelo Desativamento de Pacote Aereo
                 opcoes.setAttribute("selected", "true");
             }
             document.getElementById(vOCampo).options.add(opcoes);// Monta a Primeira Linha da ComboBox
          }
           ifila++;// Soma 1 na Fila
           if(vAConsulta=="MunicipioDestino")setTimeout("GM_DestMunicipio();",20)// se for Município destino Recarrega o Município
           if(vAConsulta=="Hotel")setTimeout("GM_TarifasMH();",30)// se for Município destino Recarrega o Município
           if(vAConsulta=="TarifasMH")setTimeout("GM_CarregaVoo_Ida();",40)// se for Município destino Recarrega o Município
           if(vAConsulta=="VooDeIda")setTimeout("GM_CarregaVoo_Volta();",50)// se for Município destino Recarrega o Município
           if(ifila<fila.length){
            setTimeout("GM_AlimentaDaDosAjax()",20)
           }
           else{
	          fila=[];
	          ifila = 0;
	          //document.getElementById("contador").innerHTML ="";
           }
           
           if(vAConsulta=="MunicipioEscolhaIntegrese"){
              if(vId=="0"){
                  document.getElementById("listagem").innerHTML="Não encontrado";
              }
           }
           
           
         }
	    }
	    xmlhttp.send(null);
	    return false;
	 }	 
}


function GM_AlimentaDaDosAjaxBusca(){
	ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
	
	if (ifila != fila.length) {// Abaixo coloca na <label contador> o Progresso da Ação
      document.getElementById("contador").innerHTML = 'Carregando... ('+ (ifila+1) + ' - ' + Math.round(((ifila + 1) / fila.length) * 100) + '%)'; // mostra progresso

	    var vOCampo = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
	    var vAConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
	    var vAReferenc = fila[ifila][2];  // Carrega a variável 'Referência (Id)'
	    var vSeleciona = fila[ifila][3];  // Carrega a variável 'Campo já selecionado'
    		  
	    if(vAConsulta=="MunicipioOrigem"){ // -> Busca Cidade por Estado Ogigem
	      url_asp = "ajax_consulta.asp?controle=7&uf="+vAReferenc;
	    }
	    else if(vAConsulta=="MunicipioDestino"){ // -> Busca Cidade por Estado Ogigem
	      url_asp = "ajax_consulta.asp?controle=8&uf="+vAReferenc;
	    }
	    else if(vAConsulta=="MunicipioOrigemDesativado"){
	      url_asp = "ajax_consulta.asp?controle=4&id="+vAReferenc;
	    }


	    xmlhttp.open(ometodo,url_asp,true);
	    xmlhttp.onreadystatechange=function(){
		    if(xmlhttp.readyState == 4) {
		      document.getElementById(vOCampo).options.length = 1;// Zera a ComboBox 'Selecione'
		      var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		      var vId_Nome = vRetorno.split('*');   // Splita as linhas
		       //insere os novos valores
           for(var i=0; i < vId_Nome.length-1; i++) {
             var Lista = vId_Nome[i].split('|'); //separa ID do Nome pelo Split Barra(|)
             var vId = Lista[0];      // Carrega a variável 'Id'
             var vNome = Lista[1];    // Carrega a variável 'Nome'
             var vCapital = Lista[2]; // No caso de pesquisa de cidades, usa a informação se é capital
             opcoes = document.createElement("option");// Cria o elemento '<option>'
             opcoes.value = vId;  // Carrega o Option criado com o 'ID'
             opcoes.text = vNome; // Carrega o Option criado com o 'Nome'
             if(vSeleciona!=""){
                 if (vSeleciona == vId){// Verifica 
                     opcoes.setAttribute("selected", "true");
                 }
             }
             else{
                 if(vId_Nome.length < 3 && vSeleciona != vId){
                   opcoes.setAttribute("selected", "true");
                 }
                 else if(vCapital=="1" && vSeleciona != vId && vId_Nome.length > 2){// Caso seja capital, seleciona
                   opcoes.setAttribute("selected", "true");
                 }
             }
             
             if(vAConsulta=="MunicipioOrigemDesativado"){ // Se for a chamada pelo Desativamento de Pacote Aereo
                 opcoes.setAttribute("selected", "true");
             }
             document.getElementById(vOCampo).options.add(opcoes);// Monta a Primeira Linha da ComboBox
          }
           ifila++;// Soma 1 na Fila
           if(vAConsulta=="MunicipioDestino")setTimeout("GM_PacoteTerrestre();",20)// se for Município destino Recarrega o Município
           if(ifila<fila.length){
            setTimeout("GM_AlimentaDaDosAjaxBusca",20)
           }
           else{
	          fila=[];
	          ifila = 0;
	          document.getElementById("contador").innerHTML ="";
           }
         }
	    }
	    xmlhttp.send(null);
	    return false;
	 }	 
}



function GM_AlimentaDaDosAjaxIndex(){
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
	
      var vOCampo = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
	    var vAConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
	    var vAReferenc = fila[ifila][2];  // Carrega a variável 'Referência (Id)'
	    var vSeleciona = fila[ifila][3];  // Carrega a variável 'Campo já selecionado'
    		  

	    if(vAConsulta=="MunicipioDestino"){ // -> Busca Cidade por Estado
	      url_asp = "extranet/ajax_consulta.asp?controle=18&uf="+vAReferenc;
	    } else {
	      url_asp = "include/ajax_consulta_agencias.asp?controle=1&uf="+vAReferenc;
	    }


	    xmlhttp.open(ometodo,url_asp,true);
	    xmlhttp.onreadystatechange=function(){
		    if(xmlhttp.readyState == 4) {
		      document.getElementById(vOCampo).options.length = 1;// Zera a ComboBox 'Selecione'
		      var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		      var vId_Nome = vRetorno.split('*');   // Splita as linhas
		       //insere os novos valores
           for(var i=0; i < vId_Nome.length-1; i++) {
             var Lista = vId_Nome[i].split('|'); //separa ID do Nome pelo Split Barra(|)
             var vId = Lista[0];      // Carrega a variável 'Id'
             var vNome = Lista[1];    // Carrega a variável 'Nome'
             var vCapital = Lista[2]; // No caso de pesquisa de cidades, usa a informação se é capital
             opcoes = document.createElement("option");// Cria o elemento '<option>'
             opcoes.value = vId;  // Carrega o Option criado com o 'ID'
             opcoes.text = vNome; // Carrega o Option criado com o 'Nome'
             if(vSeleciona!=""){
                 if (vSeleciona == vId){// Verifica 
                     opcoes.setAttribute("selected", "true");
                 }
             }
             else{
                 if(vId_Nome.length < 3 && vSeleciona != vId){
                   opcoes.setAttribute("selected", "true");
                 }
                 else if(vCapital=="1" && vSeleciona != vId && vId_Nome.length > 2){// Caso seja capital, seleciona
                   opcoes.setAttribute("selected", "true");
                 }
             }
             document.getElementById(vOCampo).options.add(opcoes);// Monta a Primeira Linha da ComboBox
          }
           ifila++;// Soma 1 na Fila
           if(ifila<fila.length){
            setTimeout("GM_AlimentaDaDosAjax2",20)
           }
           else{
	          fila=[];
	          ifila = 0;
           }
         }
	    }
	    xmlhttp.send(null);
	    return false;

}




function GM_AlimentaDaDosAjax2(){

  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
	
      var vOCampo = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
	    var vAConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
	    var vAReferenc = fila[ifila][2];  // Carrega a variável 'Referência (Id)'
	    var vSeleciona = fila[ifila][3];  // Carrega a variável 'Campo já selecionado'
    	  

	    if(vAConsulta=="MunicipioDestino"){ // -> Busca Cidade por Estado
	      url_asp = "extranet/ajax_consulta.asp?controle=8&uf="+vAReferenc;
	    }


	    xmlhttp.open(ometodo,url_asp,true);
	    xmlhttp.onreadystatechange=function(){
		    if(xmlhttp.readyState == 4) {
		      document.getElementById(vOCampo).options.length = 1;// Zera a ComboBox 'Selecione'
		      var vRetorno = xmlhttp.responseText;  // Pega o conteúdo da Pesquisa asp
		      var vId_Nome = vRetorno.split('*');   // Splita as linhas
		       //insere os novos valores
           for(var i=0; i < vId_Nome.length-1; i++) {
             var Lista = vId_Nome[i].split('|'); //separa ID do Nome pelo Split Barra(|)
             var vId = Lista[0];      // Carrega a variável 'Id'
             var vNome = Lista[1];    // Carrega a variável 'Nome'
             var vCapital = Lista[2]; // No caso de pesquisa de cidades, usa a informação se é capital
             opcoes = document.createElement("option");// Cria o elemento '<option>'
             opcoes.value = vId;  // Carrega o Option criado com o 'ID'
             opcoes.text = vNome; // Carrega o Option criado com o 'Nome'
             if(vSeleciona!=""){
                 if (vSeleciona == vId){// Verifica 
                     opcoes.setAttribute("selected", "true");
                 }
             }
             else{
                 if(vId_Nome.length < 3 && vSeleciona != vId){
                   opcoes.setAttribute("selected", "true");
                 }
                 else if(vCapital=="1" && vSeleciona != vId && vId_Nome.length > 2){// Caso seja capital, seleciona
                   opcoes.setAttribute("selected", "true");
                 }
             }
             document.getElementById(vOCampo).options.add(opcoes);// Monta a Primeira Linha da ComboBox
          }
             ifila++;// Soma 1 na Fila
             if(ifila<fila.length){
              setTimeout("GM_AlimentaDaDosAjax2",20)
             }
             else{
	            fila=[];
	            ifila = 0;
             }
         }
	    }
	    xmlhttp.send(null);
	    return false;

}



function GM_BuscaDatasPacotes(Consulta,TipoPacote,IdOrigem,IdDestino,Dias,Data1,Data2,Data3){
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	
	if(Consulta=="forma_datas"){ 
	  url_asp = "extranet/ajax_consulta.asp?controle=9&tipo="+TipoPacote+"&id_origem="+IdOrigem+"&id_destino="+IdDestino+"&dias="+Dias+"&d1="+Data1+"&d2="+Data2+"&d3="+Data3+"";
	}

  xmlhttp.open(ometodo,url_asp,true);
	xmlhttp.onreadystatechange=function(){
	  if(xmlhttp.readyState == 4) {
       var vRetorno = xmlhttp.responseText;
       var vDatas = vRetorno.split('#');
       document.getElementById("retorno_datas1").innerHTML = "";
       document.getElementById("retorno_datas2").innerHTML = "";
       document.getElementById("retorno_datas3").innerHTML = "";
       document.getElementById("DatasOk").innerHTML = "";

        if(Data1!=""){
          var Retorno_1 = vDatas[0];
          var Separa_01 = Retorno_1.split('|');
          document.getElementById("retorno_datas1").innerHTML = Separa_01[0];
          if(Separa_01[1]!=1){
              dive = document.createElement('div');
              dive.id = ('datascertas1');
              dive.innerHTML="";
              dive.innerHTML="<input type='text' name='data_valida' id='data_valida' value='"+Separa_01[2]+"'>";
              document.getElementById('DatasOk').appendChild(dive);
          }
        }
        if(Data2!=""){
          var Retorno_2 = vDatas[1];
          var Separa_02 = Retorno_2.split('|');
          document.getElementById("retorno_datas2").innerHTML = Separa_02[0];
          if(Separa_02[1]!=1){
              dive = document.createElement('div');
              dive.id = ('datascertas2');
              dive.innerHTML="";
              dive.innerHTML="<input type='text' name='data_valida' id='data_valida' value='"+Separa_02[2]+"'>";
              document.getElementById('DatasOk').appendChild(dive);
          }
        }
        if(Data3!=""){
          var Retorno_3 = vDatas[2];
          var Separa_03 = Retorno_3.split('|');
          document.getElementById("retorno_datas3").innerHTML = Separa_03[0];
          if(Separa_03[1]!=1){
              dive = document.createElement('div');
              dive.id = ('datascertas3');
              dive.innerHTML="";
              dive.innerHTML="<input type='text' name='data_valida' id='data_valida' value='"+Separa_03[2]+"'>";
              document.getElementById('DatasOk').appendChild(dive);
          }
          
        }
        
        
        if(Separa_01[1]!=1 || Separa_02[1]!=1 || Separa_03[1]!=1){
          dive = document.createElement('div');
          dive.id = ('botao_acao');
          dive.innerHTML="";
          dive.innerHTML="<br/><input type='button' value='&nbsp;Prosseguir&nbsp;' class='botao' onclick='GM_EnviaFormularioDatasOK();'>";
          document.getElementById('DatasOk').appendChild(dive);
        }
        

        
        
    }
  }
  xmlhttp.send(null);
	return false;

}



function GM_MontaCalendarioExtranet(data){
	ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	xmlhttp.open(ometodo,"ajax_consulta.asp?controle=17&data="+data,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState == 4) {
		
		  var vRetorno = xmlhttp.responseText;
      var vSeparaRetorno = vRetorno.split('|');
      var vCalendario = vSeparaRetorno[0];
      var vTomeNota = vSeparaRetorno[1];
		
			document.getElementById("calendario_extranet").innerHTML=vCalendario;
			document.getElementById("tome_nota_b2b").innerHTML=vTomeNota;
			
		}
	}
	xmlhttp.send(null);
	return false;	
}



function GM_AjaxFiltrosIntegreSe(IDELO,Permissao,IdAgencia,Tabela,EscolhaAnterior,Selecao){
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	
	var url_asp = "ajax_consulta.asp?controle=19&IdElo="+IDELO+"&Permissao="+Permissao+"&IdAgencia="+IdAgencia+"&Tabela="+Tabela+"&EscolhaAnterior="+EscolhaAnterior+"&Selecao="+Selecao+"";
	
	
	
	var Rnd = GM_Random();
  if(url_asp.indexOf("?")>=0){
	  // já tem parametros vindos na url
	  url_asp = url_asp + "&rnd=" + Rnd;
  }
  else{ 
	  url_asp = url_asp + "?rnd=" + Rnd;
  }
	
	
	
	xmlhttp.open(ometodo,url_asp,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState == 4) {
		  var vRetorno = xmlhttp.responseText;

			document.getElementById("retorno_filtro").innerHTML=vRetorno;
		}
	}
	xmlhttp.send(null);
	return false;

}


function GM_AjaxFiltraBuscaIntegreSe(vUF_Escolha,vID_Municipio,vNome_Busca,Tipo,Tabela,Permissao){
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();


	xmlhttp.open(ometodo,"ajax_consulta.asp?controle=20&UF="+vUF_Escolha+"&ID_Municipio="+vID_Municipio+"&NomeBusca="+vNome_Busca+"&Tipo="+Tipo+"&Tabela="+Tabela+"&Permissao="+Permissao,true);
	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState == 4) {
		
		  var vRetorno = xmlhttp.responseText;
		
			document.getElementById("listagem").innerHTML=vRetorno;
			
		}
	}
	xmlhttp.send(null);
	return false;

}
//======================= ================================ 

function AjaxBuscaDetalhePacote_Fila(CampoRetorno,IdConsulta){
    fila[fila.length]=[CampoRetorno,IdConsulta]// Preenche a Array Fila
    if((ifila+1)==fila.length)GM_AlimentaDaDosDetalhaPacote()   // Compara quat.Fila, Executa a Primeira ação da Fila
}


function GM_AlimentaDaDosDetalhaPacote(){
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	url_asp = "";
	
    var vCampoRetorno = fila[ifila][0];     // Carrega a variável 'Campo de Retorno'
    var vIdConsulta = fila[ifila][1];  // Carrega a variável 'Tipo de Consulta'
	
	
	  url_asp = "ajax_consulta.asp?controle=24&id_pacote="+vIdConsulta;

  xmlhttp.open(ometodo,url_asp,true);
	xmlhttp.onreadystatechange=function(){
	      if(xmlhttp.readyState == 4) {
           var vRetorno = xmlhttp.responseText;
           document.getElementById(vCampoRetorno).innerHTML = "";
           
           //var vConteudoDiv = "";
           //vInicioDiv += "<fieldset style='border: 1px solid #0D7F3F;'>";
           //vInicioDiv += "<legend> Detalhamento do pacote selecionado </legend>";
           //vInicioDiv += vRetorno;
           //vInicioDiv += "</fieldset>";
           document.getElementById(vCampoRetorno).innerHTML = vRetorno;//vInicioDiv
            

            
            
        }
        
        ifila++;// Soma 1 na Fila
        if(ifila<fila.length){
          setTimeout("GM_DetalhaPacote('"+vIdConsulta+"')",50)
        }
        else{
          fila=[];
          ifila = 0;
        }
  }
  xmlhttp.send(null);
	return false;

}




//*************random para ser usado no final da url para evitar cache do navegador****************
function GM_Random() 
{
	today = new Date();
	num= Math.abs(Math.sin(today.getTime()));
	return num;  
}


function GM_AlimentaDaDosAgencias(){
  var objeto = window.parent.document.getElementById('lista_agencias');
  ometodo = getMetodo();
	xmlhttp = getHTTPObject();
	  url_asp = "../ajax_consulta_pacotes_mi.asp?controle=2";

	  xmlhttp.open(ometodo,url_asp,true);
	  xmlhttp.onreadystatechange=function(){
	      if(xmlhttp.readyState == 4) {
           var vRetorno = xmlhttp.responseText;
           //Lista = document.getElementById('lista_agencias');
           objeto.innerHTML = vRetorno;
           
          }	
	  }
	  xmlhttp.send(null);
	  return false;

}

