document.addEventListener("DOMContentLoaded", function () {
function activateTabFromHash() {
const hash = window.location.hash;
if (!hash) return;
const tabId = hash.substring(1);
const allowedTabs = ["massage", "treatment", "pain"];
if (!allowedTabs.includes(tabId)) return;
const tabElement = document.getElementById(tabId);
if (!tabElement) return;
// Activate the selected tab
tabElement.click();
// Scroll to the tab after activation
setTimeout(function () {
tabElement.scrollIntoView({
behavior: "smooth",
block: "start"
});
}, 300);
}
// Run when the page loads
activateTabFromHash();
// Run when the URL hash changes
window.addEventListener("hashchange", activateTabFromHash);
});