
window.onload = init;
	document.getElementById('btn1').onclick = answer;
	document.getElementById('btnclr1').onclick = clear1;
	document.getElementById('btn2').onclick = checkAns1;
	var btnClr = document.getElementById('btnclr1');
	var btnValider=document.getElementById('btn2');
	var btnReponses=document.getElementById('btn1');

function init() {
	btnValider.disabled=true;
	btnValider.setAttribute('style', "color:#D4D0C8");
	btnReponses.disabled=true;
	btnReponses.setAttribute('style', "color:#D4D0C8");
}
var sc = 1;

function checkAns1() {
	var fillSelect = document.getElementsByClassName("no");
	sc = 1;
	for(var i=1; i<=fillSelect.length; i++) {
		var fillVal = document.getElementById("fill1_"+i);
				var getVal = fillVal.value.toLowerCase();
		var matchVal = document.getElementById("fill_ans1_"+i);
		if (getVal=='lea') {
			getVal = 'léa';
		} else if (getVal=='3') {
			getVal = 'trois';
		} else if (getVal=='1') {
			getVal = 'un';
		}
		if (getVal == matchVal.innerHTML.toLowerCase()) {
			fillVal.setAttribute('style',"color: #FFFFFF;background-color:#008000;")
		} else {
			fillVal.setAttribute('style',"color: #FFFFFF;background-color:#FF0000;")
		}
	}
	btnReponses.disabled=false;
	btnReponses.setAttribute('style', "color:#000000");
}

function clear1(){
location.reload()
}

function answer() {
	var answer = document.getElementsByClassName("no");
	if (sc=="1") {
		for(var i=1; i<=answer.length; i++) {
		var getVal = document.getElementById("fill1_"+i);
		var corVal = document.getElementById("e_"+i);
			getVal.setAttribute('hidden', 'hidden');
			corVal.removeAttribute('hidden');
		}
		sc += 1
	 } else {
		for(var i=1; i<=answer.length; i++) {
		var getVal = document.getElementById("fill1_"+i);
		var corVal = document.getElementById("e_"+i);
			corVal.setAttribute('hidden', 'hidden');
			getVal.removeAttribute('hidden');
		}
		sc -= 1
	}
}
function viewValider() {
	btnValider.disabled=false;
	btnValider.setAttribute('style', "color:#000000");
}