// 男子スコア用メソッド ==============================================
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 = '<h4>男子</h4>' + "\n";

	for (var j = 0; j < json_obj.Volleyball.length; j++) {
		var phase = json_obj.Volleyball[j].Phase;
		
		out_html += '<div class="tableTitle tableTitleP">' + "\n";
		out_html += '<h5>' + game_date_MM + '月' + game_date_DD + '日 ' + phase + '</h5>' + "\n";
		out_html += '</div>' + "\n";
		
		out_html += '<table border="1" summary="本日 男子の日程＆結果">' + "\n";
		out_html += '<tr>' + "\n";
		out_html += '<th scope="col" class="bg">出場校</th>' + "\n";
		out_html += '<th scope="col">スコア</th>' + "\n";
		out_html += '<th scope="col">出場校</th>' + "\n";
		out_html += '</tr>' + "\n";
		

		// 試合分を繰り返す
		for (var i = 0; i < json_obj.Volleyball[j].GameInfo.length; i++) {
			var game_info = json_obj.Volleyball[j].GameInfo[i];
			
			// チーム＆スコア
			out_html += '<tr>' + "\n";
			out_html += '<td class="line school">' + game_info.HomeInfo.TeamName + '（' + game_info.HomeInfo.Block + '）</td>' + "\n";
			if(game_info.Set == '開始前'){
				out_html += '<td class="score">' + game_info.GameTime + '</td>' + "\n";
			}else{
				out_html += '<td class="score">' + game_info.HomeInfo.Score + '－' + game_info.VisitorInfo.Score + '</td>' + "\n";
			}
			out_html += '<td class="school">' + game_info.VisitorInfo.TeamName + '（' + game_info.VisitorInfo.Block + '）</td>' + "\n";
			out_html += '</tr>' + "\n";
			
		}
		out_html += '</table>' + "\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 = '<h4>女子</h4>' + "\n";

	for (var j = 0; j < json_obj.Volleyball.length; j++) {
		var phase = json_obj.Volleyball[j].Phase;
		
		out_html += '<div class="tableTitle tableTitleP">' + "\n";
		out_html += '<h5>' + game_date_MM + '月' + game_date_DD + '日 ' + phase + '</h5>' + "\n";
		out_html += '</div>' + "\n";
		
		out_html += '<table border="1" summary="本日 男子の日程＆結果">' + "\n";
		out_html += '<tr>' + "\n";
		out_html += '<th scope="col" class="bg">出場校</th>' + "\n";
		out_html += '<th scope="col">スコア</th>' + "\n";
		out_html += '<th scope="col">出場校</th>' + "\n";
		out_html += '</tr>' + "\n";
		

		// 試合分を繰り返す
		for (var i = 0; i < json_obj.Volleyball[j].GameInfo.length; i++) {
			var game_info = json_obj.Volleyball[j].GameInfo[i];
			
			// チーム＆スコア
			out_html += '<tr>' + "\n";
			out_html += '<td class="line school">' + game_info.HomeInfo.TeamName + '（' + game_info.HomeInfo.Block + '）</td>' + "\n";
			if(game_info.Set == '開始前'){
				out_html += '<td class="score">' + game_info.GameTime + '</td>' + "\n";
			}else{
				out_html += '<td class="score">' + game_info.HomeInfo.Score + '－' + game_info.VisitorInfo.Score + '</td>' + "\n";
			}
			out_html += '<td class="school">' + game_info.VisitorInfo.TeamName + '（' + game_info.VisitorInfo.Block + '）</td>' + "\n";
			out_html += '</tr>' + "\n";
			
		}
		
		out_html += '</table>' + "\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);
}



