//----------------------------------------------
function how_many_played()
  {
  total_played=0;
  for (j=0;j<prediction_number;j++)
    {
	if (fixtures[j][4] != "-")
	  {
	  total_played++;
	  }
	}
    return total_played;
  } 


function show_match(n)


  {


  


  if (n/6 == Math.round(n/6))


    {


	document.write("<tr><td colspan=5><h1>"+groups[n/6]+"</h1></td></tr>");


        document.write("<tr><td><h3>Date</h3></td><td colspan=2><h3>Teams</h3></td><td colspan=2><h3>Score</h3></td></tr>");


	}


  document.write("<tr>");


  for (i=0;i<5;i++)


    {


	document.write("<td>"+fixtures[n][i]+"</td>")


    }


  document.write("</tr>");


  }


//--------------------------------------------------  


function show_match_plus(n,cscore)


  {


  if (n/6 == Math.round(n/6))


    {


	document.write("<tr><td colspan=9><h1>"+groups[n/6]+"</h1></td></tr>");


    document.write("<tr><td><h3>Date</h3></td><td colspan=2><h3>Teams</h3></td><td colspan=2><h3>Actual Score</h3></td><td colspan=2><h3>Prediction</h3></td><td><h3>Points</h3></td><td><h3>TOTAL Points</h3></td></tr>");


	}


  document.write("<tr>");


  for (i=0;i<5;i++)


    {


	document.write("<td>"+fixtures[n][i]+"</td>")


    }


  points=0;


  if (predictions[2*n] == fixtures[n][3])


    {


	points=2;


	document.write("<td><b style='color:red'>"+predictions[2*n]+"</b></td>");


	}


  else


    {


    document.write("<td>"+predictions[2*n]+"</td>");


	}


  if (predictions[2*n+1] == fixtures[n][4])


    {


	points=points+2;


	document.write("<td><b style='color:red'>"+predictions[2*n+1]+"</b></td>");


	}


  else


    {


	document.write("<td>"+predictions[2*n+1]+"</td>");


	}


  if (points==4)


    {


	points=5;


	}


  cscore=cscore+points;


  


  


  document.write("<td>"+points+"</td>");


  document.write("<td>"+cscore+"</td>");


  document.write("</tr>");


  return cscore;


  }


//-----------------------------------------------------
function show_player(m)


  {


  player_link="<a href=entries/"+players[m][0]+".html>"+players[m][0]+"</a>";


  score_points = 0;


  match_bonus = 0;

//needs variable on next line
  for (j=0;j<48;j++)


    {


	if (players[m][(2*j)+1] == fixtures[j][3])


	  {score_points=score_points+2;


	   score_a=true;}


	else


	  {score_a=false;}


	if (players[m][2*(j+1)] == fixtures[j][4])


	  {score_points=score_points+2;


	   score_b=true;}


	else


	  {score_b=false;}


	if (score_a && score_b)


	  {


	  match_bonus++;}  


	}


  total_points=score_points+match_bonus;


  //document.write("<td>"+total_points+"</td></tr>");


  return [player_link,total_points];


  }


  //----
  function sort_it(rec1,rec2)
    {
    if(rec1[1]>rec2[1])
      {
	  return -1;
	  }
	else
	  {
	  return 1;
	  }
	}


