// Variables
var tries = 0;

// Functions
function updateButtons(){
    if(tries>=7)    {$("#btnNext").attr("disabled", true);}
    else            {$("#btnNext").attr("disabled", false);}

    if(tries<=0)    {$("#btnBack").attr("disabled", true);}
    else            {$("#btnBack").attr("disabled", false);}
}

// Starting stuff
updateButtons();

// Events
$("#btnBack").on("click", function(e){
    e.preventDefault();
    if(tries>0) {tries--;}
    updateScreen();
    updateButtons();
});
$("#btnNext").on("click", function(e){
    e.preventDefault();
    if(tries<7) {tries++;}
    updateScreen();
    updateButtons();
});