// オンロードイベント
function formText() {
	//日付取得
	myD = new Date();
	myYear = ( myD.getYear() < 2000 ) ? myD.getYear() + 1900 : myD.getYear();
	myMonth = myD.getMonth() + 1;
	myDate = myD.getDate();
	myYM = "" + myYear + toDoubleDigits( myMonth );

	text = '<div style="margin-left:5px;"><select name="k_ym" size="1">';

	//年月
	for(var i=0; i<5; i++) {
		myMonth2 = ( myMonth + i < 13 ) ? myMonth + i : myMonth + i - 12;
		myYear2 = ( myMonth + i < 13 ) ? myYear : myYear + 1;
		myYM2 = "" + myYear2 + toDoubleDigits( myMonth2 );
		if( myYM == myYM2 ) {
			text += '<option value="'+ myYM2 + '" selected >' + myYear2 + '年' + myMonth2 + '月</option>';
		}else{
			text += '<option value="'+ myYM2 + '" >' + myYear2 + '年' + myMonth2 + '月</option>';
		}
	}

	text += '</select><select name="k_d">';

	//日
	for(var i=1; i<=31; i++) {
		if( myDate == i ) {
			text += '<option value="'+ i + '" selected >' + i + '日</option>';
		}else{
			text += '<option value="'+ i + '" >' + i + '日</option>';
		}
	}

	text += '</select></div><div style="margin-left:5px;margin-top:0.5em;"><select name="rm_id">';
	
	//部屋タイプ
	text += '<option value="" selected>全てのタイプ</option><option value="2" >[1名]スーペリアシングル</option><option value="5" >[2名]セミダブル</option><option value="3" >[1～2名]スタンダードツイン</option><option value="6" >[1～2名]ハリウッドツイン</option><option value="4" >[1～3名]ﾃﾞﾗｯｸｽﾂｲﾝ（ﾄﾘﾌﾟﾙ）</option>';

	text += '</select></div><dl><dt id="sid_sar"><a href="#" onclick="searchSubmit();">検索</a></dt><input type="hidden" name="smem_id" value="756"><input type="hidden" name="op_id" value="1"></dl>';

	return text;

}

// 日付の桁揃え
function toDoubleDigits(num) {
	num += "";
	if (num.length === 1) {
		num = "0" + num;
	}
	return num;
};

// 検索サブミット
function searchSubmit() {
	document.f1.submit();
	return false;
}

// ポップアップウィンドウのソース
function openwin(name, w) {
	w = window.open('', name, 'width=' + w + ',scrollbars=yes,resizable=yes');
	w.focus();
}

function openMenu(id) {

	var oSubMenu = document.getElementById(id);
	if (oSubMenu) {
		if ("block" == oSubMenu.style.display) {
			oSubMenu.style.display = "none";
		} else {
			oSubMenu.style.display = "block";
		}
	}
}
