<!--
// よく使うフォーム
// tagname の名前の <select></select>を作る xx
// 使用例 make_selectNumber('Year',1950,2050,1,2002);
// stepyy はステップ
// startyy <= defaultyy <= endyy の時、デフォルトが設定される。それ以外は設定無し
function make_selectNumber(tagname,startyy,endyy,stepyy,defaultyy) {
	var msg,tsyy,teyy,yy;
	var tlenmax,tyy,n;
	stepyy = (stepyy < 0) ? -stepyy : stepyy;
	stepyy = Math.floor(stepyy);
	if (stepyy < 1) stepyy = 1;
	if (startyy > endyy) {	// 増加方向でも減少方向でも出来るように
		tsyy = endyy;
		teyy = startyy;
		stepyy = -stepyy;
	} else {
		tsyy = startyy;
		teyy = endyy;
	}

	tlenmax = ('' + tsyy).length;
	tyy = '' + teyy;
	tlenmax = (tlenmax >= tyy.length) ? tlenmax : tyy.length;
	document.writeln('<select name="' + tagname + '">');
	for (yy = startyy; (tsyy <= yy) && (yy <= teyy) ; yy += stepyy) {
		msg = '<option value="' + yy + '"';
		if (yy == defaultyy) {
			msg = msg + ' selected';
		}

		n = tlenmax;	// 0 詰め
		if (yy < 0) {
			tyy = '' + (-yy);
			n--;
			while (n > tyy.length) {
				tyy = '0' + tyy;
			}
			tyy = '-' + tyy;
		} else {
			tyy = '' + yy;
			while (n > tyy.length) {
				tyy = '0' + tyy;
			}
		}
		document.writeln(msg + '>' + tyy);
	}
	document.writeln('</select>');
}

// make_selectNumber で設定した formname.tagname の選択数値を返す
// formname : フォームの名前
// tagname  : タグの名前
function get_selectValue(doc) {
	var n;
	
	with (doc) {
		n = selectedIndex;
		return options[n].value;
	}
}
// -->
