	window.onload = init;
	document.getElementById('btnclr1').onclick = newBoard;
	document.getElementById('btn1').onclick = result;
	document.getElementById('btn2').onclick = check; //Valider

var counter=1;
function init() {
	document.getElementById("screen1").style.display = 'block';
	var audioElement1 = document.getElementById('a1');
	audioElement1.pause();
		audioElement1.currentTime = 0;
	var bt1 = document.getElementById('btn1');
	bt1.disabled=true;
	bt1.setAttribute('style', "color:#D4D0C8");
	var bt2 = document.getElementById('btn2');
	bt2.disabled=true;
	bt2.setAttribute('style', "color:#D4D0C8");
	var bt3 = document.getElementById('btnclr1');
	bt3.disabled=true;
	bt3.setAttribute('style', "color:#D4D0C8");

}

var right = 0;
var wrong = 0;
var checkCount = 0;

var sc = 1;
function result() {
	if (sc == 1) {
	var clearAns1 = document.getElementById('Vrai');
	clearAns1.setAttribute('style', 'color:#000000;border:3px solid #FAF7EA; padding: .5em;');
	var clearAns1 = document.getElementById('Faux');
	clearAns1.setAttribute('style', 'color:#000000;border:3px solid #FAF7EA; padding: .5em;');
	var ansbotton1 = document.getElementById("cb1");
	ansbotton1.removeAttribute('checked');
	ansbotton1.checked=false;
	ansbotton1.disabled=true;
	var ansbotton2 = document.getElementById("cb2");
	ansbotton2.removeAttribute('checked');
	ansbotton2.checked=false;
	ansbotton2.disabled=true;
	var Ans1 = document.getElementById('Vrai');
	var Ans2 = document.getElementById('Faux');
if (counter==1) {
	Ans1.setAttribute('style', 'color:green;border:3px solid green; padding: .5em;border-radius: 10px;');
	ansbotton2.setAttribute('checked', true);
	ansbotton2.checked=true;
} else if (counter==2) {
	Ans2.setAttribute('style', 'color:green;border:3px solid green; padding: .5em;border-radius: 10px;');
	ansbotton1.setAttribute('checked', true);
	ansbotton1.checked=true;
} else if (counter==3) {
	Ans1.setAttribute('style', 'color:green;border:3px solid green; padding: .5em;border-radius: 10px;');
	ansbotton2.setAttribute('checked', true);
	ansbotton2.checked=true;
} else if (counter==4) {
	Ans2.setAttribute('style', 'color:green;border:3px solid green; padding: .5em;border-radius: 10px;');
	ansbotton1.setAttribute('checked', true);
	ansbotton1.checked=true;
}

	var screenElement5 = document.getElementById('btnclr1');
	screenElement5.disabled=true;
	screenElement5.setAttribute('style', "color:#D4D0C8");
	var bt2 = document.getElementById('btn2');
	bt2.disabled=true;
	bt2.setAttribute('style', "color:#D4D0C8");
	sc += 1
	} else {
	var clearAns1 = document.getElementById('Vrai');
	clearAns1.setAttribute('style', 'color:#000000;border:3px solid #FAF7EA; padding: .5em;');
	var clearAns1 = document.getElementById('Faux');
	clearAns1.setAttribute('style', 'color:#000000;border:3px solid #FAF7EA; padding: .5em;');
	var ansbotton1 = document.getElementById("cb1");
	ansbotton1.removeAttribute('checked');
	ansbotton1.checked=false;
	ansbotton1.disabled=false;
	var ansbotton2 = document.getElementById("cb2");
	ansbotton2.removeAttribute('checked');
	ansbotton2.checked=false;
	ansbotton2.disabled=false;
	var Ans1 = document.getElementById('Vrai');
	var Ans2 = document.getElementById('Faux');
	var screenElement6 = document.getElementById('btnclr1');
	screenElement6.setAttribute('value', 'Suivant');
	screenElement6.setAttribute('style', 'background-image:url("images/rarrow.png");background-repeat: no-repeat;background-position: left;');
	var bt1 = document.getElementById('btn1');
	bt1.disabled=false;
	bt1.setAttribute('style', "color:#000000");
	var bt2 = document.getElementById('btn2');
	bt2.disabled=false;
	bt2.setAttribute('style', "color:#000000");
	var bt3 = document.getElementById('btnclr1');
	bt3.disabled=false;
	bt3.setAttribute('style', "color:#000000");
	var set_ans=document.getElementById("checkbox_ans");
	set_ans.innerText='';
	sc -= 1
	}


}



function check() {
	var correctAns = document.getElementById("ans"+counter).innerHTML;
	var getAnswer = document.getElementById("checkbox_ans").innerHTML;
	if (getAnswer=="") {
		var clearAns1 = document.getElementById('Faux');
		clearAns1.setAttribute('style', 'color:red;border:3px solid red; padding: .5em;border-radius: 10px;');
		var clearAns2 = document.getElementById('Vrai');
		clearAns2.setAttribute('style', 'color:red;border:3px solid red; padding: .5em;border-radius: 10px;');
	} else {
		if (getAnswer == correctAns) {
			var aa = document.getElementById(getAnswer);
			aa.setAttribute('style', 'color:green;border:3px solid green; padding: .5em;border-radius: 10px;');
		} else {
			var aa = document.getElementById(getAnswer);
			aa.setAttribute('style', 'color:red;border:3px solid red; padding: .5em;border-radius: 10px;');
		}
	}

	var bt3 = document.getElementById('btnclr1');
	bt3.disabled=false;
	bt3.setAttribute('style', "color:#000000");

	var bt1 = document.getElementById('btn1');
	bt1.disabled=false;
	bt1.setAttribute('style', "color:#000000");

}





function newBoard() {
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';
		audioElement1 = document.getElementById('a'+i);
		audioElement1.pause();
		audioElement1.currentTime = 0;
		var clearAns1 = document.getElementById('Faux');
		clearAns1.setAttribute('style', 'color:black;border:3px solid #FAF7EA; padding: .5em');
		var clearAns2 = document.getElementById('Vrai');
		clearAns2.setAttribute('style', 'color:black;border:3px solid #FAF7EA; padding: .5em');
		var clearAns3 = document.getElementById('checkbox_ans');
		clearAns3.innerHTML='';
		var cb1 = document.getElementById("cb1");
		cb1.checked=false
		var cb2 = document.getElementById("cb2");
		cb2.checked=false
	}

	var screenElement2 = document.getElementById('screen'+counter).style.display = 'block';
	var audioElement2 = document.getElementById('a'+counter);
	console.log(audioElement2);
	audioElement2.pause();
	audioElement2.currentTime = 0;

	var screenElement6 = document.getElementById('btnclr1');
	screenElement6.setAttribute('value', 'Suivant');
	screenElement6.setAttribute('style', 'background-image:url("images/rarrow.png");background-repeat: no-repeat;background-position: left;');


	var bt1 = document.getElementById('btn1');
	bt1.disabled=true;
	bt1.setAttribute('style', "color:#D4D0C8");
	var bt2 = document.getElementById('btn2');
	bt2.disabled=true;
	bt2.setAttribute('style', "color:#D4D0C8");
	var bt3 = document.getElementById('btnclr1');
	bt3.disabled=true;
	bt3.setAttribute('style', "color:#D4D0C8");
}








function checkbox1() {
	var cb1 = document.getElementById("cb1");
	cb1.setAttribute('checked', true);
	var set_ans=document.getElementById("checkbox_ans");
	set_ans.innerText='Faux';
	var cb2 = document.getElementById("cb2");
	cb2.removeAttribute('checked');
	cb2.checked=false
	var clearAns1 = document.getElementById('Faux');
	clearAns1.setAttribute('style', 'color:black;border:3px solid #FAF7EA; padding: .5em');
	var clearAns2 = document.getElementById('Vrai');
	clearAns2.setAttribute('style', 'color:black;border:3px solid #FAF7EA; padding: .5em');
	var bt2 = document.getElementById('btn2');
	bt2.disabled=false;
	bt2.setAttribute('style', "color:#000000");
}
function checkbox2() {
	var cb1 = document.getElementById("cb2");
	cb1.setAttribute('checked', true);
	var set_ans=document.getElementById("checkbox_ans");
	set_ans.innerText='Vrai';
	var cb2 = document.getElementById("cb1");
	cb2.removeAttribute('checked');
	cb2.checked=false
	var clearAns1 = document.getElementById('Faux');
	clearAns1.setAttribute('style', 'color:black;border:3px solid #FAF7EA; padding: .5em');
	var clearAns2 = document.getElementById('Vrai');
	clearAns2.setAttribute('style', 'color:black;border:3px solid #FAF7EA; padding: .5em');
	var bt2 = document.getElementById('btn2');
	bt2.disabled=false;
	bt2.setAttribute('style', "color:#000000");
}
