const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches; /* ============ CONFIG · HubSpot (live, end-to-end geverifieerd 21-24 aug) ============ */ const HS_PORTAL_ID = '19617730'; // E-Flight HubSpot portal (na1) const HS_FORMS = { interest: '4cc59fb0-f6b9-40ec-8a55-3222eb3f4d01', // callback/interesse (sectie #infosessie), data-source=infosessie info: 'b0ccc55f-0c6c-4215-a98e-9ead6ea06fbc', // wizard: brochure/infosessie-keuze (wizard-info + wizard-result) financing: '8a92bcfe-2295-45a4-af1f-0946764414bb', // wizard fin + kosten/FAQ-modal brochure: '3e7c63bc-b24a-4b49-931f-1d1dea56fb16' // NIET MEER IN GEBRUIK sinds 24 aug (brochure-modal is nu een info-form met brochure+infosessie); GUID bewaard }; // Contact-property `geinteresseerd_in` (enum) = "ATPL Modulair". Op alle ATPL-forms meesturen zodat // deze leads account-breed als "ATPL Modulair" te segmenteren zijn (zelfde property als alle E-Flight- // funnels). Geverifieerd 2026-08-20 via v3-endpoint-probe: de integration-submit-API is lenient — // accepteert geldige contact-properties óók als ze niet als form-field zijn toegevoegd; weigert de // submission niet. Daarom onvoorwaardelijk meesturen op elk form. // LET OP: interne value blijft 'ATPL Modulair' (Forms API stuurt de value, niet het label). // HubSpot toont dit label als "ATPL Parttime". NIET veranderen naar 'ATPL Parttime' = breekt de match. const HS_INTEREST_VALUE = 'ATPL Modulair'; // GDPR-subscriptions (opt-in checkboxes). Vul de portal-specifieke subscriptionTypeId's in: // HubSpot → Settings → Marketing → Email → Subscription Types → open het type, ID staat in de URL. // id:0 = nog niet ingevuld → wordt NIET meegestuurd (veilig; submission blijft werken). Alleen // AANGEVINKTE opt-ins sturen we als value:true; niet-aangevinkt gaat als value:false (bewuste keuze). const HS_SUBS = { marketingNl: { id: 12257460, text: 'Marketing informatie (nieuws, aanbiedingen en events)' }, marketingEn: { id: 3375792903, text: 'English Marketing information (news, offers and events)' } }; /* ============ CONFIG · Infosessies ============ Eén regel per geplande sessie; leeg array = pagina valt terug op wachtlijst-gedrag. De pill stuurt start.slice(0,10) (bv. "2026-11-20") naar enum-property `infosessiekeuze`; die datum-string moet als optie op die property bestaan (HubSpot). Sessie vol? Zet full:true. */ const SESSIONS = [ { start:'2026-10-13T09:00:00+02:00', label:'Dinsdag 13 oktober · 09:00–11:30 · E-Deck, vliegveld Teuge', full:false }, { start:'2026-11-20T14:30:00+01:00', label:'Vrijdag 20 november · 14:30–16:30 · E-Deck, vliegveld Teuge', full:false } ]; // sticky CTA (nav komt uit het thema; alleen de bottom-bar blijft hier) const stickyCta = document.getElementById('stickyCta'); const stickyInfo = document.getElementById('infosessie'); if(stickyCta && stickyInfo){ addEventListener('scroll', ()=>{ const r = stickyInfo.getBoundingClientRect(); stickyCta.classList.toggle('show', scrollY > innerHeight*.7 && r.top >= innerHeight); }, {passive:true}); } // hero-video pauzeren bij reduced motion if(reduce){ document.querySelectorAll('video').forEach(v=>v.pause?.()); } // hero: roterend accent-woord ("route naar piloot", bewust breed) const rotWords = ['de cockpit','een tweede carrière','je eerste solo','beroepspiloot']; const rotEl = document.getElementById('rotw'); if(rotEl && !reduce){ let wi = 0; setInterval(()=>{ rotEl.classList.add('out'); setTimeout(()=>{ wi=(wi+1)%rotWords.length; rotEl.textContent=rotWords[wi]; rotEl.classList.remove('out'); }, 360); }, 3400); } // reveals + count-ups (NL-formattering) function fmtNL(value, dec, sep){ let s = value.toFixed(dec); let [int, frac] = s.split('.'); if(sep) int = int.replace(/\B(?=(\d{3})+(?!\d))/g, '.'); return frac ? int + ',' + frac : int; } function runCount(el){ const target=parseFloat(el.dataset.count), dec=parseInt(el.dataset.dec||'0',10), sep=el.dataset.sep==='1'; if(reduce){ el.textContent=fmtNL(target,dec,sep); return; } const s=performance.now(), d=1800; (function t(n){const p=Math.min((n-s)/d,1),e=1-Math.pow(1-p,3); el.textContent=fmtNL(e*target,dec,sep); if(p<1)requestAnimationFrame(t);})(s); } const io=new IntersectionObserver((entries)=>{ entries.forEach(en=>{ if(!en.isIntersecting) return; en.target.classList.add('in'); en.target.querySelectorAll?.('[data-count]').forEach(runCount); if(en.target.matches('[data-count]')) runCount(en.target); io.unobserve(en.target); }); },{threshold:.2}); document.querySelectorAll('.rv').forEach(el=>io.observe(el)); /* ============ GA4 events — taxonomie aug 2026 (namen met underscore; GA4 verbiedt koppeltekens in NAMEN, waarden mogen wel) ============ atpl_form_start / atpl_form_submit / atpl_form_error {atpl_form, atpl_source} atpl_click_interest {atpl_label} · atpl_reach_interest_form atpl_reach_section {atpl_section} (waarde uit data-section op de
, ontdubbeld op waarde) atpl_click_info {atpl_info} · atpl_click_wizard {atpl_intent} · atpl_result_wizard atpl_click_faq {atpl_question} · atpl_click_outbound / atpl_click_subpage {atpl_label, atpl_link_url} · atpl_click_contact {atpl_link_url} data-section: hoe+opleiding=atpl-course-overview · programma=atpl-route · switcher-quote=atpl-quote · carriere=atpl-career kosten=atpl-price · social=atpl-review · infosessie=atpl-interest · toelating=atpl-wizard · faq=atpl-faq · slot=atpl-contact data-form: interest · info · financing · brochure (bron via data-source: infosessie/wizard-info/wizard-result/wizard/modal) Verwijderd t.o.v. vorige versie: atpl_role, atpl_location, atpl_branch. Info-modal-map -> atpl_info-waarden. */ function track(name, params){ try{ gtag('event', name, Object.assign({atpl_track:'parttime'}, params||{})); }catch(e){} } const INFO_MAP={'usp-kwaliteit':'atpl-usp-personal','usp-instructeurs':'atpl-usp-instructors','usp-omgeving':'atpl-usp-new-aviation','usp-carriere':'atpl-usp-career','brochure':'atpl-button-brochure','financing':'atpl-button-financing'}; document.querySelectorAll('[data-phone]').forEach(a=>a.addEventListener('click', ()=>track('atpl_click_contact',{atpl_link_url:a.href}))); /* ============ Intent: CTA naar #infosessie + sectie in beeld ============ */ document.querySelectorAll('a[href="#infosessie"]').forEach(a=>{ a.addEventListener('click', ()=>{ track('atpl_click_interest', {atpl_label:a.textContent.trim().replace(/\s+/g,' ')}); }); }); (function(){ const infoSection = document.getElementById('infosessie'); if(!infoSection || !('IntersectionObserver' in window)) return; let seen = false; const ob = new IntersectionObserver(entries=>entries.forEach(en=>{ if(en.isIntersecting && !seen){ seen = true; track('atpl_reach_interest_form',{}); ob.disconnect(); } }),{threshold:.3}); ob.observe(infoSection); })(); /* ============ Drop-off: elke sectie met id (behalve infosessie zelf) ============ */ (function(){ if(!('IntersectionObserver' in window)) return; const seen = {}; const so = new IntersectionObserver(entries=>entries.forEach(en=>{ const v=en.target.dataset.section; if(en.isIntersecting && v && !seen[v]){ seen[v]=true; track('atpl_reach_section',{atpl_section:v}); so.unobserve(en.target); } }),{threshold:.3}); document.querySelectorAll('section[data-section]').forEach(sn=>so.observe(sn)); })(); /* ============ Objecties: FAQ open ============ */ (function(){ function slug(t){ return (t||'').toLowerCase().normalize('NFD').replace(/[̀-ͯ]/g,'').replace(/[^a-z0-9]+/g,'-').replace(/^-+|-+$/g,'').slice(0,40); } document.querySelectorAll('.faq details').forEach(d=>{ d.addEventListener('toggle', ()=>{ if(!d.open) return; const sum = d.querySelector('summary'); track('atpl_click_faq',{atpl_question: d.getAttribute('data-faq') || slug(sum && sum.textContent)}); }); }); })(); /* ============ Deflectie: outbound links ============ */ document.querySelectorAll('a[href]').forEach(a=>{ if(a.matches('[data-phone], .soon, [href^="#"]')) return; const href = a.getAttribute('href') || ''; if(!/^(https?:|mailto:|\/pages\/)/i.test(href)) return; a.addEventListener('click', ()=>track('atpl_click_outbound',{atpl_label:a.textContent.trim().replace(/\s+/g,' '), atpl_link_url:href})); }); /* ============ Modals ============ */ let lastFocus=null; function bgVideos(){ return document.querySelectorAll('#top video, #carriere video'); } function inView(el){ const r=el.getBoundingClientRect(); return r.bottom>0 && r.top{ if(inView(v)){ const p=v.play&&v.play(); if(p&&p.catch)p.catch(()=>{}); } }); } // carrière-band video: pas laden/spelen wanneer in beeld én geen modal open (bespaart bandbreedte onder de vouw) const cbandVid=document.querySelector('#carriere video'); if(cbandVid && !reduce){ new IntersectionObserver(es=>es.forEach(en=>{ if(en.isIntersecting && document.body.style.overflow!=='hidden'){ const p=cbandVid.play&&cbandVid.play(); if(p&&p.catch)p.catch(()=>{}); } else cbandVid.pause(); }),{threshold:.25}).observe(cbandVid); } function openModal(name){ const m=document.getElementById('modal-'+name); if(!m) return; document.querySelectorAll('.modal.open').forEach(o=>{ if(o!==m){ o.classList.remove('open'); o.querySelectorAll('video').forEach(v=>{ v.pause(); v.currentTime=0; }); } }); bgVideos().forEach(v=>v.pause()); lastFocus=document.activeElement; m.classList.add('open'); document.body.style.overflow='hidden'; m.querySelector('input,button')?.focus(); if(!reduce){ m.querySelectorAll('video').forEach(v=>{ const p=v.play&&v.play(); if(p&&p.catch)p.catch(()=>{}); }); } track('atpl_click_info',{atpl_info: INFO_MAP[name] || name}); } function closeModals(){ document.querySelectorAll('.modal.open').forEach(m=>{ m.classList.remove('open'); m.querySelectorAll('video').forEach(v=>{ v.pause(); v.currentTime=0; }); }); document.body.style.overflow=''; if(!reduce){ resumeBgVideos(); } lastFocus?.focus?.(); } document.querySelectorAll('[data-modal]').forEach(b=>b.addEventListener('click', ()=>openModal(b.dataset.modal))); // opleiding-kaarten: Enter/spatie opent de modal; de video speelt zodra je hovert (niet bij reduced motion) document.querySelectorAll('.ocard').forEach(c=>{ c.addEventListener('keydown', e=>{ if(e.key==='Enter'||e.key===' '){ e.preventDefault(); c.click(); } }); const v=c.querySelector('video'); if(v && !reduce){ c.addEventListener('mouseenter', ()=>{ const p=v.play&&v.play(); if(p&&p.catch)p.catch(()=>{}); }); c.addEventListener('mouseleave', ()=>{ if(v.pause){ v.pause(); v.currentTime=0; } }); } }); document.querySelectorAll('.modal [data-close]').forEach(el=>el.addEventListener('click', e=>{ // anchors met data-close (bijv. → #infosessie) laten navigeren én sluiten closeModals(); })); addEventListener('keydown', e=>{ if(e.key==='Escape') closeModals(); }); /* ============ Formulieren → HubSpot Forms API ============ */ function getCookie(name){ const m=document.cookie.match('(^|;)\\s*'+name+'\\s*=\\s*([^;]+)'); return m ? m.pop() : ''; } async function submitToHubspot(kind, fields, consent, subs){ const guid = HS_FORMS[kind]; const outFields = Object.entries(fields).map(([name,value])=>({name,value})); outFields.push({name:'geinteresseerd_in', value:HS_INTEREST_VALUE}); const payload = { fields: outFields, context: { hutk: getCookie('hubspotutk') || undefined, pageUri: location.href, pageName: document.title } }; if(consent && consent.given){ const _c = { consentToProcess: true, text: consent.text || 'Ik ga akkoord dat E-Flight Academy contact met me opneemt.' }; // Alleen subscription-types met een echt (ingevuld) subscriptionTypeId meesturen — anders weigert HubSpot. const _comms = (subs||[]).filter(s=>s.subscriptionTypeId).map(s=>({ value: !!s.value, subscriptionTypeId: s.subscriptionTypeId, text: s.text })); if(_comms.length) _c.communications = _comms; payload.legalConsentOptions = { consent: _c }; } if(HS_PORTAL_ID === 'HS_PORTAL_ID' || !guid || guid.indexOf('HS_FORM_GUID') === 0){ // Prototype-modus: portal of deze form-GUID nog niet ingevuld — log en simuleer succes. console.warn('[ATPL] HubSpot niet geconfigureerd (' + kind + ') — payload:', kind, payload); return true; } const res = await fetch('https://api.hsforms.com/submissions/v3/integration/submit/'+HS_PORTAL_ID+'/'+guid,{ method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify(payload) }); return res.ok; } document.querySelectorAll('form[data-form]').forEach(form=>{ let started = false; form.addEventListener('focusin', ()=>{ if(started) return; started = true; track('atpl_form_start',{atpl_form:form.dataset.form, atpl_source:form.dataset.source||''}); }); form.addEventListener('submit', async e=>{ e.preventDefault(); const kind = form.dataset.form; const msg = form.querySelector('.form-msg'); const btn = form.querySelector('button[type="submit"]'); const data = Object.fromEntries(new FormData(form).entries()); // --- HubSpot-veld-alignment (zie HUBSPOT-properties / WORK-LOG) --- const _cEl = form.querySelector('input[name="consent"]'); const _consent = _cEl ? { given: _cEl.checked, text: (_cEl.closest('label') ? _cEl.closest('label').textContent : '').replace(/\s+/g,' ').trim() } : null; delete data.consent; // niet als los veld sturen; gaat via legalConsentOptions // Subscription-opt-ins verzamelen (marketing + 1-op-1); als checkbox-veld i.p.v. HubSpot-property. // Marketing is taal-afhankelijk: NL → 'Marketing informatie', EN → 'English Marketing information'. const _subs = []; const _mkEl = form.querySelector('input[name="sub_marketing"]'); if(_mkEl){ const _lang = (form.querySelector('input[name="sub_marketing_lang"]:checked')||{}).value === 'en' ? 'en' : 'nl'; const _mk = _lang === 'en' ? HS_SUBS.marketingEn : HS_SUBS.marketingNl; _subs.push({ subscriptionTypeId:_mk.id, value:_mkEl.checked, text:_mk.text }); } delete data.sub_marketing; delete data.sub_marketing_lang; if(data.ervaring){ if(!data.vliegervaring) data.vliegervaring = data.ervaring; delete data.ervaring; } // wizard 'ervaring' -> property 'vliegervaring' if('sessie_keuze' in data){ // infosessie-pills (wizard + info-modal): sessie -> enum-property infosessiekeuze, wachtlijst -> infosessie-stempel if(data.sessie_keuze==='wachtlijst') data.infosessie='ja'; else if(data.sessie_keuze){ data.infosessiekeuze = data.sessie_keuze; delete data.infosessie; } // echte aanmelding: enum-property infosessiekeuze (waarde = sessiedatum-string; datetime kan niet via forms-API, getest 24 aug) delete data.sessie_keuze; } const _n = new Date(), _today = String(Date.UTC(_n.getFullYear(), _n.getMonth(), _n.getDate())); // midnight UTC, ms if(data.brochure) data.brochure = _today; // Date-property: stuur de datum i.p.v. "ja" if(data.infosessie) data.infosessie = _today; // idem msg.classList.remove('show','err'); const origBtn = btn.innerHTML; btn.disabled = true; btn.style.opacity=.7; btn.innerHTML = 'Cleared for takeoff…'; try{ const ok = await submitToHubspot(kind, data, _consent, _subs); if(!ok) throw new Error('submit failed'); track('atpl_form_submit', {atpl_form:kind, atpl_source:form.dataset.source||''}); form.style.display='none'; form.parentElement.querySelector('.form-success').classList.add('show'); }catch(err){ track('atpl_form_error', {atpl_form:kind, atpl_source:form.dataset.source||''}); msg.textContent='Even een doorstart. Probeer het nog eens of app ons: 055 203 2230.'; msg.classList.add('show','err'); btn.disabled=false; btn.style.opacity=1; btn.innerHTML=origBtn; } }); }); /* ============ Hoofd-CTA callback-formulier: tap-qualifiers -> hidden inputs (WIP) ============ */ (function(){ const cb = document.getElementById('cbform'); if(!cb) return; cb.querySelectorAll('.cb-opts').forEach(group=>{ const hidden = cb.querySelector('input[type="hidden"][name="'+group.dataset.field+'"]'); group.querySelectorAll('button').forEach(b=>{ b.addEventListener('click', ()=>{ group.querySelectorAll('button').forEach(x=>x.classList.remove('sel')); b.classList.add('sel'); if(hidden) hidden.value = b.dataset.val; }); }); }); })(); /* ============ Infosessie-aanmelding: alles rendert uit SESSIONS ============ */ (function(){ const next = SESSIONS.find(s=>!s.full); if(!next) return; // gedeelde pill-groep: sessies + wachtlijst-optie, niets voorgeselecteerd function buildPills(wrap, hidden, onPick){ const mk = (val, html, dis)=>{ const b=document.createElement('button'); b.type='button'; b.dataset.val=val; b.innerHTML=html; b.disabled=!!dis; wrap.appendChild(b); return b; }; SESSIONS.forEach(s=>mk(s.start.slice(0,10), s.label + (s.full?' · vol':''), s.full)); mk('wachtlijst','Deze data lukken niet · hou me op de hoogte', false); const btns=[...wrap.querySelectorAll('button')]; btns.forEach(b=>b.addEventListener('click', ()=>{ btns.forEach(x=>x.classList.remove('sel')); b.classList.add('sel'); hidden.value=b.dataset.val; if(onPick) onPick(b); })); } // submit zonder keuze tegenhouden: capture op een ouder, dus vóór de generieke submit-handler function blockIfEmpty(scope, form, hidden, active){ scope.addEventListener('submit', e=>{ if(!active() || hidden.value) return; e.preventDefault(); e.stopPropagation(); const msg=form.querySelector('.form-msg'); msg.textContent='Kies eerst een datum, of "hou me op de hoogte".'; msg.classList.add('show','err'); }, true); } // elke "Uitnodiging voor de infosessie"-checkbox (wizard + info-modal) klapt dezelfde pill-keuze uit document.querySelectorAll('input[type="checkbox"][name="infosessie"]').forEach(chk=>{ const label=chk.closest('label'); const hint=label.querySelector('.wz-hint'); if(hint) hint.textContent='Kies de datum die je past. Je bent in principe fysiek welkom op Teuge, online aansluiten kan ook maar raden wij niet aan.'; const box=document.createElement('div'); box.className='wz-opts col sessie-mini'; // pills altijd zichtbaar: datum kiezen vinkt de checkbox aan const hid=document.createElement('input'); hid.type='hidden'; hid.name='sessie_keuze'; label.after(hid); label.after(box); const form=chk.form; buildPills(box, hid, ()=>{ if(!chk.checked) chk.checked=true; form.querySelector('.form-msg').classList.remove('show','err'); }); chk.addEventListener('change', ()=>{ if(!chk.checked){ hid.value=''; box.querySelectorAll('button').forEach(x=>x.classList.remove('sel')); } }); blockIfEmpty(form.parentElement, form, hid, ()=>chk.checked); }); })(); /* ============ Deep-link #aanmelden: opent de info-modal met de infosessie-keuze uitgeklapt (voor de announcement-bar op de rest van de site, mails en socials) ============ */ (function(){ const openAanmelden = ()=>{ const chk = document.querySelector('#modal-brochure input[name="infosessie"]'); if(chk && !chk.checked){ chk.checked = true; chk.dispatchEvent(new Event('change')); } openModal('brochure'); }; if(location.hash === '#aanmelden') openAanmelden(); addEventListener('hashchange', ()=>{ if(location.hash === '#aanmelden') openAanmelden(); }); })(); /* ============ Wizard: router met vertakkingen ============ */ (function(){ const wz = document.getElementById('wizard'); if(!wz) return; const panels = {}; wz.querySelectorAll('[data-panel]').forEach(p=>{ panels[p.dataset.panel] = p; }); const ans = {}; const hist = []; let current = 'intent', started = false; function startOnce(){ started = true; } function show(id){ Object.keys(panels).forEach(k=>panels[k].classList.toggle('on', k===id)); current = id; } function goTo(id){ hist.push(current); if(id==='toeres'){ buildToeResult(); try{ track('atpl_result_wizard',{}); }catch(e){} } show(id); } function goBack(){ show(hist.pop() || 'intent'); } // Q1 intent (single-select, meteen doorrouteren) wz.querySelectorAll('.wz-intent button').forEach(b=>{ b.addEventListener('click', ()=>{ startOnce(); ans.intent = b.textContent.trim(); try{ track('atpl_click_wizard',{atpl_intent:b.dataset.goto}); }catch(e){} goTo(b.dataset.goto); }); }); // single-select tap-groepen -> ans + hidden input + next inschakelen wz.querySelectorAll('.wz-opts[data-field]').forEach(group=>{ const field = group.dataset.field; group.querySelectorAll('button').forEach(b=>{ b.addEventListener('click', ()=>{ startOnce(); group.querySelectorAll('button').forEach(x=>x.classList.remove('sel')); b.classList.add('sel'); ans[field] = b.dataset.val; const form = group.closest('form'); if(form){ const h = form.querySelector('input[type="hidden"][name="'+field+'"]'); if(h) h.value = b.dataset.val; } const panel = group.closest('[data-panel]'); const next = panel.querySelector('.wz-next'); if(next){ const done = [...panel.querySelectorAll('.wz-opts[data-field]')].every(g=>!!ans[g.dataset.field]); next.disabled = !done; } }); }); }); wz.querySelectorAll('.wz-next[data-goto]').forEach(b=>b.addEventListener('click', ()=>{ if(!b.disabled) goTo(b.dataset.goto); })); wz.querySelectorAll('.wz-back').forEach(b=>b.addEventListener('click', goBack)); function buildToeResult(){ // VEILIGHEID: uitsluitend vertrouwde constanten; user-input nooit als innerHTML. const notes = []; if(ans.medical === 'ja') notes.push('Met een geldige EASA Class 1 medical ben je startklaar.'); else if(ans.medical) notes.push('Vraag je Class 1 medical vroeg aan, de wachttijd kan oplopen. We helpen je op weg.'); if(ans.ervaring === 'nul') notes.push('Geen ervaring nodig, bijna iedereen begint hier bij nul.'); else if(ans.ervaring === 'wat') notes.push('Je bestaande uren kunnen we (deels) verrekenen.'); else if(ans.ervaring === 'brevet') notes.push('Met een brevet passen we je route aan.'); if(ans.engels === 'ja') notes.push('Mooi, de theorie is in het Engels, daar zit je goed.'); else if(ans.engels === 'beetje') notes.push('Basis-Engels is genoeg om te starten, je groeit er vanzelf in.'); else if(ans.engels === 'nee') notes.push('De theorie is in het Engels. Geen zorgen, we kijken samen naar je niveau.'); if(ans.vooropleiding === 'ja') notes.push('Met minimaal mbo-4 of havo zit je goed voor de theorie.'); else if(ans.vooropleiding === 'nee') notes.push('We raden minimaal mbo-4 of havo aan voor de theorie. Geen diploma? In een gesprek kijken we samen wat mogelijk is.'); else if(ans.vooropleiding === 'anders') notes.push('Twijfel je over je vooropleiding? Dat bespreken we in een persoonlijk gesprek.'); if(ans.fit === 'nee') notes.push('Qua lengte en gewicht zit je goed voor de Velis.'); else if(ans.fit === 'weet-niet') notes.push('Twijfel je over lengte of gewicht? Dat checken we tijdens een proefles.'); const box = document.getElementById('wzToeNotes'); box.textContent = ''; notes.forEach(n=>{ const sp = document.createElement('span'); sp.textContent = n; box.appendChild(sp); }); const panel = panels['toeres']; const proeflesBox = panel.querySelector('.wz-toe-proefles'); const infoForm = panel.querySelector('.wz-toe-info'); const needProefles = ans.fit === 'ja'; proeflesBox.style.display = needProefles ? '' : 'none'; infoForm.style.display = needProefles ? 'none' : ''; if(!needProefles){ ['medical','ervaring','engels','vooropleiding','fit'].forEach(f=>{ let h = infoForm.querySelector('input[type="hidden"][name="'+f+'"]'); if(!h){ h = document.createElement('input'); h.type = 'hidden'; h.name = f; infoForm.appendChild(h); } h.value = ans[f] || ''; }); } } })(); (function(){var t=document.getElementById("revTrack");if(!t)return;var fill=document.getElementById("revFill");function upd(){if(!fill)return;var max=t.scrollWidth-t.clientWidth;var vis=t.clientWidth/t.scrollWidth;var pos=max>0?t.scrollLeft/max:0;var w=Math.min(vis*100,100);fill.style.width=w+"%";fill.style.left=(pos*(100-w))+"%";}document.querySelectorAll("#social .rev-arrow").forEach(function(b){b.addEventListener("click",function(){var c=t.querySelector(".rev-card");var s=c?c.getBoundingClientRect().width+20:360;t.scrollBy({left:(b.getAttribute("data-dir")==="1"?1:-1)*s,behavior:"smooth"});});});t.addEventListener("scroll",upd);window.addEventListener("resize",upd);upd();})(); (function(){var t=document.getElementById('teamScroll');if(!t)return;document.querySelectorAll('.team-nav [data-team]').forEach(function(b){b.addEventListener('click',function(){var c=t.querySelector('.tm');var s=(c?c.getBoundingClientRect().width+16:216)*2;t.scrollBy({left:(b.getAttribute('data-team')==='1'?1:-1)*s,behavior:'smooth'});});});})();