var currentTab = 0; // Current tab is set to be the first tab (0) showTab(currentTab); // Display the current tab
function showTab(n) { // This function will display the specified tab of the form... var x = document.getElementsByClassName("tab"); x[n].style.display = "block"; //... and fix the Previous/Next buttons: if (n == 0) {
document.getElementById("prevBtn").style.display = "none"; document.getElementById("theresults").style.height = "0px"; document.getElementById("theresults").style.overflow = "hidden";
document.getElementById("rob").innerHTML = "Beantwoord volgende vragen en ontdek de formule die het best bij je past!";
} else { document.getElementById("prevBtn").style.display = "inline"; document.getElementById("nextBtn").innerHTML = "Versturen"; } if (n == (x.length - 1)) { document.getElementById("prevBtn").style.display = "none"; document.getElementById("nextBtn").style.textAlign = "center"; document.getElementById("nextBtn").innerHTML = "Reset"; document.getElementById("rob").innerHTML = "Jouw ideale pakket!"; document.getElementById("theresults").style.overflow = "visible"; document.getElementById("theresults").style.height = "auto"; location.hash = "#theresults"; } else { yesnoCheck() document.getElementById("nextBtn").innerHTML = "Volgende"; }
if (n == (x.length - 2)) { document.getElementById("nextBtn").innerHTML = "Versturen"; } else {
}
//... and run a function that will display the correct step indicator: fixStepIndicator(n) }
function nextPrev(n) { rangecheck() // This function will figure out which tab to display var x = document.getElementsByClassName("tab"); // Exit the function if any field in the current tab is invalid: if (n == 1 && !validateForm()) return false; // Hide the current tab: x[currentTab].style.display = "none"; // Increase or decrease the current tab by 1: currentTab = currentTab + n; // if you have reached the end of the form... if (currentTab >= x.length) { // ... the form gets submitted: // document.getElementById("regForm").submit(); document.getElementById("nextBtn").innerHTML = "Versturen"; currentTab = 0; showTab(currentTab);
yesnoCheck() return false; } // Otherwise, display the correct tab: showTab(currentTab); }
function rangecheck() {
x = document.getElementById("ranger").value console.log(x); document.getElementById("slick-slide00").style.display = 'none'; document.getElementById("slick-slide01").style.display = 'none'; document.getElementById("slick-slide02").style.display = 'none'; document.getElementById("slick-slide03").style.display = 'none'; document.getElementById("slick-slide04").style.display = 'none'; document.getElementById("slick-slide05").style.display = 'none'; document.getElementById("slick-slide06").style.display = 'none'; document.getElementById("slick-slide07").style.display = 'none'; document.getElementById("slick-slide08").style.display = 'none'; document.getElementById("slick-slide09").style.display = 'none'; document.getElementById("slick-slide010").style.display = 'none'; document.getElementById("slick-slide01").setAttribute("class", "slick-slide"); document.getElementById("slick-slide02").setAttribute("class", "slick-slide"); document.getElementById("slick-slide03").setAttribute("class", "slick-slide"); document.getElementById("slick-slide04").setAttribute("class", "slick-slide"); document.getElementById("slick-slide05").setAttribute("class", "slick-slide"); document.getElementById("slick-slide06").setAttribute("class", "slick-slide"); document.getElementById("slick-slide07").setAttribute("class", "slick-slide"); document.getElementById("slick-slide07").setAttribute("class", "slick-slide"); document.getElementById("slick-slide08").setAttribute("class", "slick-slide"); document.getElementById("slick-slide09").setAttribute("class", "slick-slide"); document.getElementById("slick-slide010").setAttribute("class", "slick-slide");
if (x==1) { document.getElementById("slick-slide01").style.display = 'block'; document.getElementById("slick-slide02").style.display = 'block'; document.getElementById("slick-slide03").style.display = 'block'; document.getElementById("slick-slide02").setAttribute("class", "suggested slick-slide"); document.getElementById("slick-slide01").setAttribute("class", "notme slick-slide"); document.getElementById("slick-slide03").setAttribute("class", "notme slick-slide"); }
if (x==2) { document.getElementById("slick-slide01").style.display = 'block'; document.getElementById("slick-slide03").style.display = 'block'; document.getElementById("slick-slide04").style.display = 'block'; document.getElementById("slick-slide03").setAttribute("class", "suggested slick-slide"); document.getElementById("slick-slide01").setAttribute("class", "notme slick-slide"); document.getElementById("slick-slide04").setAttribute("class", "notme slick-slide"); } if (x==3) { document.getElementById("slick-slide00").style.display = 'block'; document.getElementById("slick-slide04").style.display = 'block'; document.getElementById("slick-slide05").style.display = 'block'; document.getElementById("slick-slide04").setAttribute("class", "suggested slick-slide"); document.getElementById("slick-slide00").setAttribute("class", "notme slick-slide"); document.getElementById("slick-slide05").setAttribute("class", "notme slick-slide"); } if (x==4) { document.getElementById("slick-slide00").style.display = 'block'; document.getElementById("slick-slide05").style.display = 'block'; document.getElementById("slick-slide06").style.display = 'block'; document.getElementById("slick-slide05").setAttribute("class", "suggested slick-slide"); document.getElementById("slick-slide00").setAttribute("class", "notme slick-slide"); document.getElementById("slick-slide06").setAttribute("class", "notme slick-slide");
} if (x==5) { document.getElementById("slick-slide00").style.display = 'block'; document.getElementById("slick-slide06").style.display = 'block'; document.getElementById("slick-slide07").style.display = 'block'; document.getElementById("slick-slide06").setAttribute("class", "suggested slick-slide"); document.getElementById("slick-slide00").setAttribute("class", "notme slick-slide"); document.getElementById("slick-slide07").setAttribute("class", "notme slick-slide"); } if (x==6) { document.getElementById("slick-slide00").style.display = 'block'; document.getElementById("slick-slide07").style.display = 'block'; document.getElementById("slick-slide08").style.display = 'block'; document.getElementById("slick-slide07").setAttribute("class", "suggested slick-slide"); document.getElementById("slick-slide00").setAttribute("class", "notme slick-slide"); document.getElementById("slick-slide08").setAttribute("class", "notme slick-slide"); } if (x==7) { document.getElementById("slick-slide00").style.display = 'block'; document.getElementById("slick-slide08").style.display = 'block'; document.getElementById("slick-slide09").style.display = 'block'; document.getElementById("slick-slide08").setAttribute("class", "suggested slick-slide"); document.getElementById("slick-slide00").setAttribute("class", "notme slick-slide"); document.getElementById("slick-slide09").setAttribute("class", "notme slick-slide"); } if (x==8) { document.getElementById("slick-slide00").style.display = 'block'; document.getElementById("slick-slide09").style.display = 'block'; document.getElementById("slick-slide010").style.display = 'block'; document.getElementById("slick-slide09").setAttribute("class", "suggested slick-slide"); document.getElementById("slick-slide00").setAttribute("class", "notme slick-slide"); document.getElementById("slick-slide010").setAttribute("class", "notme slick-slide"); } if (x==9) { document.getElementById("slick-slide00").style.display = 'block';
document.getElementById("slick-slide010").style.display = 'block'; document.getElementById("slick-slide010").setAttribute("class", "suggested slick-slide"); document.getElementById("slick-slide00").setAttribute("class", "notme slick-slide");
}
} function yesnoCheck() {
if (document.getElementById('yesone').checked) { flag1=1
document.getElementById("chkbox01").checked = true; document.getElementById("chkbox03").checked = true; document.getElementById("chkbox05").checked = true; document.getElementById("chkbox07").checked = true; document.getElementById("chkbox09").checked = true; document.getElementById("chkbox11").checked = true; document.getElementById("chkbox13").checked = true; document.getElementById("chkbox15").checked = true; document.getElementById("chkbox17").checked = true;
} else { flag1=0
document.getElementById("chkbox01").checked = false; document.getElementById("chkbox03").checked = false; document.getElementById("chkbox05").checked = false; document.getElementById("chkbox07").checked = false; document.getElementById("chkbox09").checked = false; document.getElementById("chkbox11").checked = false; document.getElementById("chkbox13").checked = false; document.getElementById("chkbox15").checked = false; document.getElementById("chkbox17").checked = false;
}
if (document.getElementById('yestwo').checked) { flag2=1
document.getElementById("chkbox02").checked = true; document.getElementById("chkbox04").checked = true; document.getElementById("chkbox06").checked = true; document.getElementById("chkbox08").checked = true; document.getElementById("chkbox10").checked = true; document.getElementById("chkbox12").checked = true; document.getElementById("chkbox14").checked = true; document.getElementById("chkbox16").checked = true; document.getElementById("chkbox18").checked = true;
}
else { flag2=0
document.getElementById("chkbox02").checked = false; document.getElementById("chkbox04").checked = false; document.getElementById("chkbox06").checked = false; document.getElementById("chkbox08").checked = false; document.getElementById("chkbox10").checked = false; document.getElementById("chkbox12").checked = false; document.getElementById("chkbox14").checked = false; document.getElementById("chkbox16").checked = false; document.getElementById("chkbox18").checked = false;
}
theprices()
}
function yesnoCheck2() {
if ((document.getElementById('chkbox01').checked)&&(document.getElementById('chkbox02').checked)) {
document.getElementById("year_0").textContent="181"; document.getElementById("month_0").textContent="17"; }
if ((!document.getElementById('chkbox01').checked )&&(!document.getElementById('chkbox02').checked)) {
document.getElementById("year_0").textContent="49"; document.getElementById("month_0").textContent="5"; }
if (((!document.getElementById('chkbox01').checked )&&(document.getElementById('chkbox02').checked)) || ((document.getElementById('chkbox01').checked )&&(!document.getElementById('chkbox02').checked))){
document.getElementById("year_0").textContent="137"; document.getElementById("month_0").textContent="13"; }
if ((document.getElementById('chkbox03').checked)&&(document.getElementById('chkbox04').checked)) {
document.getElementById("year_1").textContent="303"; document.getElementById("month_1").textContent="28"; }
if ((!document.getElementById('chkbox03').checked )&&(!document.getElementById('chkbox04').checked)) {
document.getElementById("year_1").textContent="99"; document.getElementById("month_1").textContent="10"; }
if (((!document.getElementById('chkbox03').checked )&&(document.getElementById('chkbox04').checked)) || ((document.getElementById('chkbox03').checked )&&(!document.getElementById('chkbox04').checked))){
document.getElementById("year_1").textContent="220"; document.getElementById("month_1").textContent="21"; }
if ((document.getElementById('chkbox05').checked)&&(document.getElementById('chkbox06').checked)) {
document.getElementById("year_2").textContent="509"; document.getElementById("month_2").textContent="50"; }
if ((!document.getElementById('chkbox05').checked )&&(!document.getElementById('chkbox06').checked)) {
document.getElementById("year_2").textContent="199"; document.getElementById("month_2").textContent="20"; }
if (((!document.getElementById('chkbox05').checked )&&(document.getElementById('chkbox06').checked)) || ((document.getElementById('chkbox05').checked )&&(!document.getElementById('chkbox06').checked))){
document.getElementById("year_2").textContent="386"; document.getElementById("month_2").textContent="37"; }
if ((document.getElementById('chkbox07').checked)&&(document.getElementById('chkbox08').checked)) {
document.getElementById("year_3").textContent="739"; document.getElementById("month_3").textContent="70"; }
if ((!document.getElementById('chkbox07').checked )&&(!document.getElementById('chkbox08').checked)) {
document.getElementById("year_3").textContent="299"; document.getElementById("month_3").textContent="30"; }
if (((!document.getElementById('chkbox07').checked )&&(document.getElementById('chkbox08').checked)) || ((document.getElementById('chkbox07').checked )&&(!document.getElementById('chkbox08').checked))){
document.getElementById("year_3").textContent="541"; document.getElementById("month_3").textContent="52"; }
if ((document.getElementById('chkbox09').checked)&&(document.getElementById('chkbox10').checked)) {
document.getElementById("year_5").textContent="1115"; document.getElementById("month_5").textContent="101"; }
if ((!document.getElementById('chkbox09').checked )&&(!document.getElementById('chkbox10').checked)) {
document.getElementById("year_5").textContent="499"; document.getElementById("month_5").textContent="45"; }
if (((!document.getElementById('chkbox09').checked )&&(document.getElementById('chkbox10').checked)) || ((document.getElementById('chkbox09').checked )&&(!document.getElementById('chkbox10').checked))){
document.getElementById("year_5").textContent="829"; document.getElementById("month_5").textContent="75"; }
if ((document.getElementById('chkbox11').checked)&&(document.getElementById('chkbox12').checked)) {
document.getElementById("year_10").textContent="1999"; document.getElementById("month_10").textContent="185"; }
if ((!document.getElementById('chkbox11').checked )&&(!document.getElementById('chkbox12').checked)) {
document.getElementById("year_10").textContent="899"; document.getElementById("month_10").textContent="85"; }
if (((!document.getElementById('chkbox11').checked )&&(document.getElementById('chkbox12').checked)) || ((document.getElementById('chkbox11').checked )&&(!document.getElementById('chkbox12').checked))){
document.getElementById("year_10").textContent="1471"; document.getElementById("month_10").textContent="137"; }
if ((document.getElementById('chkbox13').checked)&&(document.getElementById('chkbox14').checked)) {
document.getElementById("year_15").textContent="2729"; document.getElementById("month_15").textContent="260"; }
if ((!document.getElementById('chkbox13').checked )&&(!document.getElementById('chkbox14').checked)) {
document.getElementById("year_15").textContent="1299"; document.getElementById("month_15").textContent="130"; }
if (((!document.getElementById('chkbox13').checked )&&(document.getElementById('chkbox14').checked)) || ((document.getElementById('chkbox13').checked )&&(!document.getElementById('chkbox14').checked))){
document.getElementById("year_15").textContent="2036"; document.getElementById("month_15").textContent="197"; }
if ((document.getElementById('chkbox15').checked)&&(document.getElementById('chkbox16').checked)) {
document.getElementById("year_25").textContent="4199"; document.getElementById("month_25").textContent="400"; }
if ((!document.getElementById('chkbox15').checked )&&(!document.getElementById('chkbox16').checked)) {
document.getElementById("year_25").textContent="1999"; document.getElementById("month_25").textContent="200"; }
if (((!document.getElementById('chkbox15').checked )&&(document.getElementById('chkbox16').checked)) || ((document.getElementById('chkbox15').checked )&&(!document.getElementById('chkbox16').checked))){
document.getElementById("year_25").textContent="3121"; document.getElementById("month_25").textContent="302"; }
if ((document.getElementById('chkbox17').checked)&&(document.getElementById('chkbox18').checked)) {
document.getElementById("year_50").textContent="7680"; document.getElementById("month_50").textContent="730"; }
if ((!document.getElementById('chkbox17').checked )&&(!document.getElementById('chkbox18').checked)) {
document.getElementById("year_50").textContent="3500"; document.getElementById("month_50").textContent="350"; }
if (((!document.getElementById('chkbox17').checked )&&(document.getElementById('chkbox18').checked)) || ((document.getElementById('chkbox17').checked )&&(!document.getElementById('chkbox18').checked))){
document.getElementById("year_50").textContent="5612"; document.getElementById("month_50").textContent="542"; }
}
function theprices() {
if (flag1 == 0 && flag2==0){ document.getElementById("month_0").textContent="5"; document.getElementById("month_1").textContent="10"; document.getElementById("month_2").textContent="20"; document.getElementById("month_3").textContent="30"; document.getElementById("month_5").textContent="45"; document.getElementById("month_10").textContent="85"; document.getElementById("month_15").textContent="130"; document.getElementById("month_25").textContent="200"; document.getElementById("month_50").textContent="350";
document.getElementById("year_0").textContent="49"; document.getElementById("year_1").textContent="99"; document.getElementById("year_2").textContent="199"; document.getElementById("year_3").textContent="299"; document.getElementById("year_5").textContent="499"; document.getElementById("year_10").textContent="899"; document.getElementById("year_15").textContent="1299"; document.getElementById("year_25").textContent="1999"; document.getElementById("year_50").textContent="3500";
}
if ((flag1 == 1 && flag2==0) || (flag1 == 0 && flag2==1)){ document.getElementById("month_0").textContent="13"; document.getElementById("month_1").textContent="21"; document.getElementById("month_2").textContent="37"; document.getElementById("month_3").textContent="52"; document.getElementById("month_5").textContent="75"; document.getElementById("month_10").textContent="137"; document.getElementById("month_15").textContent="197"; document.getElementById("month_25").textContent="302"; document.getElementById("month_50").textContent="542";
document.getElementById("year_0").textContent="137"; document.getElementById("year_1").textContent="220"; document.getElementById("year_2").textContent="386"; document.getElementById("year_3").textContent="541"; document.getElementById("year_5").textContent="829"; document.getElementById("year_10").textContent="1471"; document.getElementById("year_15").textContent="2036"; document.getElementById("year_25").textContent="3121"; document.getElementById("year_50").textContent="5612";
}
if (flag1 == 1 && flag2==1){ document.getElementById("month_0").textContent="17"; document.getElementById("month_1").textContent="28"; document.getElementById("month_2").textContent="50"; document.getElementById("month_3").textContent="70"; document.getElementById("month_5").textContent="101"; document.getElementById("month_10").textContent="185"; document.getElementById("month_15").textContent="260"; document.getElementById("month_25").textContent="400"; document.getElementById("month_50").textContent="730";
document.getElementById("year_0").textContent="181"; document.getElementById("year_1").textContent="303"; document.getElementById("year_2").textContent="509"; document.getElementById("year_3").textContent="739"; document.getElementById("year_5").textContent="1115"; document.getElementById("year_10").textContent="1999"; document.getElementById("year_15").textContent="2729"; document.getElementById("year_25").textContent="4199"; document.getElementById("year_50").textContent="7680";
}
}
function validateForm() { // This function deals with validation of the form fields var x, y, i, valid = true; x = document.getElementsByClassName("tab"); y = x[currentTab].getElementsByTagName("input"); // A loop that checks every input field in the current tab: for (i = 0; i < y.length; i++) { // If a field is empty... if (y[i].value == "") { // add an "invalid" class to the field: y[i].className += " invalid"; // and set the current valid status to false valid = false; } } // If the valid status is true, mark the step as finished and valid: if (valid) { document.getElementsByClassName("step")[currentTab].className += " finish"; } return valid; // return the valid status } function fixStepIndicator(n) { // This function removes the "active" class of all steps... var i, x = document.getElementsByClassName("step"); for (i = 0; i < x.length; i++) { x[i].className = x[i].className.replace(" active", ""); } //... and adds the "active" class on the current step: x[n].className += " active"; }