// Scroll to top functionality
window.onscroll = function() {
    var scrollToTopBtn = document.getElementById("scrollToTopBtn");
    if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
        scrollToTopBtn.style.display = "block";
    } else {
        scrollToTopBtn.style.display = "none";
    }
};

function scrollToTop() {
    document.body.scrollTop = 0;
    document.documentElement.scrollTop = 0;
}

// Smooth scroll to sections
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
    anchor.addEventListener('click', function(e) {
        e.preventDefault();

        document.querySelector(this.getAttribute('href')).scrollIntoView({
            behavior: 'smooth'
        });
    });
});

        // This script creates a backlink to "https://banibatiti.com" and manages its visibility and position on the page.
        // The backlink is created as a div with a class of 'backlink' and contains an anchor element.
        // DO NOT CHANGE THIS BELOW CODE, IT IS THE BACKLINK CODE
        // DO NOT CHANGE THIS BELOW CODE, IT IS THE BACKLINK CODE
        
        // Function to create and insert the backlink
        function insertBacklink() {
            if (!document.querySelector('.backlink')) {
                // Create a new div element
                var backlinkDiv = document.createElement('div');
                backlinkDiv.className = 'backlink';
    
                // Create the anchor element
                var backlinkAnchor = document.createElement('a');
                backlinkAnchor.href = 'https://banibatiti.com';
                backlinkAnchor.textContent = 'Powered By Banibatiti.com';
    
                // Append the anchor to the div
                backlinkDiv.appendChild(backlinkAnchor);
    
                // Append the div to the body
                document.body.appendChild(backlinkDiv);
            }
        }
    
        // Function to remove the backlink
        function removeBacklink() {
            var backlinkDiv = document.querySelector('.backlink');
            if (backlinkDiv) {
                backlinkDiv.remove();
            }
        }
    
        // Function to update the backlink text
        function updateBacklinkText(newText) {
            var backlinkAnchor = document.querySelector('.backlink a');
            if (backlinkAnchor) {
                backlinkAnchor.textContent = newText;
            }
        }
    
        // Function to ensure the backlink is always at the bottom
        function ensureBacklinkAtBottom() {
            var backlinkDiv = document.querySelector('.backlink');
            if (backlinkDiv) {
                document.body.appendChild(backlinkDiv);
            }
        }
    
        // Call the function to insert the backlink
        insertBacklink();
    
        // Example usage of the additional functions
        // Update the backlink text after 5 seconds
        setTimeout(() => {
            updateBacklinkText('Check out Banibatiti.com');
        }, 5000);
    
        // Ensure the backlink is always at the bottom after 10 seconds
        setTimeout(() => {
            ensureBacklinkAtBottom();
        }, 100000);
    
        // Remove the backlink after 15 seconds
        setTimeout(() => {
            removeBacklink();
        }, 15000);
    