window.onload = function() { function openTab(evt, tabName) { let i, tabContent, tabButtons; // Hide all tab content tabContent = document.querySelectorAll(".tab-content"); tabContent.forEach(tab => tab.style.display = "none"); // Remove active class from all tab buttons tabButtons = document.querySelectorAll(".tab-button"); tabButtons.forEach(button => button.classList.remove("active")); // Show the selected tab content and mark button as active document.getElementById(tabName).style.display = "block"; evt.currentTarget.classList.add("active"); } function openSubTab(evt, subTabName) { let i, subTabContent, subTabButtons; // Hide all sub-tab content subTabContent = document.querySelectorAll(".sub-tab-content"); subTabContent.forEach(subTab => subTab.style.display = "none"); // Remove active class from all sub-tab buttons subTabButtons = document.querySelectorAll(".sub-tab"); subTabButtons.forEach(button => button.classList.remove("active")); // Show the selected sub-tab content and mark button as active document.getElementById(subTabName).style.display = "block"; evt.currentTarget.classList.add("active"); } // Ensure there is at least one tab to select let firstTab = document.querySelector(".tab-button"); if (firstTab) firstTab.click(); // Opens the first main tab by default let firstSubTab = document.querySelector(".sub-tab"); if (firstSubTab) firstSubTab.click(); // Opens the first sub-tab by default };