//読み込み時に期間入力を不可にする
window.onload = function() {
	if (document.getElementById("per01").checked = true) {
		periodDisable();
	}
}

//期間入力フォーム部品のID設定
prf = new Array("sy", "sm", "sd", "ly", "lm", "ld");

//期間入力を可能にする
function periodAble() {
	for (i=0; i<prf.length; i++) {
		document.getElementById(prf[i]).removeAttribute("disabled", "disabled");
	}
}

//期間入力を不可能にする
function periodDisable() {
	for (i=0; i<prf.length; i++) {
		document.getElementById(prf[i]).setAttribute("disabled", "disabled");
	}
}

//<body onload>で設定されたオプションを閉じる
function OptionCloser() {
	for (var i=0; i<arguments.length; i++) {
		CloseOption(arguments[i]);
	}
}

//オプション部分の開閉操作
function OptionSwitch(id) {
	if(document.getElementById) {
		if(document.getElementById(id).style.display == "block") {
			CloseOption(id);
		}else if(document.getElementById(id).style.display == "none") {
			OpenOption(id);
		}
	}
}

function CloseOption(id) {
	var iid = id + "-icon";
	var aid = id + "-anchor";
	var ttl = document.getElementById(aid).title;
	document.getElementById(id).style.display = "none";
	document.images[iid].src  = "/images/interface-icon/open-48x16.png";
	document.images[iid].alt = "あける";
	ttl = ttl.replace("閉じます","開けます");
	document.getElementById(aid).title = ttl;
}

function OpenOption(id) {
	var iid = id + "-icon";
	var aid = id + "-anchor";
	var ttl = document.getElementById(aid).title;
	document.getElementById(id).style.display = "block";
	document.images[iid].src  = "/images/interface-icon/close-48x16.png";
	document.images[iid].alt = "とじる";
	ttl = ttl.replace("開けます","閉じます");
	document.getElementById(aid).title = ttl;
}