// JavaScript Document


var aKey = new Array(3);
aKey[0]="c";
aKey[1]="b";
aKey[2]="a";
aKey[3]="b";
aKey[4]="d";
aKey[5]="d";
aKey[6]="a";
aKey[7]="a";
aKey[8]="d";
aKey[9]="b";
aKey[10]="a";
aKey[11]="d";



var sAns = new Array(12);
sAns[0]="";
sAns[1]="";
sAns[2]="";
sAns[3]="";
sAns[4]="";
sAns[5]="";
sAns[6]="";
sAns[7]="";
sAns[8]="";
sAns[9]="";
sAns[10]="";
sAns[11]="";



function studentAns(qNum, choice){
sAns[qNum - 1]= choice;
}



function getScore(){

var NumQues = 12;
score = 0;
var NoofCorrectAnswers=0;
for (i = 1; i <= NumQues ; i++){
   if (aKey[i-1] == sAns[i-1]){
    score++;
	NoofCorrectAnswers++;
	}
}
//alert(sAns[11])

score = Math.round(score/NumQues*100);
//document.quiz.percentage.value = score + "%";
document.getElementById("percentage").innerHTML = "Your score is <b>" + score + "</b>%";
var correctAnswers = "";
for (i=1; i <= NumQues; i++) {
correctAnswers += i + ". " + aKey[i-1] + "\r\n";
}

//document.quiz.solutions.value = correctAnswers;




if (NoofCorrectAnswers>0 && NoofCorrectAnswers < 4){
	document.getElementById("result").innerHTML = "<b>You are in great danger of contracting the disease! There is no other time but now to know more about cold sores and how to avoid them. Better be safe than sorry!</b>";
}
else if (NoofCorrectAnswers>=4 && NoofCorrectAnswers < 8){
	document.getElementById("result").innerHTML= "<b>You might just be in danger. You are familiar with cold sores but you are not armed with the right information to avoid contracting the infection. Read more, kiddo!</b>";
}
else if (NoofCorrectAnswers>=8 && NoofCorrectAnswers < 10){
	document.getElementById("result").innerHTML = "<b>You know just enough. You have what it takes to get by, but it would not hurt to know more about it.</b>";
}
else if (NoofCorrectAnswers>=10 && NoofCorrectAnswers < 13){
	document.getElementById("result").innerHTML= "<b>Cold Sore Expert! You know almost everything you need to know about cold sores. You will do fairly well in this cold sore laden world!</b>";
}



}
