var totalquestions=20

var correctchoices=new Array()
correctchoices[1]='b' 
correctchoices[2]='c' 
correctchoices[3]='a'
correctchoices[4]='a'
correctchoices[5]='a'
correctchoices[6]='b'
correctchoices[7]='b'
correctchoices[8]='c'
correctchoices[9]='b'
correctchoices[10]='a'
correctchoices[11]='a' 
correctchoices[12]='b' 
correctchoices[13]='c'
correctchoices[14]='c'
correctchoices[15]='c'
correctchoices[16]='a'
correctchoices[17]='a'
correctchoices[18]='b'
correctchoices[19]='a'
correctchoices[20]='a'

function gradeit(){

var incorrect=null
var correct=null

for (q=1;q<=totalquestions;q++){
	
	var thequestion=eval("document.myquiz.question"+q)
	

	for (c=0;c<thequestion.length;c++){
		if (thequestion[c].checked==true){
			actualchoices[q]=thequestion[c].value
		}
		
	}
		
	if (actualchoices[q] != null){
		if (actualchoices[q]!=correctchoices[q]){ 
			if (incorrect==null)
			incorrect=q
			else
			incorrect+="/"+q
		}
		else {

			if (correct==null)
			correct=q
			else
			correct+="/"+q
		}
		
	}
}
if (incorrect==null)
incorrect="a/b"
if (correct==null)
correct="a/b"

document.cookie='q='+incorrect
document.cookie='r='+correct

if (document.cookie=='')
alert("Your browser does not accept cookies. Please adjust your browser settings.")
else
window.location="results_01.asp"
}


function showsolution(){
var win2=window.open("","win2","width=200,height=350, scrollbars")
win2.focus()
win2.document.open()
win2.document.write('<title>Solutions</title>')
win2.document.write('<body bgcolor="#FFFFFF">')
win2.document.write('<center><h3>Solutions épreuve I.</h3></center>')
win2.document.write('<center><font face="Arial">')
for (i=1;i<=totalquestions;i++){
for (temp=0;temp<incorrect.length;temp++){
if (i==incorrect[temp])
wrong=1
}
if (wrong==1){
win2.document.write("Question "+i+"="+correctchoices[i].fontcolor("red")+"<br>")
wrong=0
}
else
win2.document.write("Question "+i+"="+correctchoices[i]+"<br>")
}
win2.document.write('</center></font>')
win2.document.write("<h5>Note: Les solutions en rouge sont les questions auquelles vous avez incorrectemnt répondu.</h5>")
win2.document.close()
}
