`;
var current = 0, total = 5, autoTimer = null;
function egGoTo(idx) {
var st = root.getElementById('eg-st'); var dots = root.querySelectorAll('.eg-dot');
if (!st) return;
current = ((idx % total) + total) % total;
st.style.transform = 'translateX(-' + (current * 100) + '%)';
dots.forEach(function(d, i) { d.classList.toggle('active', i === current); });
}
function egNext() { egGoTo(current + 1); }
function egStartAuto() { clearInterval(autoTimer); autoTimer = setInterval(egNext, 4500); }
function egStopAuto() { clearInterval(autoTimer); }
var dots = root.querySelectorAll('.eg-dot');
dots.forEach(function(d) { d.addEventListener('click', function() { egGoTo(parseInt(d.getAttribute('data-idx'), 10) || 0); }); });
var sv = root.getElementById('eg-sv');
if (sv) { sv.addEventListener('mouseenter', egStopAuto); sv.addEventListener('mouseleave', egStartAuto); }
egGoTo(0); egStartAuto();
function validateForm() {
var errors = [];
var v = function(id){ var el = root.getElementById(id); return el ? el.value.trim() : ''; };
var fname = v('eg-fname'), lname = v('eg-lname'), email = v('eg-email'), phone = v('eg-phone'), brand = v('eg-brand');
var rev = root.getElementById('eg-rev').value;
var src = root.getElementById('eg-src').value;
var consent = root.getElementById('eg-consent').checked;
if (!fname) errors.push('First name is required');
if (!lname) errors.push('Last name is required');
if (!email || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) errors.push('A valid business email is required');
if (!phone) errors.push('Phone number is required');
if (!brand) errors.push('Brand name is required');
if (!rev) errors.push('Please select your monthly revenue range');
if (!src) errors.push('Please tell us how you found us');
if (!consent) errors.push('Please agree to receive follow-up messages');
return errors;
}
function showError(msg) {
var el = root.getElementById('eg-error'), msgEl = root.getElementById('eg-error-msg');
if (el && msgEl) { msgEl.textContent = msg; el.classList.add('show'); el.scrollIntoView({behavior:'smooth',block:'nearest'}); }
}
function hideError() { var el = root.getElementById('eg-error'); if (el) el.classList.remove('show'); }
function showConfirm(name) {
var form = root.getElementById('eg-acct-form'), confirm = root.getElementById('eg-confirm'), nameEl = root.getElementById('eg-confirm-name');
if (form) form.style.display = 'none';
if (confirm) confirm.classList.add('show');
if (nameEl) nameEl.textContent = name;
}
function setLoading(loading) {
var btn = root.getElementById('eg-submit-btn'), btnText = root.getElementById('eg-btn-text'), arrow = root.getElementById('eg-btn-arrow');
if (!btn) return;
if (loading) { btn.classList.add('loading'); if (btnText) btnText.textContent = 'Sending...'; if (arrow) arrow.style.display = 'none'; }
else { btn.classList.remove('loading'); if (btnText) btnText.textContent = 'Submit'; if (arrow) arrow.style.display = ''; }
}
var form = root.getElementById('eg-acct-form');
if (form) {
form.addEventListener('submit', function(e) {
e.preventDefault();
hideError();
var errors = validateForm();
if (errors.length > 0) { showError(errors[0]); return; }
setLoading(true);
var cc = root.getElementById('eg-cc').value;
var fname = root.getElementById('eg-fname').value.trim();
// Tag the lead so the email clearly shows this is the Account Management form.
var srcVal = root.getElementById('eg-src').value;
var taggedSource = '[Amazon Full Account Management] ' + srcVal;
var data = {
action: 'eg_ppc_audit_form',
nonce: (typeof window.egFormNonce !== 'undefined') ? window.egFormNonce : '',
form_type: 'Amazon Full Account Management',
first_name: fname,
last_name: root.getElementById('eg-lname').value.trim(),
email: root.getElementById('eg-email').value.trim(),
phone: cc + ' ' + root.getElementById('eg-phone').value.trim(),
brand_name: root.getElementById('eg-brand').value.trim(),
monthly_revenue: root.getElementById('eg-rev').value,
source: taggedSource,
sms_consent: root.getElementById('eg-consent').checked ? 'Yes' : 'No'
};
var body = Object.keys(data).map(function(k){ return encodeURIComponent(k) + '=' + encodeURIComponent(data[k]); }).join('&');
var ajaxUrl = (typeof window.ajaxurl !== 'undefined') ? window.ajaxurl : '/wp-admin/admin-ajax.php';
fetch(ajaxUrl, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: body })
.then(function(r){ return r.json(); })
.then(function(res){
setLoading(false);
if (res && res.success) { showConfirm(fname); }
else { showError((res && res.data) ? res.data : 'Something went wrong. Please try again.'); }
})
.catch(function(){ setLoading(false); showError('Network error. Please check your connection and try again.'); });
});
}
})();
',
' ',
'
'
].join('');
// JS-driven animation (does not depend on CSS keyframes or image load timing)
var track = root.getElementById('ecg-track');
var x = 0;
var speed = 0.5; // pixels per frame (~30px/sec) — lower = slower
var paused = false;
var half = 0;
function measure() { half = track.scrollWidth / 2; }
// measure after images load so width is correct
if (document.readyState === 'complete') measure();
window.addEventListener('load', measure);
setTimeout(measure, 400);
setTimeout(measure, 1500);
track.addEventListener('mouseenter', function () { paused = true; });
track.addEventListener('mouseleave', function () { paused = false; });
function step() {
if (!paused && half > 0) {
x -= speed;
if (x <= -half) x += half; // seamless loop
track.style.transform = 'translateX(' + x + 'px)';
}
requestAnimationFrame(step);
}
requestAnimationFrame(step);
})();
We Operate in the Following Countries 🌍
', 'Trusted across every official Amazon marketplace worldwide
', '' + pills() + pills() + '
