// Page load animations window.addEventListener('load', () => { setTimeout(() => { document.getElementById('loader').style.display = 'none'; }, 1500); // Animate counters const counters = document.querySelectorAll('.counter'); const speed = 200; counters.forEach(counter => { const animate = () => { const value = +counter.getAttribute('data-target'); const data = +counter.innerText; const time = value / speed; if (data < value) { counter.innerText = Math.ceil(data + time); setTimeout(animate, 10); } else { counter.innerText = value.toLocaleString(); } } animate(); }); }); // Smooth scroll to section function scrollToSection(sectionId) { const section = document.getElementById(sectionId); if (section) { section.scrollIntoView({ behavior: 'smooth' }); } } // Investment plan selection let selectedPlanData = {}; let userInvestments = []; function selectPlan(plan, daily, withdrawal, fixedAmount) { selectedPlanData = { plan, daily, withdrawal, amount: fixedAmount }; document.getElementById('modalPlan').value = `${plan} Plan - ${daily} daily - Fixed ${fixedAmount}`; document.getElementById('modalAmount').value = fixedAmount; document.getElementById('modalAmount').readOnly = true; document.getElementById('investModal').classList.remove('hidden'); document.getElementById('investModal').classList.add('flex'); document.body.style.overflow = 'hidden'; } // Smooth scrolling for anchor links document.addEventListener('DOMContentLoaded', function() { const links = document.querySelectorAll('a[href^="#"]'); links.forEach(link => { link.addEventListener('click', function(e) { const href = this.getAttribute('href'); if (href !== '#') { e.preventDefault(); const target = document.querySelector(href); if (target) { const offsetTop = target.offsetTop - 80; // Account for fixed navbar window.scrollTo({ top: offsetTop, behavior: 'smooth' }); } } }); }); }); function closeInvestModal() { document.getElementById('investModal').classList.add('hidden'); document.getElementById('investModal').classList.remove('flex'); document.body.style.overflow = 'auto'; } function confirmInvestment() { const amount = document.getElementById('modalAmount').value; const wallet = document.getElementById('modalWallet').value; if (!amount || !wallet) { showNotification('Please fill in all fields', 'error'); return; } // Check if amount matches the fixed amount for the plan const fixedAmounts = { 'Starter': 10, 'Professional': 100, 'VIP': 1000 }; if (parseFloat(amount) !== fixedAmounts[selectedPlanData.plan]) { showNotification(`For ${selectedPlanData.plan} plan, the investment amount must be exactly ${fixedAmounts[selectedPlanData.plan]}`, 'error'); return; } // Add investment to user's portfolio const investment = { plan: selectedPlanData.plan, amount: parseFloat(amount), daily: selectedPlanData.daily, withdrawal: selectedPlanData.withdrawal, wallet: wallet, startDate: new Date().toISOString(), id: Date.now() }; userInvestments.push(investment); localStorage.setItem('userInvestments', JSON.stringify(userInvestments)); showNotification(`Investment of ${amount} confirmed for ${selectedPlanData.plan} plan! You can purchase additional plans if desired.`, 'success'); closeInvestModal(); // Reset form document.getElementById('modalAmount').value = ''; document.getElementById('modalWallet').value = ''; document.getElementById('modalAmount').readOnly = false; } // Load user investments on page load window.addEventListener('load', () => { const saved = localStorage.getItem('userInvestments'); if (saved) { userInvestments = JSON.parse(saved); } }); // Calculator functionality function calculateReturns() { const amount = parseFloat(document.getElementById('calcAmount').value) || 0; const daily = 1; // Fixed at 1% const days = parseInt(document.getElementById('calcDays').value) || 0; const compound = document.getElementById('calcCompound').value; if (!amount || !days) { showNotification('Please enter investment amount and period', 'error'); return; } let totalReturn; if (compound === 'daily') { totalReturn = amount * Math.pow(1 + (daily / 100), days); } else { totalReturn = amount + (amount * (daily / 100) * days); } const netProfit = totalReturn - amount; document.getElementById('totalReturn').textContent = totalReturn.toFixed(2).toLocaleString(); document.getElementById('netProfit').textContent = netProfit.toFixed(2).toLocaleString(); document.getElementById('calcResults').classList.remove('hidden'); } // FAQ toggle function toggleFAQ(id) { const content = document.getElementById(`faq-${id}`); const icon = document.getElementById(`faq-icon-${id}`); if (content.classList.contains('hidden')) { content.classList.remove('hidden'); icon.style.transform = 'rotate(180deg)'; } else { content.classList.add('hidden'); icon.style.transform = 'rotate(0deg)'; } } // Registration modal function showRegistration() { document.getElementById('regModal').classList.remove('hidden'); document.getElementById('regModal').classList.add('flex'); document.body.style.overflow = 'hidden'; } function closeRegModal() { document.getElementById('regModal').classList.add('hidden'); document.getElementById('regModal').classList.remove('flex'); document.body.style.overflow = 'auto'; } function handleRegistration(event) { event.preventDefault(); const formData = new FormData(event.target); showNotification('Account created successfully! Check your email for verification.', 'success'); closeRegModal(); event.target.reset(); } // Login modal function showLogin() { const loginModal = document.querySelector('login-modal'); if (loginModal) { const overlay = loginModal.shadowRoot.getElementById('loginModal'); if (overlay) { overlay.style.display = 'flex'; document.body.style.overflow = 'hidden'; } } } function closeLoginModal() { const loginModal = document.querySelector('login-modal'); if (loginModal) { const overlay = loginModal.shadowRoot.getElementById('loginModal'); if (overlay) { overlay.style.display = 'none'; document.body.style.overflow = 'auto'; } } } function handleLogin(event) { event.preventDefault(); showNotification('Login successful! Welcome back.', 'success'); closeLoginModal(); event.target.reset(); } // Notification system function showNotification(message, type = 'info') { const notification = document.createElement('div'); notification.className = `fixed top-4 right-4 z-50 px-6 py-4 rounded-lg shadow-lg transform transition-all duration-500 ${ type === 'success' ? 'bg-green-500' : type === 'error' ? 'bg-red-500' : type === 'warning' ? 'bg-yellow-500' : 'bg-blue-500' } text-white`; notification.innerHTML = `