//----- 2story common use -----
function input_cancel(form_no)
{
	switch(form_no) {
		case 'p1':
			var form_obj = document.p1;
			break;

		case 'p2':
			var form_obj = document.p2;
			break;

		case 'p3':
			var form_obj = document.p3;
			break;

		case 'p4':
			var form_obj = document.p4;
			break;

		case 'p5':
			var form_obj = document.p5;
			break;
	}

	form_obj.action = 'content_ctrl.php';
	form_obj.submit();
}

function menu_move(move_menu)
{
	if (document.p90.sel_content)
		document.p90.sel_content.value = move_menu;

	document.p90.submit();
}

function dkey_init()
{
	if (document.p1) document.p1.dkey.value = document.p90.dkey.value;

	if (document.p2) document.p2.dkey.value = document.p90.dkey.value;

	if (document.p3) document.p3.dkey.value = document.p90.dkey.value;

	if (document.p10) document.p10.dkey.value = document.p90.dkey.value;
}

//----- 2story schedule view use ------
function sch_month_yy_set(cal)
{
	document.p1.date_yy.value = eval(document.p1.date_yy.value) + cal;
	document.p1.action = 'content_ctrl.php';
	document.p1.submit();
}

function sch_month_mm_set(mm)
{
	document.p1.date_mm.value = mm;
	document.p1.action = 'content_ctrl.php';
	document.p1.submit();
}

function sch_input_call(info_id)
{
	document.p1.info_id.value = info_id;
	document.p1.action = "content_ctrl.php";

	if (document.p1.ret_content) document.p1.ret_content.value = "";

	document.p1.submit();
}

function input_call_toOther(info_id, jump_content)
{
	document.p1.info_id.value = info_id;
	document.p1.sel_content.value = "2story_todo_incomplete";

	document.p1.submit();
}

function sch_view_change(sel_content)
{
	document.p1.sel_content.value = sel_content;
	document.p1.action = 'content_ctrl.php';
	document.p1.submit();
}

function sch_move_date(yy, mm, dd)
{
	document.p1.date_yy.value = yy;
	document.p1.date_mm.value = mm;
	document.p1.date_dd.value = dd;
	document.p1.action = 'content_ctrl.php';
	document.p1.submit();
}

function sch_move_day(dd)
{
	document.p1.date_dd.value = dd;
	document.p1.sel_content.value = "2story_sch_day";
	document.p1.action = 'content_ctrl.php';
	document.p1.submit();
}

//----- 2story schedule edit use ------
function sch_edit_init()
{
	//-----
	chkControl_set("chk_data_info_allday", document.p2.data_info_allday.value);

	sch_allday_change();

	chkControl_set("chk_data_info_alert", document.p2.data_info_alert.value);

	//-----
	if (document.p2.chk_data_info_all_member)
		chkControl_set("chk_data_info_all_member", document.p2.data_info_all_member.value);

	if (document.p2.chk_data_info_all_cupple)
		chkControl_set("chk_data_info_all_cupple", document.p2.data_info_all_cupple.value);

	//share_list_view();

	//-----
	if (document.p2.chk_data_info_all_cupple)
		chkControl_set("chk_data_info_all_cupple", document.p2.data_info_all_cupple.value);

	if (document.p2.chk_data_info_all_member)
		chkControl_set("chk_data_info_all_member", document.p2.data_info_all_member.value);
}

function sch_allday_change()
{
	chkControl_change("chk_data_info_allday", "data_info_allday");

	if (document.p2.chk_data_info_allday.checked) {
		//-----
		document.p2.data_info_sdate_normal.value = document.p2.data_info_sdate_ext.value;
		document.p2.data_info_edate_normal.value = document.p2.data_info_edate_ext.value;

		//-----
		showHideLayers('L1_data_info_sdate', 'hide');
		showHideLayers('L1_data_info_edate', 'hide');

		showHideLayers('L2_data_info_sdate', 'show');
		showHideLayers('L2_data_info_edate', 'show');
	} else {
		//-----
		document.p2.data_info_sdate_ext.value = document.p2.data_info_sdate_normal.value;
		document.p2.data_info_edate_ext.value = document.p2.data_info_edate_normal.value;

		//-----
		showHideLayers('L1_data_info_sdate', 'show');
		showHideLayers('L1_data_info_edate', 'show');

		showHideLayers('L2_data_info_sdate', 'hide');
		showHideLayers('L2_data_info_edate', 'hide');
	}

	ymdControl_set("data_info_sdate_normal", document.p2.data_info_sdate_normal.value);
	ymdControl_set("data_info_edate_normal", document.p2.data_info_edate_normal.value);

	ymdControl_setExt("data_info_sdate_ext", document.p2.data_info_sdate_ext.value);
	ymdControl_setExt("data_info_edate_ext", document.p2.data_info_edate_ext.value);

	ymd_change('data_info_sdate_normal_yy');
	ymd_change('data_info_edate_normal_yy');

	ymd_changeExt('data_info_sdate_ext_yy');
	ymd_changeExt('data_info_edate_ext_yy');
}

function sch_edit_update(io_mode)
{
	if (io_mode == 2) {
		if (document.p2.data_info_id.value == 0) {
			alert('新規データは削除できません。一度登録を行ってください。');
			return;
		}

		if (!confirm('このデータを削除しますか？')) return;

		document.p2.io_mode.value = "2";
		document.p2.submit();
	} else {
		if (!confirm('このデータを修正・登録しますか？')) return;

		if (document.p2.chk_data_info_allday.checked) {
			document.p2.data_info_sdate.value = document.p2.data_info_sdate_normal.value;
			document.p2.data_info_edate.value = document.p2.data_info_edate_normal.value;
		} else {
			document.p2.data_info_sdate.value = document.p2.data_info_sdate_ext.value;
			document.p2.data_info_edate.value = document.p2.data_info_edate_ext.value;
		}

		share_user_set();

		if (sch_edit_check()) {
			document.p2.io_mode.value = "1";
			document.p2.submit();
		}
	}
}

function sch_edit_check()
{
	if (document.p2.data_info_title.value == '') {
		alert('タイトルを必ず入力してください');
		return false;
	}

	if (document.p2.data_info_sdate.value == '') {
		alert('開始日を必ず入力してください');
		return false;
	}

	if (document.p2.data_info_edate.value == '') {
		alert('終了日を必ず入力してください');
		return false;
	}

	sdate = new Date(document.p2.data_info_sdate.value);
	edate = new Date(document.p2.data_info_edate.value);

	if (sdate > edate) {
		alert('開始日が終了日より大きく設定されています');
		return false;
	}

	return true;
}

//----- 2story todo view use ------
function todo_view_change(view_mode)
{
	document.p1.view_mode.value = view_mode;
	document.p1.action = 'content_ctrl.php';
	document.p1.submit();
}

//----- 2story todo edit use ------
function todo_edit_init()
{
	chkControl_set("chk_data_info_completion", document.p2.data_info_completion.value);

	chkControl_set("chk_data_info_alert", document.p2.data_info_alert.value);

	document.p2.data_info_edate.value = document.p2.data_info_sdate.value;

	document.p2.data_info_allday.value = "1";

	ymdControl_set("data_info_sdate", document.p2.data_info_sdate.value);

	if (document.p2.chk_data_info_all_cupple)
		chkControl_set("chk_data_info_all_cupple", document.p2.data_info_all_cupple.value);

	if (document.p2.chk_data_info_all_member)
		chkControl_set("chk_data_info_all_member", document.p2.data_info_all_member.value);
}

function todo_edit_update(io_mode)
{
	if (io_mode == 2) {
		if (document.p2.data_info_id.value == 0) {
			alert('新規データは削除できません。一度登録を行ってください。');
			return;
		}

		if (!confirm('このデータを削除しますか？')) return;

		document.p2.io_mode.value = "2";
		document.p2.submit();
	} else {
		if (!confirm('このデータを修正・登録しますか？')) return;

		document.p2.data_info_edate.value = document.p2.data_info_sdate.value;

		share_user_set();

		if (todo_edit_check()) {
			document.p2.io_mode.value = "1";
			document.p2.submit();
		}
	}
}

function todo_edit_check()
{
	if (document.p2.data_info_title.value == '') {
		alert('タイトルを必ず入力してください');
		return false;
	}

	return true;
}

//----- 2story finding2 view use ------
function finding2_init()
{
	cmbControl_set("search_mode", document.p1.search_mode.value);

	ymdControl_set("search_sdate", document.p1.search_sdate.value);
	ymdControl_set("search_edate", document.p1.search_edate.value);
}

function cupple_finding2_init()
{
	ymdControl_set("search_sdate", document.p1.search_sdate.value);
	ymdControl_set("search_edate", document.p1.search_edate.value);
}

//----- 2story share user list use ------
function share_user_add(target, option_value, option_lbl)
{
	if (!document.createElement) return;

	//-----
	if (target == '')
		doc = document;
	else
		doc = window.opener.document;

	//-----
	for (i=0; i < doc.p2.sharelist.length; i++) {
		if (doc.p2.sharelist.options[i].value == option_value) return;
	}

	//-----
	var opt = doc.createElement("option");
	opt.value = option_value;
	var label = doc.createTextNode(option_lbl);
	opt.appendChild(label);

	doc.p2.sharelist.appendChild(opt);

	//-----
	//if (target != '') window.close();
}

function share_user_multi_add()
{
	if (!document.p1.uid) return;

	if (!document.p1.uid.length) {
		var val = document.p1.uid.value;
		var split_val = val.split(';');

		if (document.p1.uid.checked)
			share_user_add('opener', split_val[0], split_val[1]);
	} else {
		for(var i = 0;i < document.p1.uid.length; i++) {
			var val = document.p1.uid[i].value;
			var split_val = val.split(';');

			if (document.p1.uid[i].checked)
				share_user_add('opener', split_val[0], split_val[1]);
		}
	}

	window.close();
}

function share_user_multi_check(val)
{
	if (!document.p1.uid) return;

	for(var i = 0;i < document.p1.uid.length; i++) {
		document.p1.uid[i].checked = val;
	}
}

function share_user_remove()
{
	if (document.p2.sharelist.selectedIndex < 0) return;

	var idx = document.p2.sharelist.selectedIndex;
	document.p2.sharelist.options[idx] = null;
}

function share_user_set()
{
	if (!document.p2.sharelist) return;

	user = '';

	for (i=0; i < document.p2.sharelist.length; i++) {
		user += ',' + document.p2.sharelist.options[i].value;
	}

	if (user.length > 0)
		document.p2.shareuser.value = user.substring(1, user.length);
	else
		document.p2.shareuser.value = '';
}

function share_list_view()
{
	if (get_ctrl_object('chk_data_info_all_member') != null) {
		chkControl_change('chk_data_info_all_member', 'data_info_all_member');
		all_member_checked = get_ctrl_object('chk_data_info_all_member').checked;
	} else {
		all_member_checked = false;
	}

	if (get_ctrl_object('chk_data_info_all_cupple') != null) {
		chkControl_change('chk_data_info_all_cupple', 'data_info_all_cupple');
		all_cupple_checked = get_ctrl_object('chk_data_info_all_cupple').checked;
	} else {
		all_cupple_checked = false;
	}

	checked = all_member_checked || all_cupple_checked;

	if (checked) {
		showHideLayers('L_sharelist', 'hide');
	} else {
		showHideLayers('L_sharelist', 'show');
	}
}

//----- 2story mail list/input use ------
function mail_update_call(mode)
{
	//-----
	// 1: to trash
	// 2: to save box
	// 3: to inbox
	// 4: trash empty
	// 5: 実削除
	// 6: データ本体のステータスを「削除」にする
	//-----

	if (mode == 1)
		if (!confirm('このデータを削除しますか？')) return;

	if (mode == 4)
		if (!confirm('ごみ箱を空にしますか？')) return;

	if (mode == 5)
		if (!confirm('選択したデータを削除しますか？')) return;

	if (mode == 6)
		if (!confirm('選択したデータを削除しますか？')) return;

	document.p1.update_mode.value = mode;

	document.p1.action = "mail_update.php";

	document.p1.method = "post";

	document.p1.submit();
}

function mail_move_page(page, sel_content)
{
	if (page < 0) return;

	document.p1.sel_content.value = sel_content;
	document.p1.sel_page.value = page;
	document.p1.action = 'content_ctrl.php';
	document.p1.submit();
}

function mail_replay()
{
	document.p2.info_id.value = 0;
	document.p2.mail_mode.value = 1;
	document.p2.action = "input_ctrl.php";
	document.p2.method = "post";
	document.p2.submit();
}

function mail_forward()
{
	document.p2.info_id.value = 0;
	document.p2.mail_mode.value = 2;
	document.p2.action = "input_ctrl.php";
	document.p2.method = "post";
	document.p2.submit();
}

function mail_resend()
{
	document.p2.info_id.value = 0;
	document.p2.mail_mode.value = "3";
	document.p2.action = "input_ctrl.php";
	document.p2.method = "post";
	document.p2.submit();
}

function mail_edit_update(io_mode, status)
{
	switch (io_mode) {
	case 1:
		share_user_set();

		if (mail_edit_check()) {
			document.p2.io_mode.value = "1";
			document.p2.data_info_status.value = status;
			document.p2.submit();
		}
		break;

	case 2:
		if (!confirm('このデータを削除しますか？')) {
			return;
		} else {
			document.p2.io_mode.value = "2";
			document.p2.submit();
		}
		break;
	}
}

function mail_edit_check()
{
	if (document.p2.data_info_title.value == '') {
		alert('タイトルを必ず入力してください');
		return false;
	}

	if (document.p2.sharelist) {
		if (document.p2.sharelist.length == 0) {
			alert('宛先を必ず指定してください');
			return false;
		}
	} else {
		if (document.p2.data_info_all_cupple.value == 0 && document.p2.data_info_all_member.value == 0) {
			alert('宛先を必ず指定してください');
			return false;
		}
	}

	return true;
}

function mail_edit_init()
{
	if (document.p2.chk_data_info_all_cupple)
		chkControl_set("chk_data_info_all_cupple", document.p2.data_info_all_cupple.value);

	if (document.p2.chk_data_info_all_member)
		chkControl_set("chk_data_info_all_member", document.p2.data_info_all_member.value);
}

function mail_input_call(info_id)
{
	document.p1.info_id.value = info_id;
	document.p1.action = "input_ctrl.php";

	if (document.p1.ret_content) document.p1.ret_content.value = "";

	document.p1.submit();
}


//----- 2story celeb-mail send ------
function celeb_mail_send()
{
	if (celeb_mail_send_check()) {
		if (!confirm('お祝いのメッセージを送信しますか？')) return;

		document.p2.submit();
	}

}

function celeb_mail_send_check()
{
	if (document.p2.data_info_title.value == '') {
		alert('タイトルを必ず選択してください');
		return false;
	}

	if (document.p2.shareuser.value == '') {
		alert('宛先を必ず選択してください');
		return false;
	}

	if (document.p2.data_info_from_user_name.value == '') {
		alert('あなたの名前を必ず入力してください');
		return false;
	}

	if (document.p2.data_info_content.value == '') {
		alert('メッセージを必ず入力してください');
		return false;
	}

	return true;
}

function celeb_to_addr_click()
{
	document.p2.shareuser.value = "";

	if (document.p2.check_bridegroom.checked)
		document.p2.shareuser.value += document.p2.check_bridegroom.value;

	if (document.p2.check_bride.checked)
		if (document.p2.shareuser.value == '')
			document.p2.shareuser.value += document.p2.check_bride.value;
		else
			document.p2.shareuser.value += ',' + document.p2.check_bride.value;
}

//----- 2story file upload -----
function file_up_send()
{
	document.p10.submit();
}

function file_view(dmt, dui, fui, dfn, dkey)
{
	document.p1.dmt.value = dmt;
	document.p1.dui.value = dui;
	document.p1.fui.value = fui;
	document.p1.dfn.value = dfn;
	document.p1.dkey.value = dkey;

	document.p1.submit();
}

function file_remove(fno)
{
	document.p2.up_mode.value = 'remove';
	document.p2.fno.value = fno;

	document.p2.submit();
}

//----- 2story album -----
function album_input_call(info_id, sel_page)
{
	document.p1.info_id.value = info_id;
	document.p1.sel_page.value = sel_page;

	document.p1.action = "input_ctrl.php";

	if (document.p1.ret_content) document.p1.ret_content.value = "";

	document.p1.submit();
}

function album_edit_update(io_mode)
{
	if (io_mode == 2) {
		if (!confirm('このデータを削除しますか？')) {
			return;
		} else {
			document.p2.io_mode.value = "2";
			document.p2.submit();
		}
	} else {
		if (album_edit_check()) {
			document.p2.io_mode.value = "1";
			document.p2.submit();
		}
	}
}

function album_edit_check()
{
	if (document.p2.data_info_title.value == '') {
		alert('タイトルを必ず入力してください');
		return false;
	}

	return true;
}

function album_view_change(sel_page, sel_content)
{
	document.p1.sel_page.value = sel_page;
	document.p1.sel_content.value = sel_content;

	document.p1.action = 'content_ctrl.php';
	document.p1.submit();
}

//----- 2story board -----
function board_input_call(info_id, parent_info_id)
{
	document.p1.info_id.value = info_id;
	document.p1.parent_info_id.value = parent_info_id;

	document.p1.action = "input_ctrl.php";

	if (document.p1.ret_content) document.p1.ret_content.value = "";

	document.p1.submit();
}

function board_edit_update(io_mode)
{
	if (io_mode == 2) {
		if (!confirm('このデータを削除しますか？\nこのデータに対する返信は全て削除されます')) {
			return;
		} else {
			document.p2.io_mode.value = "2";

			if (eval(document.p2.data_info_parent_id.value) == 0) {
				document.p2.sel_content.value = '2story_board';
			} else {
				document.p2.sel_content.value = '2story_board_detail';
			}

			document.p2.submit();
		}
	} else {
		if (board_edit_check()) {
			if (confirm('メッセージを投稿しますか？')) {
				document.p2.io_mode.value = "1";
				document.p2.submit();
			}
		}
	}
}

function board_edit_check()
{
	if (document.p2.data_info_title.value == '') {
		alert('タイトルを必ず入力してください');
		return false;
	}

	if (document.p2.data_info_content.value == '') {
		alert('内容を必ず入力してください');
		return false;
	}

	if (document.p2.data_info_from_user_name.value == '') {
		alert('貴方のお名前を必ず入力してください');
		return false;
	}

	return true;
}

function board_page_reset()
{
	document.p1.sel_page.value = 0;
}

function board_view_change(info_id, sel_content)
{
	document.p1.board_top_id.value = info_id;
	document.p1.sel_content.value = sel_content;

	document.p1.action = 'content_ctrl.php';
	document.p1.submit();
}

function board_move_page(board_info_id)
{
	if (board_info_id == 0) return;

	document.p1.board_info_id.value = board_info_id;

	document.p1.action = 'content_ctrl.php';
	document.p1.submit();
}

//----- 2story blog -----
function blog_input_call(info_id, view_mode)
{
	document.p1.info_id.value = info_id;
	document.p1.view_mode.value = view_mode;

	document.p1.action = "input_ctrl.php";

	document.p1.submit();
}

function blog_setting_init()
{
	cmbControl_set("blog_setting_page_article", document.p2.db_blog_setting_page_article.value);

	if (document.p2.db_blog_setting_title_view)
		cmbControl_set("blog_setting_title_view", document.p2.db_blog_setting_title_view.value);

	if (document.p2.db_blog_setting_comment_view)
		cmbControl_set("blog_setting_comment_view", document.p2.db_blog_setting_comment_view.value);

	if (document.p2.db_blog_setting_logo_view)
		cmbControl_set("blog_setting_logo_view", document.p2.db_blog_setting_logo_view.value);

	if (document.p2.db_blog_setting_link_view)
		cmbControl_set("blog_setting_link_view", document.p2.db_blog_setting_link_view.value);

	if (document.p2.db_blog_setting_info_view)
		cmbControl_set("blog_setting_info_view", document.p2.db_blog_setting_info_view.value);

	if (document.p2.db_blog_setting_new_entry)
		cmbControl_set("blog_setting_new_entry", document.p2.db_blog_setting_new_entry.value);

	if (document.p2.db_blog_setting_new_entry_view)
		cmbControl_set("blog_setting_new_entry_view", document.p2.db_blog_setting_new_entry_view.value);

	if (document.p2.db_blog_setting_approval)
		cmbControl_set("blog_setting_approval", document.p2.db_blog_setting_approval.value);

	if (document.p2.db_blog_setting_imgup)
		cmbControl_set("blog_setting_imgup", document.p2.db_blog_setting_imgup.value);

	cmbControl_set("blog_setting_category_view", document.p2.db_blog_setting_category_view.value);
	cmbControl_set("blog_setting_period_view", document.p2.db_blog_setting_period_view.value);
	cmbControl_set("blog_setting_period", document.p2.db_blog_setting_period.value);
	cmbControl_set("blog_setting_new_comment_view", document.p2.db_blog_setting_new_comment_view.value);
	cmbControl_set("blog_setting_new_comment", document.p2.db_blog_setting_new_comment.value);
	cmbControl_set("blog_setting_new_comment", document.p2.db_blog_setting_new_comment.value);
	cmbControl_set("blog_setting_comment_approval", document.p2.db_blog_setting_comment_approval.value);
}

function blog_setting_update(io_mode)
{
	if (blog_setting_check()) {
		document.p2.io_mode.value = io_mode;
		document.p2.action = 'blog_setting_update.php';
		document.p2.submit();
	}
}

function blog_setting_check()
{
	if (document.p2.blog_setting_title.value == '') {
		alert('タイトルを必ず入力してください');
		return false;
	}

	return true;
}

function blog_edit_init()
{
	cmbControl_set("data_info_category", document.p2.db_data_info_category.value);

	ymdControl_setExt("data_info_create_date", document.p2.data_info_create_date.value);

	cmbControl_set("photo_align", document.p2.db_photo_align.value);

	cmbControl_set("photo_size", document.p2.db_photo_size.value);
}

function blog_edit_update(io_mode)
{
	if (io_mode == 2) {
		if (!confirm('この記事を削除しますか？\nこの記事に対するコメントも全て削除されます')) {
			return;
		} else {
			document.p2.io_mode.value = io_mode;
			//document.p2.action = 'data_update.php';
			document.p2.submit();
		}
	} else {
		share_user_set();

		if (blog_edit_check()) {
			document.p2.io_mode.value = io_mode;
			//document.p2.action = 'data_update.php';
			document.p2.submit();
		}
	}
}

function blog_edit_check()
{
	if (document.p2.data_info_title.value == '') {
		alert('タイトルを必ず入力してください');
		return false;
	}

	if (document.p2.shareuser) {
		if (document.p2.data_info_status.value == '0') {
			if (document.p2.shareuser.value == '') {
				alert('投稿先を必ず指定してください');
				return false;
			}
		}
	}

	if (document.p2.data_info_category) {
		if (document.p2.data_info_category.selectedIndex == 0) {
			if (document.p2.data_info_key.value == "9" || document.p2.data_info_key.value == "90") {
				alert('カテゴリを必ず指定してください');
			} else {
				alert('カテゴリーを必ず指定してください');
			}
			return false;
		}
	}

	return true;
}

function blog_move_page(page)
{
	document.p1.sel_page.value = page;

	if (document.p1.gid)
		if (document.p1.gid.value == '3') {
			document.p1.action = 'nick_blog.php';
		} else {
			document.p1.action = 'hall_blog.php';
		}
	else
		document.p1.action = 'content_ctrl.php';

	document.p1.submit();
}

function blog_comment_update(row, io_mode, info_id)
{
	switch (io_mode) {
	case 1:
		if (document.p1) {
			switch (document.p1.sel_content.value) {
				case '2story_hall_blog_approve':
				case '2story_hall_blog_save':
				case '2story_nick_blog_approve':
				case '2story_nick_blog_save':
				case '2story_recommend_approve':
				case '2story_recommend_save':
					alert('記事が公開されないとコメントは投稿できません');
					return;
					break;
			}
		}

		if (blog_comment_send_check(row)) {
			document.p2.data_comment_id.value = info_id;
			document.p2.io_mode.value = io_mode;

			document.p2.data_comment_parent_id.value = document.p_comment[row].data_comment_parent_id.value;
			document.p2.data_comment_from_user_name.value = document.p_comment[row].data_comment_from_user_name.value;
			document.p2.data_comment_text.value = document.p_comment[row].data_comment_text.value;

			document.p2.submit();
		}
		break;

	case 2:
		if (!confirm('このコメントを削除しますか？')) return;

		document.p2.data_comment_id.value = info_id;
		document.p2.io_mode.value = io_mode;

		document.p2.submit();
		break;
	}
		
}

function blog_comment_send_check(row)
{
	if (!confirm('コメントを投稿しますか？')) return false;

	if (document.p_comment[row].data_comment_from_user_name.value == '') {
		alert('名前を必ず入力してください');
		return false;
	}

	if (document.p_comment[row].data_comment_text.value == '') {
		alert('コメント本文を必ず入力してください');
		return false;
	}

	return true;
}

function blog_category_search(category)
{
	document.p1.sel_category.value = category;
	document.p1.sel_period.value = '';
	document.p1.sel_comment.value = '';
	document.p1.sel_date.value = '';
	document.p1.sel_page.value = '';

	if (document.p1.gid)
		if (document.p1.gid.value == '3') {
			document.p1.action = 'nick_blog.php';
		} else {
			document.p1.action = 'hall_blog.php';
		}
	else
		document.p1.action = 'content_ctrl.php';

	document.p1.submit();
}

function blog_period_search(period)
{
	document.p1.sel_category.value = '';
	document.p1.sel_period.value = period;
	document.p1.sel_comment.value = '';
	document.p1.sel_date.value = '';
	document.p1.sel_page.value = '';

	document.p1.sel_calender.value = period;

	if (document.p1.gid)
		if (document.p1.gid.value == '3') {
			document.p1.action = 'nick_blog.php';
		} else {
			document.p1.action = 'hall_blog.php';
		}
	else
		document.p1.action = 'content_ctrl.php';

	document.p1.submit();
}

function blog_comment_search(info_id)
{
	document.p1.sel_category.value = '';
	document.p1.sel_period.value = '';
	document.p1.sel_comment.value = info_id;
	document.p1.sel_date.value = '';
	document.p1.sel_page.value = '';

	if (document.p1.gid)
		if (document.p1.gid.value == '3') {
			document.p1.action = 'nick_blog.php';
		} else {
			document.p1.action = 'hall_blog.php';
		}
	else
		document.p1.action = 'content_ctrl.php';

	document.p1.submit();
}

function blog_date_search(sel_date)
{
	document.p1.sel_category.value = '';
	document.p1.sel_period.value = '';
	document.p1.sel_comment.value = '';
	document.p1.sel_date.value = sel_date;
	document.p1.sel_page.value = '';

	if (document.p1.gid)
		if (document.p1.gid.value == '3') {
			document.p1.action = 'nick_blog.php';
		} else {
			document.p1.action = 'hall_blog.php';
		}
	else
		document.p1.action = 'content_ctrl.php';

	document.p1.submit();
}

function blog_calender_move(ym)
{
	document.p1.sel_calender.value = ym;

	if (document.p1.gid)
		if (document.p1.gid.value == '3') {
			document.p1.action = 'nick_blog.php';
		} else {
			document.p1.action = 'hall_blog.php';
		}
	else
		document.p1.action = 'content_ctrl.php';

	document.p1.submit();
}

function recommend_cupple_change(target, cupple_id)
{
	//-----
	if (target == '')
		doc = document;
	else
		doc = window.opener.document;

	//-----
	doc.p1.cupple_info_id.value = cupple_id;
	doc.p1.sel_page.value = '';
	doc.p1.sel_category.value = '';
	doc.p1.sel_period.value = '';
	doc.p1.sel_comment.value = '';

	doc.p1.submit();

	//-----
	if (target != '') window.close();
}

//----- setting -----
function user_manage_input_call(info_id)
{
	document.p1.info_id.value = info_id;
	document.p1.action = "input_ctrl.php";

	if (document.p1.ret_content) document.p1.ret_content.value = "";

	document.p1.submit();
}

function user_manage_edit_init()
{
	cmbControl_set("grp_user_info_secure", document.p2.db_grp_user_info_secure.value);
}

function user_manage_edit_update(io_mode)
{
	if (io_mode == 2) {
		if (!confirm('このデータを削除しますか？')) {
			return;
		} else {
			document.p2.io_mode.value = "2";
			document.p2.submit();
		}
	} else {
		if (user_manage_edit_check()) {
			document.p2.io_mode.value = "1";
			document.p2.submit();
		}
	}
}

function user_manage_edit_check()
{
	if (document.p2.user_info_last_name_furi.value == '') {
		alert('姓・ふりがなを必ず入力してください');
		return false;
	}

	if (document.p2.user_info_first_name_furi.value == '') {
		alert('名・ふりがなを必ず入力してください');
		return false;
	}

	if (document.p2.user_info_last_name.value == '') {
		alert('姓・漢字を必ず入力してください');
		return false;
	}

	if (document.p2.user_info_first_name.value == '') {
		alert('名・漢字を必ず入力してください');
		return false;
	}

	if (document.p2.user_info_login_id.value == '') {
		alert('ユーザIDを必ず入力してください');
		return false;
	}

/*
	if (document.p2.user_info_password.value == '') {
		alert('パスワードを必ず入力してください');
		return false;
	}
*/

	return true;
}

function banner_manage_edit_update(io_mode)
{
	if (io_mode == 2) {
		if (!confirm('このデータを削除しますか？')) {
			return;
		} else {
			document.p2.io_mode.value = "2";
			document.p2.submit();
		}
	} else {
		document.p2.io_mode.value = "1";
		document.p2.submit();
	}
}

function cupple_manage_input_call(info_id)
{
	document.p1.info_id.value = info_id;
	document.p1.action = "input_ctrl.php";

	if (document.p1.ret_content) document.p1.ret_content.value = "";

	document.p1.submit();
}

/* -- add 080609 -- */
function blog_good_update(info_id)
{
	//if (!confirm('この記事に投票しますか？')) return;

	document.p2.data_comment_id.value = info_id;

	document.p2.action = '/2story/blog_good_update.php'

	document.p2.submit();		
}

