// JavaScript Document
var ans = new Array;
var done = new Array;
var yourAns = new Array;
var explainAnswer = new Array;

var score = 0;

ans[1] = "b";
ans[2] = "b";


explainAnswer[1]=
"Some environmental groups argue that one fifth of the world's tropical rainforest was destroyed between 1960 and 1990, that rainforests 50 years ago covered 14% of the world's land surface and have been reduced to 6%,[53] and that all tropical forests will be gone by the year 2090. Source: http://en.wikipedia.org/wiki/Deforestation";
explainAnswer[2]="The benefits of recycling are more than just having less litter on the highways or less trash in the landfills. Recycling can produce major savings in energy, minimize pollution, save trees and help protect the environment. Source: greenliving.lovetoknow.com";


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 about deforestation/recycling";
}
if(score>=1 && score <=1){
answerText=answerText+"Learn a bit more about benefits of recycling/deforestation";
}
if(score>=2 && score <=2){
answerText=answerText+"Perfect";
}
if(score>2){
answerText=answerText+"Perfect!";
}

alert(answerText);
score = 0;
}
//  End -->