// Current page active
const currentPath = window.location.pathname.toLowerCase();
const menuItems = document.querySelectorAll('.menu-item a');
let isMatchFound = false;

menuItems.forEach(item => {
    const menuText = item.textContent.trim().toLowerCase();
    item.classList.remove('active');

    if (currentPath.includes(menuText)) {
        item.classList.add('active');
        isMatchFound = true;
    }
});

if (!isMatchFound) {
    menuItems.forEach(item => {
        if (item.getAttribute('href') == './' || item.getAttribute('href' == '../')) {
            if (item.textContent.trim().toLowerCase() === 'home') {
                item.classList.add('active');
            }
        }
    });
}






// FAQ mobail 
document.querySelectorAll(' #mobileAccordion .nav-link').forEach(button => {
    button.addEventListener('click', function () {
        const tabName = this.getAttribute('data-tab-name');
        document.getElementById('selectedTabName').textContent = tabName;

        const accordion = new bootstrap.Collapse(document.getElementById('collapseMob'), {
            toggle: true
        });
    });
});


var download = document.querySelectorAll('a');

download.forEach((a)=>{
    if(a.href == "https://play.google.com/store/apps/details?id=com.moveup.apps&hl=en-SG"){
        if(!a.target){
            a.setAttribute('target', '_blank');
        }
    }
})