function test2(theForm){
	var radio_btn = 42;				//ラジオボタンの数をセット。

	var a_marks = 0;				//分量
	var b_marks = 0;				//習慣
	var c_marks = 0;				//バランス
	var o_marks = 0;				//エネルギー
	var p2_marks = 0;				//たんぱく質2
	var p3_marks = 0;				//たんぱく質3
	var q_marks = 0;				//塩分
	var r_marks = 0;				//脂質
	var s_marks = 0;				//ビタミン・ミネラル
	

	var a = new Array("Q1","Q4","Q6");
	var b = new Array("Q2","Q3","Q5");
	var c = new Array("Q7","Q8");
	var o = new Array("Q19","Q20","Q21");
	var p2 = new Array("Q12");
	var p3 = new Array("Q13","Q14");
	var q = new Array("Q15","Q16");
	var r = new Array("Q17","Q18");
	var s = new Array("Q9","Q10","Q11");
	
	var q_item = 21;				//問題の数をセット。
	var k = 0;

	for(var i=0; i<radio_btn; i++){		 //ラジオボタンの数だけ回す。
		if(theForm.elements[i].checked == true){
			k++;	//kにはチェック数が入る
			var radio_name = theForm.elements[i].name;
			var radio_mark = parseInt(theForm.elements[i].value);
			for(var j=0; j<9; j++){
				//a_marks,b_marks,c_marks,o_marks,p_marks,p2_marks,p3_marks,q_marks,r_marks,s_marksには点数が入る。
				if(a[j] == radio_name){
					a_marks = a_marks + radio_mark;
					break;
				}else if(b[j] == radio_name){
					b_marks = b_marks + radio_mark;
					break;
				}else if(c[j] == radio_name){
					c_marks = c_marks + radio_mark;
					break;
				}else if(o[j] == radio_name){
					o_marks = o_marks + radio_mark;
					break;
				}else if(p2[j] == radio_name){
					p2_marks = p2_marks + radio_mark;
					break;
				}else if(p3[j] == radio_name){
					p3_marks = p3_marks + radio_mark;
					break;
				}else if(q[j] == radio_name){
					q_marks = q_marks + radio_mark;
					break;
				}else if(r[j] == radio_name){
					r_marks = r_marks + radio_mark;
					break;
				}else if(s[j] == radio_name){
					s_marks = s_marks + radio_mark;
					break;
				}
			}
		}
	}
	if(k<q_item){
		msg = "すべての質問に回答してください。";
		alert(msg);
	}else{
		//各点数を判定。
		newwindow(a_marks,b_marks,c_marks,o_marks,p2_marks,p3_marks,q_marks,r_marks,s_marks);
		return;
	}
}

function newwindow(a_marks,b_marks,c_marks,o_marks,p2_marks,p3_marks,q_marks,r_marks,s_marks){
	//結果を表示するウインドウ。
	
	newWindow = open("","New_window","width=800,height=800,scrollbars=yes");
	newWindow.document.clear();

	newWindow.document.write("<html><body bgcolor='white'>");
	newWindow.document.write("<div align=center>");
	newWindow.document.write("<h2>")
	newWindow.document.write("<img src='images/tl-shindan.gif' width='300' height='40'>");
	newWindow.document.write("</h2>");
	
	
	newWindow.document.write("<table border=0 cellpadding=5>")
	newWindow.document.write("<tr>")
	newWindow.document.write("<th>【総合】</th>");
	newWindow.document.write("<td></td>");
	newWindow.document.write("</tr>");
	
	if(a_marks > 1){
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right><font size=3>分量：</font></th>")
		newWindow.document.write("<td><img src='images/obi.gif' width='200' height='10'>  ")
		newWindow.document.write("<font size=2>良い</font></td></tr>")
	} else if(a_marks == 1) {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right><font size=3>分量：</font></th>")
		newWindow.document.write("<td><img src='images/obi.gif' width='100' height='10'>  ")
		newWindow.document.write("<font size=2>普通</font></td></tr>")
	} else {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right><font size=3>分量：</font></th>")
		newWindow.document.write("<td><img src='images/obi.gif' width='10' height='10'>  ")
		newWindow.document.write("<font size=2>悪い</font></td></tr>")
	}
	if(b_marks == 0){
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>習慣：</th>")
		newWindow.document.write("<td><img src='images/obi.gif' width='200' height='10'>  ")
		newWindow.document.write("<font size=2>良い</font></td></tr>")
	} else if(b_marks == 1) {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>習慣：</th>")
		newWindow.document.write("<td><img src='images/obi.gif' width='100' height='10'>  ")
		newWindow.document.write("<font size=2>普通</font></td></tr>")
	} else {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>習慣：</th>")
		newWindow.document.write("<td><img src='images/obi.gif' width='10' height='10'>  ")
		newWindow.document.write("<font size=2>悪い</font></td></tr>")
	}
	if(c_marks == 2){
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>バランス：</th>")
		newWindow.document.write("<td><img src='images/obi.gif' width='200' height='10'>  ")
		newWindow.document.write("<font size=2>良い</font></td></tr>")
	} else if(c_marks == 1) {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>バランス：</th>")
		newWindow.document.write("<td><img src='images/obi.gif' width='100' height='10'>  ")
		newWindow.document.write("<font size=2>普通</font></td></tr>")
	} else {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>バランス：</th>")
		newWindow.document.write("<td><img src='images/obi.gif' width='10' height='10'>  ")
		newWindow.document.write("<font size=2>悪い</font></td></tr>")
	}
	
	newWindow.document.write("<tr>")
	newWindow.document.write("<th><br></th>")
	newWindow.document.write("<td><img src='images/graf.gif' width='210' height='80'></td>")
	newWindow.document.write("</tr>")

	newWindow.document.write("</table>");
	
	newWindow.document.write("<table border=0 cellpadding=5>")
	newWindow.document.write("<tr>")
	newWindow.document.write("<th>【栄養素】</th>");
	newWindow.document.write("<td></td>");
	newWindow.document.write("</tr>");
	
	if(o_marks >= 1){
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>エネルギー：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='200' height='10'>  ")
		newWindow.document.write("<font size=2>摂りすぎ</font></td></tr>")
	} else {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>エネルギー：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='100' height='10'>  ")
		newWindow.document.write("<font size=2>良い</font></td></tr>")
	}
	if(p2_marks == 1){
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>たんぱく質：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='200' height='10'>  ")
		newWindow.document.write("<font size=2>摂りすぎ</font></td></tr>")
	} else if(p3_marks == 2) {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>たんぱく質：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='200' height='10'>  ")
		newWindow.document.write("<font size=2>摂りすぎ</font></td></tr>")
	} else if(p3_marks == 1) {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>たんぱく質：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='100' height='10'>  ")
		newWindow.document.write("<font size=2>良い</font></td></tr>")
	} else {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>たんぱく質：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='10' height='10'>  ")
		newWindow.document.write("<font size=2>不足</font></td></tr>")
	}
	if(q_marks >= 1){
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>塩分：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='200' height='10'>  ")
		newWindow.document.write("<font size=2>摂りすぎ</font></td></tr>")
	} else {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>塩分：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='100' height='10'>  ")
		newWindow.document.write("<font size=2>良い</font></td></tr>")
	}
	if(r_marks >= 1){
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>脂質：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='200' height='10'>  ")
		newWindow.document.write("<font size=2>摂りすぎ</font></td></tr>")
	} else {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>脂質：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='100' height='10'>  ")
		newWindow.document.write("<font size=2>良い</font></td></tr>")
	}
	if(s_marks >= 2){
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>ビタミン・ミネラル：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='100' height='10'>  ")
		newWindow.document.write("<font size=2>良い</font></td></tr>")
	} else {
		newWindow.document.write("<tr>")
		newWindow.document.write("<th align=right>ビタミン・ミネラル：</th>")
		newWindow.document.write("<td><img src='images/obi2.gif' width='10' height='10'>  ")
		newWindow.document.write("<font size=2>不足</font></td></tr>")
	}
	
	newWindow.document.write("<tr>")
	newWindow.document.write("<th><br></th>")
	newWindow.document.write("<td><img src='images/graf2.gif' width='210' height='100'></td>")
	newWindow.document.write("</tr>")
	
	newWindow.document.write("</table>");
	
	newWindow.document.write("<h4>")
	newWindow.document.write("<img src='images/shindan-zu.gif' width='550' height='315'>");
	newWindow.document.write("</h4>");
	
	newWindow.document.write("<h4>")
	newWindow.document.write("<font color='orange' style='normal'>もっとくわしい診断を受けて改善したい方は<a href='http://www.shokulife.com/pe/' target='_blank'>こちら</a>");
	newWindow.document.write("</h4>");
	
	newWindow.document.write("</div>");
	newWindow.document.write("</body></html>");
	newWindow.document.close();
	newWindow.focus();

	return;
}

