// Main application scripts document.addEventListener('DOMContentLoaded', function() { // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); }); // Animation triggers const animateOnScroll = () => { const elements = document.querySelectorAll('.animate-on-scroll'); elements.forEach(element => { const elementPosition = element.getBoundingClientRect().top; const screenPosition = window.innerHeight / 1.3; if(elementPosition < screenPosition) { element.classList.add('animate-fade-in'); } }); }; window.addEventListener('scroll', animateOnScroll); animateOnScroll(); // Run once on load }); // Sample function to simulate loading test recommendations function loadTestRecommendations() { // In a real app, this would fetch from an API return { essential: [ "CBC (Complete Blood Count)", "Comprehensive Metabolic Panel", "Lipid Panel + ApoB", "HbA1c & Fasting Insulin", "Thyroid Function (TSH, Free T4)" ], specialty: [ "Vitamin D (25-OH)", "hs-CRP (Inflammation)", "Hormone Panel", "Omega-3 Index", "Homocysteine" ] }; }