Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const form = document.getElementById('cognitiveTest');
+ const results = document.getElementById('results');
+ const scoreElement = document.getElementById('score');
+ const severityLevel = document.getElementById('severity-level');
+ const recommendationsDiv = document.getElementById('recommendations');
+
+ form.addEventListener('submit', (e) => {
+ e.preventDefault();
+
+ const formData = new FormData(form);
+ let totalScore = 0;
+
+ for (let value of formData.values()) {
+ totalScore += parseInt(value);
+ }
+
+ scoreElement.textContent = totalScore;
+
+ // Determine severity level
+ let severity = '';
+ let recommendations = '';
+
+ if (totalScore <= 5) {
+ severity = 'Minimal cognitive concerns';
+ recommendations = `
+
Recommendations:
+
Continue regular mental stimulation through play and training+
Maintain regular exercise routine+
Regular veterinary check-ups+
+ `;
+ } else if (totalScore <= 10) {
+ severity = 'Mild cognitive concerns';
+ recommendations = `
+
Recommendations:
+
Increase mental enrichment activities+
Consider brain-training games+
Maintain consistent daily routines+
Discuss with your vet about preventive measures+
+ `;
+ } else if (totalScore <= 15) {
+ severity = 'Moderate cognitive concerns';
+ recommendations = `
+
Recommendations:
+
Schedule a veterinary appointment soon+
Consider dietary supplements (after vet consultation)+
Implement environmental enrichment+
Establish strict routine for feeding and walks+
Monitor changes more closely+
+ `;
+ } else {
+ severity = 'Significant cognitive concerns';
+ recommendations = `
+
Recommendations:
+
Immediate veterinary consultation recommended+
Discuss medication options with your vet+
Adapt home environment for safety+
Consider night lights and anxiety management+
Monitor eating, drinking, and bathroom habits closely+
+ `;
+ }
+
+ severityLevel.textContent = severity;
+ recommendationsDiv.innerHTML = recommendations;
+
+ // Show results
+ results.classList.remove('hidden');
+ results.scrollIntoView({ behavior: 'smooth' });
+ });
+
+ // Add animation to score display
+ const animateScore = (finalScore) => {
+ let currentScore = 0;
+ const duration = 1000; // 1 second
+ const increment = finalScore / (duration / 16); // 60 FPS
+
+ const animation = setInterval(() => {
+ currentScore += increment;
+ if (currentScore >= finalScore) {
+ currentScore = finalScore;
+ clearInterval(animation);
+ }
+ scoreElement.textContent = Math.round(currentScore);
+ }, 16);
+ };
+ });