var seconds = 60;
var countdownTimer;
var firstclick = false;

document.getElementById("press").addEventListener("click",function () {
    if (!firstclick) {
        countdownTimer = setInterval(secondPassed, 1000);
        firstclick = true
    }
});

// This sets up the timer that gives them 60 seconds ;
function secondPassed() {
    var minutes = Math.round((seconds - 60) / 60);
    var remainingSeconds = seconds % 60;
    if (remainingSeconds < 10) {
        remainingSeconds = "0" + remainingSeconds;
    }
    document.timer_form.secs.value = remainingSeconds;
    if (seconds == 0) {
        clearInterval(countdownTimer);
        for (var i = 1; i <= 16; i++) {
            $("#square" + i).css("pointer-events", "none");
        }
        output.innerHTML = 'Sorry, you ran out of time! Click the "Retry" button to try again or click the "Next" button to continue with the game.<br/><br/><input type="button" onclick="location.reload();" value="RETRY" /><input type="button" onclick="location.href="" value="NEXT" />'

    } else {
        seconds--;
    }
}

//countdownTimer = setInterval(secondPassed, 1000);