function getUrlParameter(name) {
    name = name.replace(/[$$]/, '\$$').replace(/[$$]/, '\$$');
    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'),
        results = regex.exec(location.search);
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
  }

  var activeTab = getUrlParameter('active');
  if (activeTab) {
      // Hide all content sections
      var contents = document.querySelectorAll('.content');
      contents.forEach(function(content) {
          content.style.display = 'none';
      });

      // Show the active content section
      var activeContent = document.getElementById(activeTab);
      if (activeContent) {
          activeContent.style.display = 'block';
      }

      // Remove 'active' class from all nav items
      var navItems = document.querySelectorAll('.nav-item');
      navItems.forEach(function(navItem) {
          navItem.classList.remove('active');
      });

      // Add 'active' class to the nav item that matches the active tab
      var navLinks = document.querySelectorAll('.nav-link');
      navLinks.forEach(function(navLink) {
          var targets = navLink.getAttribute('data-target').split(' ');
          if (targets.includes(activeTab)) {
              var closestNavItem = navLink.closest('.nav-item');
              if (closestNavItem) {
                  closestNavItem.classList.add('active');
              }
          }
      });
  }