// JavaScript Document
var ans = new Array;
var done = new Array;
var yourAns = new Array;
var explainAnswer = new Array;
var ans1 = new Array;

var score = 0;

ans[1] = "b";
ans[2] = "a";


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";
	ans1[i] = 'W';
  }
  else{
    answerText=answerText+" \nCorrect! \n" +"\n"+explainAnswer[i]+"\n";
	ans1[i] = 'R';
    score++;
  }
}

answerText=answerText+"\n\nYour total score is : "+score+"\n";

//now score the user
answerText=answerText+"\nComment : ";
if(score<=0){
answerText=answerText+"Need to be more aware about energy conservation";
}
if(score>=1 && score <=1){
answerText=answerText+"Learn a bit more about energy conservation";
}
if(score>=2 && score <=2){
answerText=answerText+"Perfect";
}
if(score>2){
answerText=answerText+"Perfect!";
}

//alert(answerText);
if (score==2){
   var myArguments = new Object();
//   myArguments.param1 = document.all.myColor.value;
   window.showModalDialog("http://www.heyiamonline.com/pm/quiz/kp/malakaspice/allcorrect.htm", myArguments, "dialogWidth:640px; dialogHeight:480px; center:yes"); 

   }
 if (score==0){
   var myArguments = new Object();
//   myArguments.param1 = document.all.myColor.value;
   window.showModalDialog("http://www.heyiamonline.com/pm/quiz/kp/malakaspice/allwrong.htm", myArguments, "dialogWidth:640px; dialogHeight:480px; center:yes"); 

   }
if (score==1){
if(ans1[1]=='R'){
   var myArguments = new Object();
//   myArguments.param1 = document.all.myColor.value;
   window.showModalDialog("http://www.heyiamonline.com/pm/quiz/kp/malakaspice/1upcorrect.htm", myArguments, "dialogWidth:640px; dialogHeight:480px; center:yes"); 

   }  
   }
if (score==1){
if(ans1[1]=='W'){
   var myArguments = new Object();
//   myArguments.param1 = document.all.myColor.value;
   window.showModalDialog("http://www.heyiamonline.com/pm/quiz/kp/malakaspice/1dncorrect.htm", myArguments, "dialogWidth:640px; dialogHeight:480px; center:yes"); 

   }  
   }   
   
score = 0;  
}








//  End -->