document.addEventListener('DOMContentLoaded', function() { // Load featured scholarships fetchFeaturedScholarships(); // Language switcher functionality const langSwitcher = document.getElementById('lang-switcher'); if (langSwitcher) { langSwitcher.addEventListener('change', function() { // In a real app, this would redirect to the appropriate language version alert('Language switched to: ' + this.value); }); } // Mobile menu toggle const mobileMenuButton = document.getElementById('mobile-menu-button'); const mobileMenu = document.getElementById('mobile-menu'); if (mobileMenuButton && mobileMenu) { mobileMenuButton.addEventListener('click', function() { mobileMenu.classList.toggle('hidden'); }); } }); function fetchFeaturedScholarships() { // In a real app, this would fetch from your API const scholarships = [ { id: 1, title: "Master's in Computer Science", university: "ETH Zurich", country: "Switzerland", deadline: "2023-12-15", category: "Computer Science" }, { id: 2, title: "PhD in Mathematics", university: "University of Oxford", country: "UK", deadline: "2024-01-10", category: "Mathematics" }, { id: 3, title: "Undergraduate Physics Program", university: "University of Cape Town", country: "South Africa", deadline: "2023-11-30", category: "Physics" } ]; const container = document.getElementById('featured-scholarships'); if (!container) return; container.innerHTML = scholarships.map(scholarship => `
${scholarship.category} ${formatDate(scholarship.deadline)}

${scholarship.title}

${scholarship.university}, ${scholarship.country}

View Details
`).join(''); feather.replace(); } function formatDate(dateString) { const options = { year: 'numeric', month: 'short', day: 'numeric' }; return new Date(dateString).toLocaleDateString('en-US', options); }