// JavaScript Document

/////////////////////////////////////
// 汎用確認メッセージ
/////////////////////////////////////
function ConfirmMsg(msg){
	return (confirm(msg))?true:false;
}

/////////////////////////////////////////////////////////////////////////////////
// 未入力及び不正入力のチェック（※Safariのバグ（エスケープ文字認識）を回避）
/////////////////////////////////////////////////////////////////////////////////
function inputChk(f,confirm_flg){

	// フラグの初期化
	var flg = false;
	var error_mes = "錯誤警告\r\n輸入錯誤!請確定輸入正確!\r\n";

	// 未入力と不正入力のチェック
	
	if(f.action.value == "confirm"){
		
		if(!f.plan[0].checked && !f.plan[1].checked){
			error_mes += "・請選擇申請計劃!\r\n";flg = true;
		}
		/*
		if(!f.support[0].checked && !f.support[1].checked && !f.support[2].checked){
			error_mes += "・請選擇支持計劃!\r\n";flg = true;
		}
		*/
	
	}
	if(!f.name.value){
		error_mes += "・請輸入姓名!\r\n";flg = true;
	}
	
	if(!f.address.value){
		error_mes += "・請輸入地址!\r\n";flg = true;
	}
	
	if(!f.tel.value){
		error_mes += "・請輸入聯絡電話!\r\n";flg = true;
	}
	
	if(!f.email.value){
		error_mes += "・請輸入E-Mail!\r\n";flg = true;
	}
	else if(!f.email.value.match(/^[^@]+@[^.]+\..+/)){
		error_mes += "・E-Mail格式錯誤!\r\n";flg = true;
	}
	
	if(!f.k1_m.value || !f.k1_d.value || !f.k1_h.value || !f.k1_b.value){
		error_mes += "・請選擇洽談日期和時間!\r\n";flg = true;
	}
	
	/*
	if(!f.comment.value){
		error_mes += "・請輸入內容!\r\n";flg = true;
	}
	*/
	// 判定
	if(flg){
		// アラート表示して再入力を警告
		window.alert(error_mes);return false;
	}
	else{

		// 確認メッセージ
		if(confirm_flg){
			return ConfirmMsg('confirm to submit?');
		}
		return true;
	}


}


