window.ScrollToBottom = (elementName) => {
    element = document.getElementById(elementName);
    element.scrollTop = element.scrollHeight - element.clientHeight;
}

window.PlayAudio = (elementName) => {
    document.getElementById(elementName).play();
}

window.LoadParticles = (elementId) => {
    fetch('js/particlesjs-config.json')
        .then(response => {
            console.log("Fetch response received");
            return response.json();
        })
        .then(config => {
            console.log("Config parsed", config);
            if (document.getElementById(elementId)) {
                console.log("Element found, initializing particles.js");
                particlesJS(elementId, config);
            } else {
                console.log(`Element with id ${elementId} not found`);
            }
        })
        .catch(error => console.error("Could not load particles.js config:", error));
}