
window.onload = boxScore_make;

function boxScore_make(){

	var soccerObj = new Object;
	
	soccerObj=eval("(" + resultText + ")");

	var gameInfo=new Array();
	gameInfo = soccerObj.Soccer.GameInfo;
	var scoreBox = new String();


	for(var i=0;i < gameInfo.length;i++){
	
		var phase=gameInfo[i].Phase;
		var gameDate=gameInfo[i].GameDate;
		var homeObj=new Object();
		var awayObj=new Object();
		
		homeObj = gameInfo[i].HomeInfo;
		awayObj = gameInfo[i].AwayInfo;
			
		scoreBox += '<div class="scoreTwrap">';
		scoreBox += '<table border="0" class="scoreTable" summary="スコア速報">';
		scoreBox += '<tr>';
		scoreBox += '<td colspan="2" class="data">' + parseInt(gameDate.substr(4,2)) + '月' + parseInt(gameDate.substr(6,2)) + '日 ' 
+ phase + '　' + gameInfo[i].GameTime + '</td>';
		scoreBox += '<td class="start">' + gameInfo[i].Half + '</td>';
		scoreBox += '<td colspan="2" class="place">' + gameInfo[i].StadiumShort + '</td>';
		scoreBox += '</tr>';
		scoreBox += '<tr>';
		scoreBox += '<td class="team">' + homeObj.TeamName + '（' + homeObj.Block + '）</td>';
		scoreBox += '<td class="point">' + homeObj.Score + '</td>';
		scoreBox += '<td class="time">' + homeObj.Score1 + '－' + awayObj.Score1 + '<br />';
		scoreBox += homeObj.Score2 + '－' + awayObj.Score2;
		if(homeObj.Extra1 != ''){
			scoreBox += '<br />' + homeObj.Extra1 + '－' + awayObj.Extra1;
		}
		if(homeObj.Extra2 != ''){
			scoreBox += '<br />' + homeObj.Extra2 + '－' + awayObj.Extra2;
		}
		if(homeObj.PK != ''){
			scoreBox += '<br />' + homeObj.PK + '（PK）' + awayObj.PK;
		}
		
		scoreBox += '</td>';
		scoreBox += '<td class="point">' + awayObj.Score + '</td>';
		scoreBox += '<td class="team2">' + awayObj.TeamName + '（' + awayObj.Block + '）</td>';
		scoreBox += '</tr>';
			
			
		var goalLength=gameInfo[i].GoalInfo.length;
		
		if(goalLength > 0){
			scoreBox += '<tr>';
			scoreBox += '<td colspan="5">';
			scoreBox += '<p style="text-align:center; font-size:0.8em;">';
			
			for(var g=0;g < goalLength;g++){
				scoreBox += gameInfo[i].GoalInfo[g].Goal + '<br />';
			}
			scoreBox += '</p>';
			scoreBox += '</td>';
			scoreBox += '</tr>';
		}
			
		scoreBox += '</table>';
		scoreBox += '</div>';
		
	}


	document.getElementById("gameScore").innerHTML=scoreBox;
};
