// JavaScript Document

/////////////////////////////////////
// 汎用確認メッセージ
/////////////////////////////////////
function ConfirmMsg(msg){
	return (confirm(msg))?true:false;
}

/////////////////////////////////////////////////////////////////////////////////
// 未入力及び不正入力のチェック（※Safariのバグ（エスケープ文字認識）を回避）
/////////////////////////////////////////////////////////////////////////////////
function inputChk(f,confirm_flg){

	// フラグの初期化
	var flg = false;
	var error_mes = "Error Message\r\nInput Error!Please confirm the content input !\r\n";

	// 未入力と不正入力のチェック
	/*
	if(!f.select.value){
		error_mes += "・Please select Request.\r\n";flg = true;
	}
	*/
	
	if(!f.contact_title.value){
		error_mes += "* Please select Inquiry Project !\r\n";flg = true;
	}
	
	if(!f.name.value){
		error_mes += "* Please input Name !\r\n";flg = true;
	}
	
	/*
	if(!f.tel.value){
		error_mes += "* Please input Tel !\r\n";flg = true;
	}
	*/
	if(!f.email.value){
		error_mes += "* Please input E-Mail !\r\n";flg = true;
	}
	else if(!f.email.value.match(/^[^@]+@[^.]+\..+/)){
		error_mes += "* E-Mail format error !\r\n";flg = true;
	}
	
	if(!f.comment.value){
		error_mes += "* Please input Query !\r\n";flg = true;
	}
	
	// 判定
	if(flg){
		// アラート表示して再入力を警告
		window.alert(error_mes);return false;
	}
	else{

		// 確認メッセージ
		if(confirm_flg){
			return ConfirmMsg('Confirm to submit?');
		}
		return true;
	}


}

