// Remember that Javascript numbers arrays starting at zero
// so Question #1 refers to answer[0], key[0], and explanation[0], 
// Question #2 refers to answer[1], key[1], and explanations[1] ...

// Array to hold the user answers
answer = new Array(5);

// Array to hold the correct answers
key = new Array(5);

// Array to hold explanation of each answer
explanation = new Array(5);

// Function to set up the key and initialize the user answers to none
function InitializeAnswers(){
// This loop resets all user answers to "none."
for (i=0;i < 5;i++){
answer[i]="rien";
}

// Add your answer key below
answer[0]="b";
key[1]="b";
key[2]="c";
key[3]="d";
key[4]="a";

// Add your explanations to each question below
explanation[0]="Effectivement c'est bien &lt;html&gt; et &lt;/html&gt; les balises ouvrantes et fermantes d'un document html";
explanation[1]="Après les verbes de sentiments on utilise les articles définis.";
explanation[2]="La négations des articles partitifs est toujours ne pas de/d'.";
explanation[3]="Après les expressions de quantité on utilise de ou d'.";
explanation[4]="Question stupide réponse stupide.";
}

// Function to compare the key to the user answers and caluclate the score
function GradeQuiz(){

score = 0;

NewWindow = window.open("","Results","scrollbars=yes resizable=yes");
NewWindow.document.write("<html><head><title>R&eacute;sultat</title></head><body bgcolor=white>");
NewWindow.document.write("<h3>CORRECTION</h3>");

for (i=0;i<5;i++){

NewWindow.document.write("<b>Question # " + String(i+1)+"</b>" + "<br>");
NewWindow.document.write("Vous avez r&eacute;pondu -"+answer[i]+"-.<br>");
NewWindow.document.write("<font color='#0022aa'>La r&eacute;ponse correcte est -<b>"+key[i]+"</b>-.</font><br>");
if(key[i]==answer[i]){
score = score + 1;
}
NewWindow.document.write(explanation[i]);
NewWindow.document.write("<br><br>");
}
NewWindow.document.write("<h3>Votre score est "+String((score/5)*100)+"%.</h3>"); 
NewWindow.document.write("</body></html>");
NewWindow.document.close();

}
