 var sURL = window.location.toString();
 var nPos = sURL.indexOf("?");

 if ( nPos > 0 ) {
  var nLen = sURL.length;
  var sParams = sURL.substr(nPos+1, nLen - nPos);

  var nPicked;
  var nNumberCorrect = 0;
  var sParamName;
  var nQuestionNumber = 0;
  var nNumberQuestions = 25;
  
  for (var i=0; i < nNumberQuestions; i++)
  {
   nQuestionNumber = i + 1;
   sParamName = "chose" + i;

   nPicked = GetParam(sParams, sParamName);
   document.write("<b>" + nQuestionNumber + ". " + sQuestions[i] + "</b><br><br>");
   
   if ( nPicked == aAnswer[i] ) {
    nNumberCorrect = nNumberCorrect + 1;
    document.write('<span style="color: blue">You answered this question correctly.</span><br><br><br>');
   }
   else if ( nPicked > -1 ) {
     document.write('<span style="color: red">You answered this question incorrectly.</span><br><br>');
     document.write('<b>The correct answer is...</b><br>');
     document.write(aAnswerText[i] + '<br><br><br>');
   }
   else {
    document.write('<em>You did not answer this question.</em><br><br><br>');
   }
  }
  
  var nPointsEach  = 100 / nNumberQuestions;
  var nTotalPoints = Math.round(nNumberCorrect * nPointsEach);
  if ( nTotalPoints > 100 ) {
   nTotalPoints = 100;
  }
  
  var nRank = Math.round(nTotalPoints / 25);
  document.write('RANK VALUE IS ' + nRank + '<br>');

  if ( nNumberCorrect == nNumberQuestions ) {
   document.write("Congratulations! You got all of them right!");
  }
  else {
   document.write("You answered " + nNumberCorrect + " questions correctly out of " + nNumberQuestions + " total.");  
  } 
  
  document.write('<h3>Your Score: <span style="color: blue; font-weight: bold">' + nTotalPoints + '</span><br>');
  document.write('Your Rank: <span style="color: blue; font-weight: bold">' + aRank[nRank] + '</span></h3>');
 }

