// Main JavaScript functionality document.addEventListener('DOMContentLoaded', function() { // Initialize tooltips const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); if (tooltipTriggerList.length > 0) { tooltipTriggerList.map(function (tooltipTriggerEl) { return new bootstrap.Tooltip(tooltipTriggerEl); }); } // Smooth scroll for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); }); // Age calculator for demonstration purposes const currentYear = new Date().getFullYear(); const targetYear = 2025; const cutoffAge = 42; const ageCalcForm = document.getElementById('age-calculator'); if (ageCalcForm) { ageCalcForm.addEventListener('submit', function(e) { e.preventDefault(); const birthYear = parseInt(document.getElementById('birth-year').value); const ageIn2025 = targetYear - birthYear; const resultElement = document.getElementById('age-result'); resultElement.innerHTML = `

In 2025, you will be ${ageIn2025} years old.

${ageIn2025 > cutoffAge ? 'This exceeds the standard cutoff age, but waiver options may be available.' : 'You meet the standard age requirements!'}

`; }); } }); // Back to top button functionality window.addEventListener('scroll', function() { const backToTopButton = document.getElementById('back-to-top'); if (backToTopButton) { if (window.pageYOffset > 300) { backToTopButton.classList.remove('opacity-0', 'invisible'); backToTopButton.classList.add('opacity-100', 'visible'); } else { backToTopButton.classList.remove('opacity-100', 'visible'); backToTopButton.classList.add('opacity-0', 'invisible'); } } }); // Initialize any modals or popups function initModal(modalId) { const modal = document.getElementById(modalId); if (modal) { const openButtons = document.querySelectorAll(`[data-modal-target="${modalId}"]`); const closeButton = modal.querySelector('.modal-close'); openButtons.forEach(btn => { btn.addEventListener('click', () => { modal.classList.remove('hidden'); document.body.style.overflow = 'hidden'; }); }); closeButton.addEventListener('click', () => { modal.classList.add('hidden'); document.body.style.overflow = 'auto'; }); window.addEventListener('click', (e) => { if (e.target === modal) { modal.classList.add('hidden'); document.body.style.overflow = 'auto'; } }); } }