

// 診断テスト 改 2005/8/2
// original by Mamiko.M(http://www.nmt.ne.jp/~mamiko/) 

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

	
	var n_marks = 0;

	var cnt = 14;
	
	var n = new Array("Q1","Q2","Q3","Q4","Q5","Q6","Q7","Q8","Q9","Q10","Q11","Q12","Q13","Q14");
	
	
	for(var i=0; i<radio_btn; i++){		 //ラジオボタンの数だけ回す。
		if(theForm.elements[i].checked == true){
			var radio_name = theForm.elements[i].name;
			var radio_mark = parseInt(theForm.elements[i].value);
			for(var j=0; j<cnt; j++){
				
				if(n[j] == radio_name){
					n_marks = n_marks + radio_mark;
				}
			}
		}
	}

	//各点数を判定。
	newwindow(n_marks);
	return;
}

function newwindow(n_marks){
	//結果を表示するウインドウ。

	var n_marks_v = n_marks/10;	//本来の点数にするため、n_marks_vへ10分の1の点数を格納。

	var newWindow = window.open("","New_window","scrollbars=0,toolbars=0,width=400,height=350");
	newWindow.document.clear();//一応、クリアする

	newWindow.document.write("<html><body>\n");
	newWindow.document.write("<blockquote>\n")
	
	if(n_marks > 20){
		newWindow.document.write("<font><b>診断結果</b></font><br>");
		newWindow.document.write("<br>\n");
		newWindow.document.write("テストの結果は\n");
		newWindow.document.write( + n_marks_v + "点でした<br>");
		newWindow.document.write("<br>\n");
		newWindow.document.write("<font color=#ff0000><b>あなたは重篤問題飲酒群です</b></font><br>\n");
		newWindow.document.write("<br>\n");
		newWindow.document.write("あなたのアルコールの飲み方には非常に問題があります。アルコール依存症の疑いも持たれます。<br>");
		newWindow.document.write("すみやかに専門の相談機関に行き、治療と教育を受けられることを強くお勧めいたします。");
		newWindow.document.write("<br>\n");

	}
	if(20 >=n_marks && n_marks >= 0){
		newWindow.document.write("<font><b>診断結果</b></font><br>");
		newWindow.document.write("<br>\n");
		newWindow.document.write("テストの結果は\n");
		newWindow.document.write( + n_marks_v + "点でした<br>");
		newWindow.document.write("<br>\n");
		newWindow.document.write("<font color=#ffa500><b>あなたは問題飲酒群です</b></font><br>\n");
		newWindow.document.write("<br>\n");
		newWindow.document.write("あなたのアルコールの飲み方には問題があります。アルコール依存症の疑いも持たれます。<br>");
		newWindow.document.write("すみやかに専門の相談機関に行き、治療と教育を受けられることをお勧めいたします。");
		newWindow.document.write("<br>\n");

	}
	if(0 > n_marks && n_marks > -50){
		newWindow.document.write("<font><b>診断結果</b></font><br>");
		newWindow.document.write("<br>\n");
		newWindow.document.write("テストの結果は\n");
		newWindow.document.write( + n_marks_v + "点でした");
		newWindow.document.write("<br>\n");
		newWindow.document.write("<font color=#32cd32><b>あなたは問題飲酒予備軍です</b></font><br>\n");
		newWindow.document.write("<br>\n");
		newWindow.document.write("あなたのアルコールの飲み方には、若干の問題があります。このまま飲み続けるとアルコール依存症になる可能性も考えられます。<br>");
		newWindow.document.write("今後困ったことが生じたら、すみやかに専門の相談機関にご相談ください。");
		newWindow.document.write("<br>\n");

	}
	if(n_marks <= -50){
		
		newWindow.document.write("<font><b>診断結果</b></font><br>");
		newWindow.document.write("<br>\n");
		newWindow.document.write("テストの結果は\n");
		newWindow.document.write( + n_marks_v + "点でした");
		newWindow.document.write("<br>\n");
		newWindow.document.write("<font color=#4169e1><b>あなたは正常飲酒群です</b></font><br>\n");
		newWindow.document.write("<br>\n");
		newWindow.document.write("今のところ、あなたのアルコールの飲み方には問題はないと考えられます。<br>");
		newWindow.document.write("飲み過ぎに注意して、このまま節度ある飲酒を続けられることが、健康維持にはとても重要となります。");
		newWindow.document.write("<br>\n");

	}
	newWindow.document.write("</blockquote>\n");
	newWindow.document.write("</body></html>\n");
	newWindow.document.close();
	newWindow.focus();

	return;
}
// 診断テストは、ここまで
