Changed around line 1
+ document.getElementById('fitness-form').addEventListener('submit', function(e) {
+ e.preventDefault();
+
+ const ancestry = document.getElementById('ancestry').value;
+ const fitnessLevel = document.getElementById('fitness-level').value;
+ const goal = document.getElementById('goal').value;
+
+ const planContent = generatePlan(ancestry, fitnessLevel, goal);
+
+ document.getElementById('plan-content').innerHTML = planContent;
+ document.getElementById('plan-result').classList.remove('hidden');
+ });
+
+ function generatePlan(ancestry, fitnessLevel, goal) {
+ const plans = {
+ beginner: {
+ 'weight-loss': 'Start with 30 minutes of walking daily and basic bodyweight exercises.',
+ 'muscle-gain': 'Begin with light weights and focus on proper form.',
+ 'endurance': 'Start with short cardio sessions and gradually increase duration.',
+ 'flexibility': 'Begin with basic stretching routines and yoga poses.'
+ },
+ intermediate: {
+ 'weight-loss': 'Incorporate HIIT workouts and strength training 3-4 times a week.',
+ 'muscle-gain': 'Focus on progressive overload and compound exercises.',
+ 'endurance': 'Add interval training and longer cardio sessions.',
+ 'flexibility': 'Incorporate dynamic stretching and more advanced yoga poses.'
+ },
+ advanced: {
+ 'weight-loss': 'Combine intense strength training with HIIT and proper nutrition.',
+ 'muscle-gain': 'Focus on advanced training techniques and nutrition optimization.',
+ 'endurance': 'Incorporate long-distance training and sport-specific drills.',
+ 'flexibility': 'Practice advanced yoga and mobility exercises.'
+ }
+ };
+
+ const ancestryTips = {
+ african: 'Consider incorporating high-intensity workouts and explosive movements.',
+ asian: 'Focus on balance and flexibility with martial arts-inspired exercises.',
+ european: 'Incorporate strength training and endurance exercises.',
+ 'native-american': 'Include functional movements and outdoor activities.',
+ 'pacific-islander': 'Focus on bodyweight exercises and functional strength.',
+ mixed: 'Combine elements from different ancestral backgrounds.'
+ };
+
+ const basePlan = plans[fitnessLevel][goal];
+ const ancestryTip = ancestryTips[ancestry];
+
+ return `
+
Ancestry Tip: ${ancestryTip}
+
Remember to stay consistent and listen to your body. Adjust the plan as needed based on your progress.
+ `;
+ }