// スコア速報用メソッド ==============================================
function score_make(json_obj) {
	// 必要な情報
	var game_info_0 = json_obj.Rugby[0].GameInfo[0];
	var game_date = game_info_0.GameDate;
	var game_date_MM = parseInt(game_date.substring(4, 6));
	var game_date_DD = parseInt(game_date.substring(6, 8));
	var phase = json_obj.Rugby[0].Phase;

	// 書き出す HTML
	// テーブル
	var table_out_html = '';

	// 試合分を繰り返す
	for (var i = 0; i < json_obj.Rugby[0].GameInfo.length; i++) {
		var  game_info = json_obj.Rugby[0].GameInfo[i];

		table_out_html += '<div class="scoreTwrap">' + "\n" +
'<table class="scoreTable" summary="スコア速報" border="0">' + "\n" +
'<td colspan="2" class="data">' + game_date_MM + '月' + game_date_DD + '日 ' + phase + '　' + game_info.GameTime + '</td>' + "\n" +
'<td class="start">' + game_info.Half + '</td>' + "\n" +
'<td colspan="2" class="place">' + game_info.StadiumShort + '</td>' + "\n" +
'</tr>' + "\n" +
'<tr>' + "\n" +
'<td class="team">' + game_info.HomeInfo.TeamName + '（' + game_info.HomeInfo.Block + '）</td>' + "\n" +
'<td class="point">' + game_info.HomeInfo.Score + '</td>' + "\n" +
'<td class="time">' + game_info.HomeInfo.Score1 + '(前半)' + game_info.VisitorInfo.Score1 + '<br>' + "\n" +
game_info.HomeInfo.Score2 + '(後半)' + game_info.VisitorInfo.Score2;

		// T, TG, 抽選処理
		// 抽選
		if (game_info.HomeInfo.Draw) {
			var home_draw = '';
			var visitor_draw = '';

			if (game_info.HomeInfo.Draw == '1') {
				home_draw = '○';
			}
			else if (game_info.HomeInfo.Draw == '0') {
				home_draw = '×';
			}

			if (game_info.VisitorInfo.Draw == '1') {
				visitor_draw = '○';
			}
			else if (game_info.VisitorInfo.Draw == '0') {
				visitor_draw = '×';
			}

			table_out_html += '<br>' + home_draw + ' 抽選 ' + visitor_draw;
		}
		// TG
		else if (game_info.HomeInfo.Draw2) {
			table_out_html += '<br>' + game_info.HomeInfo.Draw2 + '(G)' + game_info.VisitorInfo.Draw2;
		}
		// T
		else if (game_info.HomeInfo.Draw1) {
			table_out_html += '<br>' + game_info.HomeInfo.Draw1 + '(T)' + game_info.VisitorInfo.Draw1;
		}

		table_out_html += '</td>' + "\n" +
'<td class="point">' + game_info.VisitorInfo.Score + '</td>' + "\n" +
'<td class="team2">' + game_info.VisitorInfo.TeamName + '（' + game_info.VisitorInfo.Block + '）</td>' + "\n" +
'</tr>' + "\n" +
'</table>' + "\n" +
'</div>' + "\n\n";
	}

	// 表示
	document.getElementById("gameScore").innerHTML = table_out_html;
}


// メイン ==============================================
// ラグビースコア
var rgObj = new Object;
rgObj = eval("(" + resultText + ")");

// 実行
score_make(rgObj);

