	window.onload = init;
	document.getElementById('btn1').onclick = answer;
	document.getElementById('btn2').onclick = valider;
	document.getElementById('btnclr1').onclick = clear1;

	var btnReponses = document.getElementById('btn1');
	var btnValider = document.getElementById('btn2');
	var btnClr = document.getElementById('btnclr1');
	var sc = 1;

function init() {
	btnReponses.disabled=true;
	btnReponses.setAttribute('style', "color:#D4D0C8");
	sc = 1;
	var audio1 = document.getElementById('a1');
	audio1.style.display = 'block';
	audio1.pause();
	audio1.currentTime = 0;
}



function answer() {
	if (sc == 1) {
		var que1 = document.getElementById('que1');
				que1.setAttribute('style', 'display:none')
		var ans1 = document.getElementById('ans1');
				ans1.removeAttribute('style')
		btnValider.disabled=true;
		btnValider.setAttribute('style', "color:#D4D0C8");
		sc += 1;
	} else {
		var que1 = document.getElementById('que1');
				que1.removeAttribute('style')
		var ans1 = document.getElementById('ans1');
				ans1.setAttribute('style', 'display:none')
		btnValider.disabled=false;
		btnValider.setAttribute('style', "color:#000000");
		sc -= 1;
	}
}
function valider() {
	var mySelect = document.getElementById("crossword").getElementsByClassName("no2");
	var wrong = 0; 
	var right = 0; 
	var optionCount = 0; 
	for(var i=1; i<=mySelect.length; i++) {
		var correctVal = document.getElementById("mySelect1_"+i);
		if(correctVal.value=="0") {
			wrong++;
		} else if (correctVal.value=="true") {
			optionCount++;
			right++;
		} else {
			optionCount++;
			wrong++;
		}
	}
	for(var i=1; i<=mySelect.length; i++) {
		var correctVal = document.getElementById("mySelect1_"+i);
		if(correctVal.value=="0") {
			correctVal.setAttribute("style","background-color:red; color:#FFFFFF;border:1px solid #EA9800;");
		} else if (correctVal.value=="true") {
			correctVal.setAttribute("style","background-color:#008000; color:#FFFFFF;border:1px solid #EA9800;");
		} else {
			correctVal.setAttribute("style","background-color:red; color:#FFFFFF;border:1px solid #EA9800;");
		}
	}
	btnReponses.disabled=false;
	btnReponses.setAttribute('style', "color:#000000");
}

function clear1(){
	var mySelect = document.getElementById("crossword").getElementsByClassName("no2");
	for(var i=1; i<=mySelect.length; i++) {
		var selOption = document.getElementById("mySelect1_"+i);
			selOption.removeAttribute("style");
			selOption.value = '0';
	}
	sc = 1;
	btnValider.disabled=false;
	btnValider.setAttribute('style', "color:#000000");
	document.getElementById("que1").style.display = 'block';
	document.getElementById("ans1").style.display = 'none';
	btnReponses.disabled=true;
	btnReponses.setAttribute('style', "color:#D4D0C8");
}
