	window.onload = init;
	document.getElementById("btnclr1").onclick = newBoard;
	document.getElementById("btn1").onclick = result;
	document.getElementById("btn2").onclick = checkans;
	var btnClr= document.getElementById("btnclr1");
	var btnValider = document.getElementById("btn2");
	var btnReponses = document.getElementById("btn1");
	var sc = 1;
var counter=1;
function init() {
	document.getElementById("screen1").style.display = 'block';
	btnClr.disabled=true;
	btnClr.setAttribute('style', "color:#D4D0C8");
	btnValider.disabled=true;
	btnValider.setAttribute('style', "color:#D4D0C8");
	btnReponses.disabled=true;
	btnReponses.setAttribute('style', "color:#D4D0C8");
}
function showValider() {
	btnValider.disabled=false;
	btnValider.setAttribute('style', "color:#000000");
}

function newBoard() {
	sc = 1;
	if (counter < 4) {
		counter+=1;
	} else {
		counter = 1;
	}
	var screenElement = document.getElementsByClassName('screen');
	for(var i=1; i < screenElement.length+1; i++) {
		var screenElement1 = document.getElementById("screen"+i).style.display ='none';
		var textBox = document.getElementById("fill_"+i);
				textBox.setAttribute('style','text-transform:uppercase;')
				textBox.value = '';
	}
	var screenElement2 = document.getElementById("screen"+counter).style.display = 'block';
	btnClr.disabled=true;
	btnClr.setAttribute('style', "color:#D4D0C8");
	btnValider.disabled=true;
	btnValider.setAttribute('style', "color:#D4D0C8");
	btnReponses.disabled=true;
	btnReponses.setAttribute('style', "color:#D4D0C8");
}

function checkans() {
	sc = 1;
	var correctVal = document.getElementById("fill_"+counter);
	var matchVal = document.getElementById("ansspan_"+counter);
			getVal = String(correctVal.value.toUpperCase())
			if (getVal == 'VELO') {
				getVal = 'VÉLO'
			}
	if (getVal == matchVal.innerHTML.toUpperCase()) {
			correctVal.setAttribute('style', 'font-weight:bold;color:#FFFFFF;background-color:#008000;text-transform:uppercase;')
		} else {
			correctVal.setAttribute('style', 'font-weight:bold;color:#FFFFFF;background-color:#FF0000;text-transform:uppercase;')
		}
	btnClr.disabled=false;
	btnClr.setAttribute('style', "color:#000000");
	btnReponses.disabled=false;
	btnReponses.setAttribute('style', "color:#000000");
}

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