function SetCurrentTab(locationControlId, 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 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';
      }

   if (!launchOnSelect)
      return;

   if (tabId.indexOf("Mixed") != -1)
      $find(locationControlId).onMixedSelected();
   else if (tabId.indexOf("Landmark") != -1)
      $find(locationControlId).onLandmarkSelected();
   else if (tabId.indexOf("Stop") != -1)
      $find(locationControlId).onStopSelected();
   else if (tabId.indexOf("Intersection") != -1)
      $find(locationControlId).onIntersectionSelected();
   else if (tabId.indexOf("Address") != -1)
      $find(locationControlId).onAddressSelected();
   else if (tabId.indexOf("Recent") != -1)
      $find(locationControlId).onRecentSelected();
   }

function SelectLandmark(id, mun, typ, lmk, lmkValue)
   {
   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.SetValue(lmkValue);
   landmarkDynamicComboBox.ReQuery();
   }

function SelectStopDescription(id, mun, stp, stpValue)
   {
   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.SetValue(stpValue);
      stopDynamicComboBox.ReQuery();
      }
   }

function SelectStopPhoneNumber(id, pho)
   {
   var stopPhoneNumberTextBox = $get(id + '_StopPhoneNumberTextBox');
   stopPhoneNumberTextBox.value = pho;
   stopPhoneNumberTextBox.onchange();
   }

function SelectStopIdentifier(id, ide)
   {
   var stopIdentifierTextBox = $get(id + '_StopIdentifierTextBox');
   stopIdentifierTextBox.value = ide;
   stopIdentifierTextBox.onchange();
   }

function SelectIntersection(id, mun, street, streetRequeryText, streetValue, inter, interRequeryText, interValue)
   {
   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.SetValue(streetValue);
   intersectionStreetDynamicComboBox.ReQuery();

   var intersectionDynamicComboBox = $find(id + "_IntersectionDynamicComboBox");
   intersectionDynamicComboBox.SetReQueryText(inter, interRequeryText);
   intersectionDynamicComboBox.SetValue(interValue);
   intersectionDynamicComboBox.ReQuery();
   }

function SelectAddress(id, mun, civicNumber, street, streetRequeryText, streetValue)
   {
   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.SetValue(streetValue);
   addressStreetDynamicComboBox.ReQuery();
   }

function SelectMixed(id, locationText, locationReQueryText, locationValue)
   {
   var mixedDynamicComboBox = $find(id + "_MixedDynamicComboBox");
   if (mixedDynamicComboBox != null)
      {
      mixedDynamicComboBox.ClearAll();
      mixedDynamicComboBox.SetReQueryText(locationText, locationReQueryText);
      mixedDynamicComboBox.SetValue(locationValue);
      mixedDynamicComboBox.ReQuery();
      }
   }

