var choices=new Array();
var ashleyPoints=0;
var erikPoints=0;
var danPoints=0;
var jacobPoints=0;
var trevorPoints=0;
var i;
var max=0;
var compatibility="";

function grade()
{
  for(i = 0; i < 10; i++)
  {
    if(choices[i] == 'ashley')
      ashleyPoints++;
    else if(choices[i] == 'erik')
      erikPoints++;
    else if(choices[i] == 'jacob')
      jacobPoints++;
    else if(choices[i] == 'dan')
      danPoints++;
    else if(choices[i] == 'trevor')
      trevorPoints++;
    else if(choices[i] == 'tuft')
    {
	  trevorPoints++;
      jacobPoints++;
      erikPoints++;
    }
    else if(choices[i] == 'blue')
    {
      ashleyPoints++
      danPoints++;
    }
  }
//----------------------------------------
  if(ashleyPoints > max)
    max = ashleyPoints;
  if(erikPoints > max)
    max = erikPoints;
  if(jacobPoints > max)
    max = jacobPoints;
  if(danPoints > max)
    max = danPoints;
  if(trevorPoints > max)
    max = trevorPoints;
//-----------------------------------------
  if(ashleyPoints == max)
    compatibility += "or Ashley ";
  if(erikPoints == max)
    compatibility += "or Erik ";
  if(jacobPoints == max)
    compatibility += "or Jacob ";
  if(danPoints == max)
    compatibility += "or Dan ";
  if(trevorPoints == max)
    compatibility += "or Trevor ";
//-----------------------------------------
  var comp = "";
  for(i = 0; i < compatibility.length; i++)
    comp += compatibility.charAt(i);
//-----------------------------------------
  compatibility = "";
//-----------------------------------------
  var len = comp.length;
  for(i = 3; i < len; i++)
    compatibility += comp.charAt(i);

  alert("You would match up best with " + compatibility);
  window.location="matchanswers.html";
}
