// JavaScript Document
var ans = new Array;
var done = new Array;
var yourAns = new Array;
var explainAnswer = new Array;

var score = 0;

ans[1] = "a";
ans[2] = "a";


explainAnswer[1]="Yes, most people don't even realise but the taste of Mocha is derived from a coffee bean created in the port city of Mocha. Source: http://en.wikipedia.org/wiki/Mocha,_Yemen";
explainAnswer[2]="This famous bean has been discovered by Marco Polo in his arguous journey to China and back. After the first one and a half month in his turbulent journey they were forced to go on shore in order to resupply their stocks. Source: http://en.wikipedia.org/wiki/Mocha,_Yemen";


function Engine(question, answer) {
yourAns[question]=answer;
}

function Score(){
var answerText = "How did you do?\n------------------------------------\n";
for(i=1;i<=2;i++){
   answerText=answerText+"\nQuestion :"+i+"\n";
  if(ans[i]!=yourAns[i]){
    answerText=answerText+"\nThe correct answer was "+ans[i]+"\n"+explainAnswer[i]+"\n";
  }
  else{
    answerText=answerText+" \nCorrect! \n" +"\n"+explainAnswer[i]+"\n";
    score++;
  }
}

answerText=answerText+"\n\nYour total score is : "+score+"\n";

//now score the user
answerText=answerText+"\nComment : ";
if(score<=0){
answerText=answerText+"You need to learn more Mocha";
}
if(score>=1 && score <=1){
answerText=answerText+"Learn a bit more about Mocha";
}
if(score>=2 && score <=2){
answerText=answerText+"Perfect";
}
if(score>2){
answerText=answerText+"Perfect!";
}

alert(answerText);
score = 0;
}
//  End -->