function Scorer(){
 this.countScore = countScore;
 this.getAnsw = getAnsw;
}

function countScore(d,t){
 var f = d.getElementById("form"); 
 var score = 0;
 for(var i = 1; i < t.i.length; i++)//length is 21 because starts at 1
  if(this.getAnsw(d,"a" + i) == t.i[i].s)
  score++;
 return score;
}

function getAnsw(d,radioGroup){
 var f = d.getElementById("form");
 var n = f[radioGroup].length;
 for(var i = 0; i < n; i++)
  if(f[radioGroup][i].checked)
   return i;
  //if none checked
  return -1;
}
