

document.addEventListener('DOMContentLoaded', function () {
    const icons = document.querySelectorAll('#header .icon');

    icons.forEach(icon => {
        // Toggle on click
        icon.addEventListener('click', function () {
            toggleTooltip(this);
        });

        // Toggle on keyboard interaction
        icon.addEventListener('keydown', function (e) {
            if (e.key === 'Enter' || e.key === ' ') {
                e.preventDefault(); // Prevent default behavior for spacebar
                toggleTooltip(this);
            }
        });

        // Function to toggle visibility
        function toggleTooltip(iconElement) {
            const tooltip = iconElement.parentElement.querySelector('#header .tooltiptext');
            if (tooltip) {
                const isVisible = tooltip.style.display === 'block';
                tooltip.style.display = isVisible ? 'none' : 'block';
            }
        }
    });
});




jQuery(document).ready(function ($) {
    $('#search-icon').on('click', function () {
        $('#search-form-container').toggle();
    });

    // Add a window resize event listener to reset the visibility on view change
    $(window).on('resize', function () {
        var windowWidth = $(window).width();
        if (windowWidth > 768) { // Assuming 768px is the breakpoint for mobile to desktop
            $('#search-form-container').show(); // Show search form container on desktop view
        } else {
            $('#search-form-container').hide(); // Hide search form container on mobile view
        }
    });

    // Trigger resize event to set initial state
    $(window).trigger('resize');
});

jQuery(document).ready(function($) {
    $('.slider-for').slick({
        slidesToShow: 1,
        slidesToScroll: 1,
        arrows: false,
        dots: true,
        fade: true,
        autoplay: true,
        autoplaySpeed: 3000,
        infinite: false, // Disable infinite loop
        asNavFor: '.slider-nav'
    });

    $('.slider-nav').slick({
        slidesToShow: 4,
        slidesToScroll: 1,
        asNavFor: '.slider-for',
        focusOnSelect: true,
        infinite: false // Disable infinite loop
    });
    
});
  


// icons
jQuery(document).ready(function ($) {
    $('#share-icon').on('click', function () {
        $('#icons-container').toggle();
    });

    // Add a window resize event listener to reset the visibility on view change
    $(window).on('resize', function () {
        var windowWidth = $(window).width();
        if (windowWidth > 768) { // Assuming 768px is the breakpoint for mobile to desktop
            $('#icons-container').show(); // Show search form container on desktop view
        } else {
            $('#icons-container').hide(); // Hide search form container on mobile view
        }
    });

    // Trigger resize event to set initial state
    $(window).trigger('resize');
});


const showNumberIcon = document.getElementById('show-number');
const phoneNumber = document.getElementById('phone-number');

if (showNumberIcon && phoneNumber) { // Ensure elements exist
    // Function to toggle the phone number display
    function togglePhoneNumber() {
        if (phoneNumber.style.display === 'none' || phoneNumber.style.display === '') {
            phoneNumber.style.display = 'block';  // Show number
        } else {
            phoneNumber.style.display = 'none';  // Hide number
        }
    }

    // Event listener for mouse click
    showNumberIcon.addEventListener('click', togglePhoneNumber);

    // Event listener for keyboard navigation (Enter or Space key)
    showNumberIcon.addEventListener('keydown', function(event) {
        if (event.key === 'Enter' || event.key === ' ') {
            event.preventDefault();  // Prevent scrolling for space key
            togglePhoneNumber();
        }
    });
}



const toggleAppointmentIcon = document.getElementById('toggle-appointment');
const appointmentButton = document.getElementById('appointment-button');

if (toggleAppointmentIcon && appointmentButton) { // Ensure elements exist
    // Function to check if the screen width is mobile (768px or below)
    function isMobileView() {
        return window.innerWidth <= 768;
    }

    // Function to toggle the appointment button display
    function toggleAppointment() {
        if (isMobileView()) { // Only execute if it's mobile view
            if (appointmentButton.style.display === 'none' || appointmentButton.style.display === '') {
                appointmentButton.style.display = 'block';  // Show button
            } else {
                appointmentButton.style.display = 'none';  // Hide button
            }
        }
    }

    // Event listener for mouse click
    toggleAppointmentIcon.addEventListener('click', toggleAppointment);

    // Event listener for keyboard navigation (Enter or Space key)
    toggleAppointmentIcon.addEventListener('keydown', function(event) {
        if (event.key === 'Enter' || event.key === ' ') {
            event.preventDefault();  // Prevent scrolling for space key
            toggleAppointment();
        }
    });
}



