function SetCurrentTab(tabId, contentId, currentHiddenId, launchOnSelect)
   {
   var content = document.getElementById(contentId);
   var contents = content.parentNode.getElementsByTagName('div');
   
   for (i = 0; i < contents.length; i++)
      {
      var child = contents[i];
      if (child != content)
         {
         if (child.parentNode == content.parentNode)
            child.style.display = 'none';
         }
      }
   content.style.display = 'block';
   
   var comboBoxId = null;
   var subContents = content.getElementsByTagName('div');
   for (i = 0; i < subContents.length; i++)
      {
      var divId = subContents[i].id;      
      if (divId.substr(divId.length - "DynamicComboBox".length) == "DynamicComboBox")         
         comboBoxId = divId; 
      }
   
   var currentHidden = document.getElementById(currentHiddenId);
   currentHidden.value = tabId;
   
   var tab = document.getElementById(tabId);
   var tabs = tab.parentNode.getElementsByTagName('a');
   for (i = 0; i < tabs.length; i++)
      {
      var child = tabs[i];
      if (child != tab)
         child.className = '';
      else
         tab.className = 'current';
      }
      
   var textBoxId = null;
   if (comboBoxId == null)
      {
      var subContents = content.getElementsByTagName('input');
      for (i = 0; i < subContents.length; i++)
         {
         var inputId = subContents[i].id;
         if (inputId.substring(inputId.length - "TextBox".length) == "TextBox")
            textBoxId = inputId;
         }
      }
         
   if (!launchOnSelect || comboBoxId == null && textBoxId == null)
      return;
      
   var onSelectFunction = null;
   var value = "";
   var text = "";   
   if (comboBoxId != null)
      {
      var comboBoxInstance = $find(comboBoxId);
      if (comboBoxInstance == null)
         return;
         
      onSelectFunction = comboBoxId + "_OnSelect";
      value = comboBoxInstance.GetValue();
      text = comboBoxInstance.GetText();  
      }
   else if (textBoxId != null)
      onSelectFunction = textBoxId + "_OnSelect";
      
   eval("if(" + onSelectFunction + " != null)" + onSelectFunction + "(value, text);");   
   }

function SelectLandmark(id, mun, typ,  lmk)
   {
   var landmarkMunicipalityDynamicComboBox = $find(id + "_LandmarkMunicipalityDynamicComboBox");
   if (landmarkMunicipalityDynamicComboBox != null)
      {
      landmarkMunicipalityDynamicComboBox.ClearAll();
      landmarkMunicipalityDynamicComboBox.SetReQueryText(mun, mun);
      landmarkMunicipalityDynamicComboBox.ReQuery();
      }
   
   var landmarkTypeDynamicComboBox = $find(id + "_LandmarkTypeDynamicComboBox");   
   landmarkTypeDynamicComboBox.ClearAll();
   landmarkTypeDynamicComboBox.SetReQueryText(typ, typ);
   landmarkTypeDynamicComboBox.ReQuery();
   
   var landmarkDynamicComboBox = $find(id + "_LandmarkDynamicComboBox");      
   landmarkDynamicComboBox.SetReQueryText(lmk, lmk);
   landmarkDynamicComboBox.ReQuery();   
   }

function SelectStopDescription(id, mun, stp)
   {
   var stopMunicipalityDynamicComboBox = $find(id + "_StopMunicipalityDynamicComboBox");   
   if (stopMunicipalityDynamicComboBox != null)
      {   
      stopMunicipalityDynamicComboBox.ClearAll();
      stopMunicipalityDynamicComboBox.SetReQueryText(mun, mun);   
      stopMunicipalityDynamicComboBox.ReQuery();   
      }
      
   var stopDynamicComboBox = $find(id + "_StopDynamicComboBox");      
   if (stopDynamicComboBox != null)
      {        
      stopDynamicComboBox.SetReQueryText(stp, stp);   
      stopDynamicComboBox.ReQuery();   
      }   
   }

function SelectStopPhoneNumber(id, pho)
   {
   document.getElementById(id + '_StopPhoneNumberTextBox').value = pho;
   }

function SelectStopIdentifier(id, ide)
   {
   document.getElementById(id + '_StopIdentifierTextBox').value = ide;   
   }
   
function SelectIntersection(id, mun, street, streetRequeryText, inter, interRequeryText)
   {
   var intersectionMunicipalityDynamicComboBox = $find(id + "_IntersectionMunicipalityDynamicComboBox");    
   if (intersectionMunicipalityDynamicComboBox != null)
      {      
      intersectionMunicipalityDynamicComboBox.ClearAll();
      intersectionMunicipalityDynamicComboBox.SetReQueryText(mun, mun);
      intersectionMunicipalityDynamicComboBox.ReQuery();  
      }  
   
   var intersectionStreetDynamicComboBox = $find(id + "_IntersectionStreetDynamicComboBox");    
   intersectionStreetDynamicComboBox.ClearAll();
   intersectionStreetDynamicComboBox.SetReQueryText(street, streetRequeryText);         
   intersectionStreetDynamicComboBox.ReQuery();    
   
   var intersectionDynamicComboBox = $find(id + "_IntersectionDynamicComboBox");     
   intersectionDynamicComboBox.SetReQueryText(inter, interRequeryText);     
   intersectionDynamicComboBox.ReQuery();       
   }
   
function SelectAddress(id, mun, civicNumber, street, streetRequeryText)
   {
   var civicNumberTextBox = document.getElementById(id + '_CivicNumberTextBox');
   civicNumberTextBox.value = civicNumber;
   
   var addressMunicipalityDynamicComboBox = $find(id + "_AddressMunicipalityDynamicComboBox");     
   if (addressMunicipalityDynamicComboBox != null)
      {     
      addressMunicipalityDynamicComboBox.ClearAll();
      addressMunicipalityDynamicComboBox.SetReQueryText(mun, mun); 
      addressMunicipalityDynamicComboBox.ReQuery(); 
      }   
      
   var addressStreetDynamicComboBox = $find(id + "_AddressStreetDynamicComboBox");        
   addressStreetDynamicComboBox.SetReQueryText(street, streetRequeryText);       
   addressStreetDynamicComboBox.ReQuery();    
   }
