function finish1() {

	var qnum = 2
	
	var q = [];
  	for (var i=1; i<qnum+1; i++) {
  		//console.log(i);
		q[i-1] = document.getElementById('q'+i).value;
	};

	var check1 = true;
	for (var i1=1; i1<qnum+1; i1++) {
		if (q[i1-1] == 'none') {
			check1 = false;
		}
	}

	console.log(check1);

	if (check1 == false) {
		alert("Answer all the questions!");
	} else {	 //IF CHECK == TRUE PROCEEDS TO EXAMINE THE ANSWERS
	    for (i2=1; i2<qnum+1; 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>"
	    		var feedback = document.getElementById(q[i2-1]); // SELECTS THE APPROPRIATE FEEDBACK ACORDING TO THE CHOSEN ANSWER
	      	feedback.style.display = 'block'
	      }
	      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 finish_1 = document.getElementById("finish_1");
    finish_1.parentNode.removeChild(finish_1);

    document.getElementById('div3').style.display = 'block';
    var finish_2 = document.getElementById("finish_2");
		finish_2.style.display = 'block';
  }

}

function finish2() {

	var qnum = 12;

	var warning;

	var check = false;
	for (var i=1; i<qnum+1; i++) {
		warning = document.getElementById('warning'+i).checked;
		if (warning == true) {
			check = true;
		}
	}

	console.log(check);

	if (check == false) {
		alert('Please select a warning level!');
	} else {
		var finish_2 = document.getElementById("finish_2");
    finish_2.parentNode.removeChild(finish_2);

		document.getElementById('answer3').style.display = 'block';
		document.getElementById('div4').style.display = 'block';
		document.getElementById('div5').style.display = 'block';
		var finish_3 = document.getElementById("finish_3");
		finish_3.style.display = 'block';
	}
	
}


function finish3() {

	var qnum = 2;

	var t_ans = [];
	var q = [];
	check3 = true;
  	for (var i1=4; i1<qnum+4; i1++) {
		t_ans[i1-4] = document.getElementById('text'+i1).value;
		q[i1-4] = document.getElementById('q'+i1);
		//console.log(t_ans[i-4])
		if (t_ans[i1-4] == 'Enter your answer!' || t_ans[i1-4] == '') {
			check3 = false;
		}
	};

	//console.log(check3);
	//console.log(q);

	if (check3 == false) {
		alert('Answer the questions!');
	} else {
		for (var i2=4; i2<qnum+4; i2++) {
			q[i2-4].innerHTML = '<p><strong>Your answer:</strong></p><p>'+t_ans[i2-4]+'</p>'

			document.getElementById('answer'+i2).style.display = 'block';
			document.getElementById('t'+i2).style.display = 'block';
		}

		var finish_3 = document.getElementById("finish_3");
		finish_3.innerHTML = '<a href="http://eumetrain.org/data/5/571/navmenu.php?tab=4&page=1.0.0" target="_blank">Go to summary</a><!-- or <a href="" onclick="window.location.reload(true)">Reset</a>-->';

		//document.getElementById('question_reset').style.display = 'block';
	}
	
}