// 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.company.value){
		error_mes += "・Please input Company Name.\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. No.\r\n";flg = true;
	}

	if(!f.email.value){
		error_mes += "・Please input Email.\r\n";flg = true;
	}
	else if(!f.email.value.match(/^[^@]+@[^.]+\..+/)){
		error_mes += "・Email format error.\r\n";flg = true;
	}
	
	/*
	if(!f.comment.value){
		error_mes += "・Please input comment.\r\n";flg = true;
	}
	*/
	
	
	// 判定
	if(flg){
		// アラート表示して再入力を警告
		window.alert(error_mes);return false;
	}
	else{

		// 確認メッセージ
		if(confirm_flg){
			return ConfirmMsg('確定送出?');
		}
		return true;
	}


}


