function btnOver(btnId){
	var btnF = document.getElementById(btnId);
	if(btnId=='formBtn01'){
		btnF.style.backgroundImage = 'url(./../../src/img/form_btn02_ov.gif)';
	}else if(btnId=='formBtn02'){
		btnF.style.backgroundImage = 'url(./../../src/img/form_btn01_ov.gif)';
	}else if(btnId=='formBtn03'){
		btnF.style.backgroundImage = 'url(./../../src/img/form_btn02_ov.gif)';
	}else if(btnId=='formBtn04'){
		btnF.style.backgroundImage = 'url(./../../src/img/form_btn01_ov.gif)';
	}
}

function btnOut(btnId){
	var btnF = document.getElementById(btnId);
	if(btnId=='formBtn01'){
		btnF.style.backgroundImage = 'url(./../../src/img/form_btn02.gif)';
	}else if(btnId=='formBtn02'){
		btnF.style.backgroundImage = 'url(./../../src/img/form_btn01.gif)';
	}else if(btnId=='formBtn03'){
		btnF.style.backgroundImage = 'url(./../../src/img/form_btn02.gif)';
	}else if(btnId=='formBtn04'){
		btnF.style.backgroundImage = 'url(./../../src/img/form_btn01.gif)';
	}
}

// 掲示板ログインポップアップ
function Login_BBS(top) {

	var args = new Array();
	var dir = "";

	if (top == 1) {
		dir = "./gakushu/bbs/";
	}
	else {
		dir = "./";
	}

	ret = showModalDialog(dir + "login_bbs.html", args, "dialogHeight:195px;dialogWidth:320px;center:yes;");

	if (ret != null && ret != false) {
		ary = ret.split("\n");
		var url = dir + "login_check.php?id=" + ary[0] + "&pwd=" + ary[1];
		location.href = url;
	}
}

// 必須入力チェック
function blank_check() {

	var err_msg = "";

	if (document.entry_dat.category_necessity.value == "1") {
		for (i = 0; i < document.entry_dat.category.length; i++) {
			if (document.entry_dat.category[i].checked) {
				break;
			}
		}

		if (i == document.entry_dat.category.length) {
			err_msg += "カテゴリーを選択してください。\n";
		}
	}

	if (document.entry_dat.kind_necessity.value == "1") {
		for (i = 0; i < document.entry_dat.kind.length; i++) {
			if (document.entry_dat.kind[i].checked) {
				break;
			}
		}

		if (i == document.entry_dat.kind.length) {
			err_msg += "内容の種類を選択してください。\n";
		}
	}

	if (document.entry_dat.title.value == "") {
		err_msg += "タイトルを入力してください。\n";
	}
	if (document.entry_dat.poster_name.value == "") {
		err_msg += "お名前を入力してください。\n";
	}
	if (document.entry_dat.inst_name.value == "") {
		err_msg += "施設名を入力してください。\n";
	}
	if (document.entry_dat.pref.selectedIndex == 0) {
		err_msg += "都道府県を選択してください。\n";
	}
	if (document.entry_dat.email.value == "") {
		err_msg += "メールアドレスを入力してください。\n";
	}
	if (document.entry_dat.contents.value == "") {
		err_msg += "本文を入力してください。\n";
	}
	if (err_msg != "") {
		alert(err_msg);
		return;
	}

	document.entry_dat.submit()
}

// カテゴリー選択処理
function select_category()
{

	// サブカテゴリーにカテゴリー選択値に応じた選択肢をセットする
	index = document.entry_dat.category.selectedIndex;
	category_id = document.entry_dat.category[index].value;
	document.entry_dat.sub_category.length = 1;

	for (i = j = 0; i < document.entry_dat.category_tbl.length; i++) {
		if (document.entry_dat.category_tbl[i].value == category_id) {
			val = document.entry_dat.category_tbl[i].text.split(";");
			document.entry_dat.sub_category.options[++j] = new Option(val[1], val[0]);
		}
	}

	// 選択したtextを確認画面用にhiddenに格納
	document.entry_dat.selected_category_text.value = document.entry_dat.category[index].text;
}

// サブカテゴリー選択処理
function select_sub_category()
{

	// 選択したtextを確認画面用にhiddenに格納
	index = document.entry_dat.sub_category.selectedIndex;
	document.entry_dat.selected_sub_category_text.value = document.entry_dat.sub_category[index].text;
}

