// トップスコア用メソッド ==============================================
function topScore_make(json_obj) {
	// 必要な情報
	var game_date = json_obj.Rugby[0].GameInfo[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 youbi = '';
	if (game_date_DD == '27') {
		youbi = '土';
	}
	else if (game_date_DD == '28') {
		youbi = '日';
	}
	else if (game_date_DD == '29') {
		youbi = '月';
	}
	else if (game_date_DD == '30') {
		youbi = '火';
	}
	else if (game_date_DD == '31') {
		youbi = '水';
	}
	else if (game_date_DD == '01') {
		youbi = '木';
	}
	else if (game_date_DD == '1') {
		youbi = '木';
	}
	else if (game_date_DD == '02') {
		youbi = '金';
	}
	else if (game_date_DD == '2') {
		youbi = '金';
	}
	else if (game_date_DD == '03') {
		youbi = '土';
	}
	else if (game_date_DD == '3') {
		youbi = '土';
	}
	else if (game_date_DD == '04') {
		youbi = '日';
	}
	else if (game_date_DD == '4') {
		youbi = '日';
	}
	else if (game_date_DD == '05') {
		youbi = '月';
	}
	else if (game_date_DD == '5') {
		youbi = '月';
	}
	else if (game_date_DD == '06') {
		youbi = '火';
	}
	else if (game_date_DD == '6') {
		youbi = '火';
	}
	else if (game_date_DD == '07') {
		youbi = '水';
	}
	else if (game_date_DD == '7') {
		youbi = '水';
	}
	else {
		// ...
	}

	// 見出し
	var heading_out_html = '<h3>' + game_date_MM + '月' + game_date_DD + '日（' + youbi + '）' + phase + json_obj.Rugby[0].GameInfo.length + '試合</h3>';

	// 表示
	document.getElementById("rgTodayScore").innerHTML = heading_out_html;

	// テーブル
	var table_out_html = '<table cellspacing="0" cellpadding="0">' + "\n" +
'<tr>' + "\n" +
'<th class="th01 bg">開始時刻</th>' + "\n" +
'<th class="th02" colspan="3">対戦カード</th>' + "\n" +
'<th class="th03">会場</th>' + "\n" +
'<th id="thNo">試合番号</th>' + "\n" +
'</tr>' + "\n";

	// 試合分を繰り返す
	for (var i = 0; i < json_obj.Rugby[0].GameInfo.length; i++) {
		// 時間
		table_out_html += '<tr>' + "\n" +
'<td class="line">' + json_obj.Rugby[0].GameInfo[i].GameTime + '</td>' + "\n";

		// ホームチーム
		table_out_html += '<td class="school">' + json_obj.Rugby[0].GameInfo[i].HomeInfo.TeamName + '（' + json_obj.Rugby[0].GameInfo[i].HomeInfo.Block + '）</td>' + "\n";

		// スコア
		table_out_html += '<td class="score">' + json_obj.Rugby[0].GameInfo[i].HomeInfo.Score + '-' + json_obj.Rugby[0].GameInfo[i].VisitorInfo.Score + '</td>' + "\n";

		// ビジターチーム
		table_out_html += '<td class="school2">' + json_obj.Rugby[0].GameInfo[i].VisitorInfo.TeamName + '（' + json_obj.Rugby[0].GameInfo[i].VisitorInfo.Block + '）</td>' + "\n";

		// 会場
		table_out_html += '<td>' + json_obj.Rugby[0].GameInfo[i].StadiumShort + '</td>' + "\n";

		// 試合番号
		table_out_html += '<td>' + json_obj.Rugby[0].GameInfo[i].MatchID + '</td>' + "\n" +
'</tr>' + "\n";
	}

	// 閉じタグ
	table_out_html += '</table>' + "\n";

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


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

// 実行
topScore_make(rgObj);

