//---------------------------------------------------------------------------
// イベント掲示板新規投稿用
//---------------------------------------------------------------------------
<!--- START 2009.06.19 --->
function getTargetLastDay(year_wk, month_wk) {
	var feb_last_day = 28;
	if (year_wk % 100 != 0 && year_wk % 4 == 0) {
		feb_last_day = 29;
	}
	var last_day = 30;
	if (
					month_wk == 1
			 || month_wk == 3
			 || month_wk == 5
			 || month_wk == 7
			 || month_wk == 8
			 || month_wk == 10
			 || month_wk == 12
			) {
		last_day = 31;
	}
	else if (month_wk == 2) {
		last_day = feb_last_day;
	}
	
	return last_day;
}
<!--- END 2009.06.19 --->
function check_func(s_min, s_max) {

	if (document.regist_check_form.title.value == "") {
		alert("イベント名を入力してください。");
		document.regist_check_form.title.focus();
		return false;
	}
	if ((document.regist_check_form.period_start_y.value == "") || (document.regist_check_form.period_start_m.value == "") || (document.regist_check_form.period_start_d.value == "")) {
		alert("イベント開始日程を正しく設定してください。");
		return false;
	}
	if ((document.regist_check_form.period_end_y.value == "") || (document.regist_check_form.period_end_m.value == "") || (document.regist_check_form.period_end_d.value == "")) {
		alert("イベント終了日程を正しく設定してください。");
		return false;
	}
	<!--- START 2009.06.19 --->
	var start_last_day = getTargetLastDay(document.regist_check_form.period_start_y.value, document.regist_check_form.period_start_m.value);
	if (document.regist_check_form.period_start_d.value > start_last_day) {
		alert("イベント開始日程を正しく設定してください。");
		return false;
	}

	var end_last_day = getTargetLastDay(document.regist_check_form.period_end_y.value, document.regist_check_form.period_end_m.value);
	if (document.regist_check_form.period_end_d.value > end_last_day) {
		alert("イベント終了日程を正しく設定してください。");
		return false;
	}
	<!--- END 2009.06.19 --->
	var start_wk = document.regist_check_form.period_start_y.value + document.regist_check_form.period_start_m.value + document.regist_check_form.period_start_d.value;
	var end_wk   = document.regist_check_form.period_end_y.value + document.regist_check_form.period_end_m.value + document.regist_check_form.period_end_d.value;
	if (start_wk > end_wk) {
		alert("イベント終了日が、開始日より以前になっています。\nイベント終了日程を正しく設定してください。");
		return false;
	}
	var cate_wk;
	if(!document.regist_check_form.cate_id.length) {
		if (document.regist_check_form.cate_id.checked) {
			cate_wk = 1;
		}
	} else {
		for (i = 0; i < document.regist_check_form.cate_id.length; i++) {
			if (document.regist_check_form.cate_id[i].checked) {
				cate_wk = 1;
			}
		}
	}
	if(!cate_wk) {
		alert("カテゴリーを選択してください。");
		return false;
	}
	if (document.regist_check_form.title_sub.value == "") {
		alert("お誘いの一言を入力してください。");
		document.regist_check_form.title_sub.focus();
		return false;
	}
	if (document.regist_check_form.holding_time.value == "") {
		alert("時間を入力してください。");
		document.regist_check_form.holding_time.focus();
		return false;
	}
	if (document.regist_check_form.holding_place.value == "") {
		alert("場所を入力してください。");
		document.regist_check_form.holding_place.focus();
		return false;
	}
	if (document.regist_check_form.main_copy.value == "") {
		alert("紹介文章を入力してください。");
		document.regist_check_form.main_copy.focus();
		return false;
	}

	txt = document.regist_check_form.google_scale.value;
	if ((txt != "") && (txt.match(/[0-9]+/g) != txt)) {
		alert("「Google縮尺」は必ず半角数字で入力してください。");
		document.regist_check_form.google_scale.focus();
		return false;
	}
	if ((txt != "") && (txt < s_min || txt > s_max)) {
		alert("「Google縮尺」は " + s_min + "～" + s_max + " の値を入力してください。");
		document.regist_check_form.google_scale.focus();
		return false;
	}

	if (document.regist_check_form.contact_copy.value == "") {
		alert("連絡先を入力してください。");
		document.regist_check_form.contact_copy.focus();
		return false;
	}
	if (document.regist_check_form.add_name.value == "") {
		alert("登録者名を入力してください。");
		document.regist_check_form.add_name.focus();
		return false;
	}
	if (document.regist_check_form.mail_address.value == "") {
		alert("メールアドレスを入力してください。");
		document.regist_check_form.mail_address.focus();
		return false;
	} else if (!document.regist_check_form.mail_address.value.match(/^[A-Za-z0-9]+[\w-]+@[\w\.-]+\.\w{2,}$/)) {
		alert("メールアドレスの書式に誤りがあります。\nを正しく入力してください。");
		document.regist_check_form.mail_address.focus();
		return false;
	}
	txt = document.regist_check_form.event_pass.value;
	if ((txt == "") || (txt.match(/^[a-zA-Z0-9]+$/) != txt)) {
		alert("編集用パスワードを正しく入力してください。");
		document.regist_check_form.event_pass.focus();
		return false;
	}

}

function date_cng_func(type, str) {
	switch(type) {
		case 'year':	 document.regist_check_form.period_end_y.value = str; break;
		case 'month':	 document.regist_check_form.period_end_m.value = str; break;
		case 'day':	   document.regist_check_form.period_end_d.value = str; break;
	}
}


function enChange() {
	document.regist_check_form.google_keido.value = "";
	document.regist_check_form.google_ido.value = "";
	if (document.regist_check_form.entext.value != "") {
		if (document.regist_check_form.entext.value.substring(0,19) == "http://maps.google.") {
			a = document.regist_check_form.entext.value.split("&ll=");
			b = a[1].split(",");
			c = b[1].split("&");
			document.regist_check_form.google_keido.value = c[0];
			document.regist_check_form.google_ido.value = b[0];
		}
	}
}

