// 男子スコア用メソッド ==============================================
function score_make_m(json_obj) {
	// 必要な情報
	var game_date = json_obj.Volleyball[0].GameInfo[0].GameDate;
	var game_date_MM = parseInt(game_date.substring(4, 6),10);
	var game_date_DD = parseInt(game_date.substring(6, 8),10);

	// 書き出す HTML

	var out_html = '<div class="listHead">' + "\n" +
'<h3>男子</h3>' + "\n" +
'</div>';
	
	for (var j = 0; j < json_obj.Volleyball.length; j++) {
		var phase = json_obj.Volleyball[j].Phase;

		// 試合分を繰り返す
		for (var i = 0; i < json_obj.Volleyball[j].GameInfo.length; i++) {
			var game_info = json_obj.Volleyball[j].GameInfo[i];
			
			// ヘッダ
			out_html += '<div class="scoreTwrap">' + "\n" +
			'<table border="0" class="scoreTable" summary="スコア速報" border="0">' + "\n" +
			'<tbody><tr>' + "\n";
	
			// 試合情報
			out_html += '<td colspan="2" class="data">' + game_date_MM + '月' + game_date_DD + '日&nbsp;' +phase + '&nbsp;' + game_info.GameTime + '</td>' + "\n" +
			'<td class="start">' + game_info.Set + '</td>' + "\n" +
			'<td colspan="2" class="place">' + game_info.StajiumShort + '（試合No' + game_info.MatchID + '）</td>' + "\n" +
			'</tr>' + "\n" +
			'<tr>' + "\n";
	
	
	
			// チーム＆スコア
			if(game_info.HomeInfo.Block){
				out_html += '<td class="team">' + game_info.HomeInfo.TeamName + '<br />（' + game_info.HomeInfo.Block + '）</td>' + "\n"; 
			}else{
				out_html += '<td class="team">' + game_info.HomeInfo.TeamName + '<br /></td>' + "\n";
			}
			
			out_html += '<td class="point">' + game_info.HomeInfo.Score + '</td>' + "\n" +
			'<td class="time">' + game_info.HomeInfo.Set1 + '－' + game_info.VisitorInfo.Set1 + '<br />' + game_info.HomeInfo.Set2 + '－' + game_info.VisitorInfo.Set2 + '<br />' + "\n";
	
			// 3セットから５セット 対応
			if (game_info.HomeInfo.Set3) {
				out_html += game_info.HomeInfo.Set3 + '－' + game_info.VisitorInfo.Set3 + '<br />';
			}
	
			if (game_info.HomeInfo.Set4) {
				out_html += game_info.HomeInfo.Set4 + '－' + game_info.VisitorInfo.Set4 + '<br />';
			}
	
			if (game_info.HomeInfo.Set5) {
				out_html += game_info.HomeInfo.Set5 + '－' + game_info.VisitorInfo.Set5 + '<br />';
			}
	
	
	
			out_html += '</td>' + "\n" +
			'<td class="point">' + game_info.VisitorInfo.Score + '</td>' + "\n";
			if(game_info.VisitorInfo.Block){
				out_html += '<td class="team2">' + game_info.VisitorInfo.TeamName + '<br />（' + game_info.VisitorInfo.Block + '）</td>' + "\n";
			}else{
				out_html += '<td class="team2">' + game_info.VisitorInfo.TeamName + '<br /></td>' + "\n";
			}
			out_html += '</tr>' + "\n" + 
			'<tr>' + "\n" + 
			'<td colspan="5">' + "\n" + 
			'</td>' + "\n" + 
			'</tr>' + "\n" + 
			'</tbody>' + "\n" +
			'</table>' + "\n" +
			'</div>' + "\n";
		}
	
	}
	// 表示
	
	document.getElementById("gameScore-m").innerHTML = out_html;

}


// 女子スコア用メソッド ==============================================
function score_make_w(json_obj) {
	// 必要な情報
	var game_date = json_obj.Volleyball[0].GameInfo[0].GameDate;
	var game_date_MM = parseInt(game_date.substring(4, 6),10);
	var game_date_DD = parseInt(game_date.substring(6, 8),10);

	// 書き出す HTML
	var out_html = '<div class="listHead">' + "\n" +
'<h4>女子</h4>' + "\n" +
'</div>';

	for (var j = 0; j < json_obj.Volleyball.length; j++) {
		var phase = json_obj.Volleyball[j].Phase;

		// 試合分を繰り返す
		for (var i = 0; i < json_obj.Volleyball[j].GameInfo.length; i++) {
			var game_info = json_obj.Volleyball[j].GameInfo[i];
	
			// ヘッダ
			out_html += '<div class="scoreTwrap">' + "\n" +
			'<table border="0" class="scoreTable" summary="スコア速報" border="0">' + "\n" +
			'<tbody><tr>' + "\n";
	
			// 試合情報
			out_html += '<td colspan="2" class="data">' + game_date_MM + '月' + game_date_DD + '日&nbsp;' +phase + '&nbsp;' + game_info.GameTime + '</td>' + "\n" +
			'<td class="start">' + game_info.Set + '</td>' + "\n" +
			'<td colspan="2" class="place">' + game_info.StajiumShort + '（試合No' + game_info.MatchID + '）</td>' + "\n" +
			'</tr>' + "\n" +
			'<tr>' + "\n";
	
			// チーム＆スコア
			if(game_info.HomeInfo.Block){
				out_html += '<td class="team">' + game_info.HomeInfo.TeamName + '<br />（' + game_info.HomeInfo.Block + '）</td>' + "\n"; 
			}else{
				out_html += '<td class="team">' + game_info.HomeInfo.TeamName + '<br /></td>' + "\n";
			}
			
			out_html += '<td class="point">' + game_info.HomeInfo.Score + '</td>' + "\n" +
			'<td class="time">' + game_info.HomeInfo.Set1 + '－' + game_info.VisitorInfo.Set1 + '<br />' + game_info.HomeInfo.Set2 + '－' + game_info.VisitorInfo.Set2 + '<br />' + "\n";
	
			// 3セットから５セット 対応
			if (game_info.HomeInfo.Set3) {
				out_html += game_info.HomeInfo.Set3 + '－' + game_info.VisitorInfo.Set3 + '<br />';
			}
	
			if (game_info.HomeInfo.Set4) {
				out_html += game_info.HomeInfo.Set4 + '－' + game_info.VisitorInfo.Set4 + '<br />';
			}
	
			if (game_info.HomeInfo.Set5) {
				out_html += game_info.HomeInfo.Set5 + '－' + game_info.VisitorInfo.Set5 + '<br />';
			}
	
	
	
			out_html += '</td>' + "\n" +
			'<td class="point">' + game_info.VisitorInfo.Score + '</td>' + "\n";
			if(game_info.VisitorInfo.Block){
				out_html += '<td class="team2">' + game_info.VisitorInfo.TeamName + '<br />（' + game_info.VisitorInfo.Block + '）</td>' + "\n";
			}else{
				out_html += '<td class="team2">' + game_info.VisitorInfo.TeamName + '<br /></td>' + "\n";
			}
			out_html += '</tr>' + "\n" + 
			'<tr>' + "\n" + 
			'<td colspan="5">' + "\n" + 
			'</td>' + "\n" + 
			'</tr>' + "\n" + 
			'</tbody>' + "\n" +
			'</table>' + "\n" +
			'</div>' + "\n";
		}
	}

	// 表示
	
	document.getElementById("gameScore-w").innerHTML = out_html;
}


// メイン ==============================================
// 男子
var vomObj = new Object;
vomObj = eval("(" + resultText_m + ")");
if(vomObj){
	score_make_m(vomObj);
}

// 女子
var vowObj = new Object;
vowObj = eval("(" + resultText_w + ")");
if(vowObj){
	score_make_w(vowObj);
}



