var soccerObj = new Object;
soccerObj=eval("(" + resultText + ")");
window.onload = topScore_make;

function topScore_make(){
	
	var gameInfo=new Array();
	gameInfo = soccerObj.Soccer.GameInfo;
	var phase=gameInfo[0].Phase;
	var gameDate=gameInfo[0].GameDate;;
	
//	var toDay= new Date();
//	var toDate=toDay.getDate();
//	var toMonth=toDay.getMonth();

	var topScore = new String();
	topScore += '<table border="1" summary="日程＆結果">';
	topScore += '<tr>';
	topScore += '<th colspan="3" class="bg">対戦</th>';
	topScore += '<th>場所</th>';
	topScore += '<th>開始</th>';
	topScore += '</tr>';
	
	var gcount=0;
	
	for(var i=0;i < gameInfo.length;i++){
	
//		var checkDate=gameInfo[i].GameDate;
//		var gameday = parseInt(checkDate.substr(6,2));
//		if(toDate != gameday){
//			continue;
//		}
		
		gcount++;
		
		var homeObj=new Object();
		var awayObj=new Object();
		
		homeObj = gameInfo[i].HomeInfo;
		awayObj = gameInfo[i].AwayInfo;
		
		topScore += '<tr>';
		topScore += '<td class="teamL line">' + homeObj.TeamName + '（' + homeObj.Block + '）</td>';
		topScore += '<td class="score">' + homeObj.Score + '－' + awayObj.Score;
		if(homeObj.PK){
		 	topScore += '<br />' + homeObj.PK + '（PK）' + awayObj.PK;
		}
		topScore += '</td>';
		topScore += '<td class="teamR">' + awayObj.TeamName + '（' + awayObj.Block + '）</td>';
		topScore += '<td class="">' + gameInfo[i].StadiumShort + '</td>';
		topScore += '<td>' + gameInfo[i].GameTime + '</td>';
		topScore += '</tr>';
	}
	
	topScore += '</table>';
	
	var title = '<div class="tableTitle tableTitleP">';
	title += '<h5>' + parseInt(gameDate.substr(4,2)) + '月' + parseInt(gameDate.substr(6,2)) + '日 ' + phase + '</h5>';
	title += '</div>';
	
	if(gcount > 0){
		document.getElementById("gameScore").innerHTML=title + topScore;
	}
	
};
