// brandabean tips
const brandabeanTipsButton = document.getElementById('brandabean-tips');
const brandabeanTipsContent = document.getElementById('brandabean-tips-content');

if (brandabeanTipsButton && brandabeanTipsContent) { // Only run if both elements exist
    brandabeanTipsButton.addEventListener('click', function() {
        brandabeanTipsContent.style.display = 'block';
    });
}

// send email opt-in checkbox
const enableButtonCheckbox = document.getElementById('enableButtonCheckbox');
const submitButton = document.getElementById('submitButton');
const form = document.getElementById('upload-form');

if (enableButtonCheckbox && submitButton && form) { // Only run if all elements exist
    enableButtonCheckbox.addEventListener('change', function() {
        submitButton.disabled = !this.checked; // Disable if unchecked, enable if checked
    });

    form.addEventListener('submit', function(event) {
        if (submitButton.disabled) {
            event.preventDefault(); // Prevent form submission if button is disabled - opt-in checkbox needed first
            alert("Please check the Opt-In to receive communications checkbox.");
        }
    });
}