var fixtures = new Array();
var fixtures = [
["Sat 12th June","Portugal","Greece","1","2"],
["Sat 12th June","Spain","Russia","1","0"],
["Wed 16th June","Greece","Spain","1","1"],
["Wed 16th June","Russia","Portugal","0","2"],
["Sun 20th June","Spain","Portugal","-","-"],
["Sun 20th June","Russia","Greece","-","-"],
//
["Sun 13th June","Switzerland","Croatia","0","0"],
["Sun 13th June","France","England","2","1"],
["Thu 17th June","England","Switzerland","3","0"],
["Thu 17th June","Croatia","France","2","2"],
["Mon 21st June","Croatia","England","-","-"],
["Mon 21st June","Switzerland","France","-","-"],
//
["Mon 14th June","Denmark","Italy","0","0"],
["Mon 14th June","Sweden","Bulgaria","5","0"],
["Fri 18th June","Bulgaria","Denmark","0","2"],
["Fri 18th June","Italy","Sweden","1","1"],
["Tue 22nd June","Italy","Bulgaria","-","-"],
["Tue 22nd June","Denmark","Sweden","-","-"],
//
["Tue 15th June","Czech Republic","Latvia","2","1"],
["Tue 15th June","Germany","Holland","1","1"],
["Sat 19th June","Latvia","Germany","0","0"],
["Sat 19th June","Holland","Czech Republic","2","3"],
["Wed 23rd June","Holland","Latvia","-","-"],
["Wed 23rd June","Germany","Czech Republic","-","-"]
];
var groups = ["Group A","Group B","Group C","Group D"];





//----------------------------------------------
function how_many_played()
{
total_played=0;
for (j=0;j<24;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="+players[m][49]+".html>"+players[m][0]+"</a>";
  score_points = 0;
  match_bonus = 0;
  for (j=0;j<24;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];
  }
  //----
