if (document.getElementById("countdownTimer")) {
  var min = document.getElementById("countdownTimer").getAttribute("data-minutes");
  var sec = document.getElementById("countdownTimer").getAttribute("data-seconds");

  function countDown() {
    sec--;
    if (sec == -01) {
      sec = 59;
      min = min - 1;
    } else {
      min = min;
    }

    if (sec <= 9) {
      sec = "0" + sec;
    }

    time = (min <= 9 ? "0" + min : min) + ":" + sec;

    if (document.getElementById) {
      document.getElementById("countdownTimer").innerHTML = time;
    }

    SD = window.setTimeout("countDown();", 1000);
    if (min == "00" && sec == "00") {
      sec = "00";
      window.clearTimeout(SD);
    }
  }

  window.onload = countDown;
}

var resultWrapper = document.querySelector(".spin-result-wrapper-first");
var rulet = document.querySelector(".rulet-img-first");

function spinFirst() {
  console.log('spinFirst');
  $("#promo3-template .cursor-text").css("pointer-events", "none");
  if (rulet.classList.contains("rotated")) {
    resultWrapper.style.display = "block";
  } else {
    rulet.classList.add("super-rotation");
    setTimeout(function () {
      resultWrapper.style.display = "block";

      // start_timer();
      $(".spin-wrapper-first").slideUp();
      $(".order_block-first").slideDown();
    }, 7000);

    rulet.classList.add("rotated");
  }
}

$("#promo3-template .pop-up-button").click(function (e) {
  e.preventDefault();

  $("#promo3-template .spin-result-wrapper").fadeOut();
});
