function questionOpen(id, parameter_num, title)
{
	//いきなり「問題集の更新」ボタンを押した場合
	if(!id && !document.id.stockID.value)
	{
		alert("問題集が選択されていません。");
		return false;
	}

	//フォーム内容の読み取り
	var disp = '';
	for(i = 0; i < document.setUp.length; i++)
	{
		type = document.setUp.elements[i].type;

		if(type == 'radio' || type == 'checkbox')
		{
			if(document.setUp.elements[i].checked)
			{
				name = document.setUp.elements[i].name;
				value = document.setUp.elements[i].value;
				disp += name + "=" + value + "&";
			}
		}
		else if(type == 'select-one' || type == 'select-multiple')
		{
			for(j = 0; j < document.setUp.elements[i].length; j++)
			{
				if(document.setUp.elements[i].options[j].selected)
				{
					name = document.setUp.elements[i].name;
					if(document.setUp.elements[i].options[j].value)
					{value = document.setUp.elements[i].options[j].value;}
					else
					{value = document.setUp.elements[i].options[j].text;}
					disp += name + "=" + value + "&";
				}
			}
		}
		else if(type == 'text' || type == 'textarea' || type == 'hidden')
		{
			name = document.setUp.elements[i].name;
			value = document.setUp.elements[i].value;
			disp += name + "=" + value + "&";
		}
	}

	//問題集一覧からのIDか、無ければフォーム内のIDを使う
	if(id)
	{
		disp += "service_id=" + id + "&";
		document.id.stockID.value = id;
	}
	else
	{disp += "service_id=" + document.id.stockID.value + "&";}

	//パラメーター番号
	if(parameter_num || parameter_num == 0)
	{
		disp += "parameter_num=" + parameter_num + "&";
		document.id.parameter_num.value = parameter_num;
	}
	else
	{disp += "parameter_num=" + document.id.parameter_num.value + "&";}

	//ウィンドウの大きさ
	if(document.setUp.paper.value == 'B5')
	{width = 607; height = 600;}
	else if(document.setUp.paper.value == 'A5')
	{width = 493; height = 600;}
	else
	{width = 730; height = 600;}

	window.open("math_question.php?"+disp,"question","menubar=yes,toolbar=yes,scrollbars=yes,location=yes,width="+width+",height="+height);

}

function questionOpen2(id)
{
	if(typeof id == "undefined")
	{id = '';}
	window.open("math_q2.php?question_id="+id,"question2","menubar=yes,toolbar=yes,scrollbars=yes,location=yes,width=730,height=500");
}

function questionMake(id)
{
	if(typeof id == "undefined")
	{id = '';}
	window.open('math_q2_make.php?question_id='+id,'math_q2','menubar=no,toolbar=no,scrollbars=no,location=no,width=920,height=720');
}

function questionOpen_u(id)
{
	if(typeof id == "undefined")
	{id = '';}
	window.open("math_q2.php?u="+id,"question2","menubar=yes,toolbar=yes,scrollbars=yes,location=yes,width=730,height=500");
}


