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

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

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

function viewValider() {
	sc = 1;
	btnValider.disabled=false;
	btnValider.setAttribute('style', "color:#000000");
}

function checkAns1() {
	sc = 1;
	var fillSelect = document.getElementById("crossword").getElementsByClassName("no");
	for(var i=1; i<=fillSelect.length; i++) {
		var correctVal = document.getElementById("fill1_"+i);
		var matchVal = document.getElementById("fill_ans1_"+i);
		if (correctVal.value.toUpperCase()==matchVal.innerHTML) {
			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(){
	location.reload();
}

function answer() {
	var answer = document.getElementsByClassName("no1");
	if (sc=="1") {
		for(var i=1; i<=answer.length; i++) {
		var getVal = document.getElementById("fill1_"+i);
		var corVal = document.getElementById("ans_"+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("ans_"+i);
			corVal.setAttribute('hidden', 'hidden');
			getVal.removeAttribute('hidden');
		}
		sc -= 1
	}
}
