function finish_1() {

  var q = [];
  for (var i=1; i<7; i++) {
    q[i-1] = document.getElementById('q'+i).value;
  };

  //CHECKING IF ANYTHING IS SELECTED IN DROPLISTS//
  check = false;
  for (i1=1; i1<7; i1++) { //RUNS THROUGH THE CHECKED VALUES
    if (q[i1-1] == 'none') {
      alert("Answer all the questions!");
      return check; //RETURNS CHEC == FALSE IF ONE OF THE CHECKED VALUES IS NULL
    }
    else {
      check = true;
    };
  };
  //console.log(check)

  if (check) { //IF CHECK == TRUE PROCEEDS TO EXAMINE THE ANSWERS
    for (i2=1; i2<7; i2++) {
      //console.log(q[i2-1]);
      var answer = document.getElementById("answer"+i2);
      answer.style.display = 'block'
      //console.log(answer.value)
      if (q[i2-1] == 't'+i2) { //IF THE SELECTED VALUE IS A 't' ACCOMPANIED BY SOME NUMBER THAT MEANS THAT THE ANSWER IS CORRECT
        answer.innerHTML += "<p><b>You answered correctly!</b></p>"
      }
      else { //IF THE SELECTED VALUE IS ANYTHING ELSE THAN A 't' ACCOMPANIED BY SOME NUMBER THAT MEANS THAT THE ANSWER IS WRONG
        answer.innerHTML += "<p><b>Your answer is wrong.</b></p>"
      }
      var feedback = document.getElementById(q[i2-1]); // SELECTS THE APPROPRIATE FEEDBACK ACORDING TO THE CHOSEN ANSWER
      feedback.style.display = 'block'
    }
    var finish1 = document.getElementById("finish1");
    finish1.parentNode.removeChild(finish1);
  }


  /*if (//checking the droplists
    q[0] == "none" || q[1] == "none" || q[2] == "none" || q[3] == "none" || q[4] == "none" || q[5] == "none" || q[6] == "none")
    {
      alert("Answer all the questions!");
    }
  else {

  	var finish1 = document.getElementById("finish1");
		finish1.parentNode.removeChild(finish1);



    for (i = 1; i < 7; i++){
      var answer = document.getElementById("answer"+i);
      answer.style.display = "block"
    };
  };*/
}

function finish2() {
  
  var q = [];
  for (var i=7; i<11; i++) {
    q[i-1] = document.getElementById('q'+i).value;
  }

  //CHECKING IF ANYTHING IS CHECKED/SELECTED IN CHECKBOXES AND RADIO BUTTONS//
  check = false;
  for (i1=7; i1<11; i1++) { //RUNS THROUGH THE CHECKED VALUES
    if (q[i1-1] == 'none') {
      alert("Answer all the questions!");
      return check; //RETURNS CHEC == FALSE IF ONE OF THE CHECKED VALUES IS NULL
    }
    else {
      check = true;
    };
  };
  //console.log(check)

  if (check) { //IF CHECK == TRUE PROCEEDS TO EXAMINE THE ANSWERS
    for (i2=7; i2<11; i2++) { 
      //console.log(q[i2-1]);
      var answer = document.getElementById("answer"+i2);
      answer.style.display = 'block'
      //console.log(answer.value)
      if (q[i2-1] == 't'+i2) { //IF THE SELECTED VALUE IS A 't' ACCOMPANIED BY SOME NUMBER THAT MEANS THAT THE ANSWER IS CORRECT
        answer.innerHTML += "<p><b>You answered correctly!</b></p>"
      }
      else { //IF THE SELECTED VALUE IS ANYTHING ELSE THAN A 't' ACCOMPANIED BY SOME NUMBER THAT MEANS THAT THE ANSWER IS WRONG
        answer.innerHTML += "<p><b>Your answer is wrong.</b></p>"
      }
      var feedback = document.getElementById(q[i2-1]); // SELECTS THE APPROPRIATE FEEDBACK ACORDING TO THE CHOSEN ANSWER
      feedback.style.display = 'block'
    }
    var finish2 = document.getElementById("finish2");
    finish2.parentNode.removeChild(finish2);
  }


  /*if (//checking the droplists
    q[7] == "none" || q[8] == "none" || q[9] == "none" || q[10] == "none")
    {
      alert("Answer all the questions!");
    }
  else {
    var finish2 = document.getElementById("finish2");
    finish2.parentNode.removeChild(finish2);

    for (i = 7; i < 11; i++){
      var answer = document.getElementById("answer"+i);
      answer.style.display = "block"
    };
  };*/
}

function finish3() {

  var q;
  q = document.getElementById('q11').value;

  //CHECKING IF ANYTHING IS CHECKED/SELECTED IN CHECKBOXES AND RADIO BUTTONS//
  if (//checking the droplists
    q == "none")
    {
      alert("Give an answer to the pilot!");
    }
  else {
    var answer = document.getElementById("answer11");
    if (q == "t"){
      //var answer = document.getElementById("answer11");
      answer.innerHTML += "<p><b>You answered correctly!</b></p>"
    }
    else {
      //var answer = document.getElementById("answer11");
      answer.innerHTML += "<p><b>Your answer is wrong</b>.</p>"
    }

    answer.style.display = "block"
    var finish3 = document.getElementById("finish3");
    finish3.innerHTML = "<br>For a <b>summary</b> of this simulator click <a href='summary.html' target='_blank'>here</a>";
  };
}
