// next prev
var divs = $(".show-section fieldset");
var now = 0;
divs.hide().first().show();

$(".next").on("click", function () {
  divs.eq(now).hide();
  now = now + 1 < divs.length ? now + 1 : 0;
  divs.eq(now).show(); // show next
  console.log(now);
  $(".stepsSlide .slideSingle")
    .eq(now - 1)
    .children(".fill")
    .addClass("w-100");
  $("#activeStepNumber").text(now + 1);
});

$(".prev").on("click", function () {
  divs.eq(now).hide();
  now = now > 0 ? now - 1 : divs.length - 1;
  divs.eq(now).show(); // show previous
  console.log(now);
  $(".stepsSlide .slideSingle").eq(now).children(".fill").removeClass("w-100");
  $("#activeStepNumber").text(now + 1);
});

$(document).ready(function () {
  $(".slideSingle .fill").removeClass("w-100");

  $("#form fieldset input").on("click", function () {
    $(this).closest("fieldset").find(".next, .apply").addClass("active");
  });

  $("#step1btn").on("click", function () {
    countresult(1);
  });
  $("#step2btn").on("click", function () {
    countresult(2);
  });
  $("#step3btn").on("click", function () {
    countresult(3);
  });
  $("#step4btn").on("click", function () {
    countresult(4);
  });

  $("#sub").on("click", function () {
    countresult(5);
    showresult();
  });
});
