function DoSubmit(obj){

	obj.ok.disabled = true;
	obj.ok.value = "しばらくお待ちください";

	obj.submit();
}

function submitStop(e){
// onkeydown="return submitStop(event);"

	if (!e){
		var e = window.event;
	}

	if(e.keyCode == 13){
		return false;
	}
}

function InputNumOnly(e) {
// style="ime-mode: disabled;" onkeydown="return InputNumOnly(event);"

	if (!e){
		var e = window.event;
	}

	if(e.keyCode == 13){
		return false;
	}
	var res = false;
	var code = e.keyCode;
	var m = String.fromCharCode(e.keyCode);

	if(code >= 0x30 && code <= 0x39 || code == 0xBE){
		res = true;
	}else if(code >= 0x60 && code <= 0x69 || code == 0x6E){
		res = true;
	}else if(code >= 0x2d && code <= 0x2e){
		res = true;
	}else if(code >= 0x25 && code <= 0x28){
		res = true;
	}
	else if("\b\r\t".indexOf(m, 0) >= 0){
		res = true;
	}
   return res;

}

function InputDateOnly(e) {
// style="ime-mode: disabled;" onkeydown="return InputDateOnly(event);"

	if (!e){
		var e = window.event;
	}

	if(e.keyCode == 13){
		return false;
	}
	var res = false;
	var code = e.keyCode;
	var m = String.fromCharCode(e.keyCode);

	if(code >= 0x30 && code <= 0x39 || code == 0xBF){
		res = true;
	}else if(code >= 0x60 && code <= 0x69 || code == 0x6F){
		res = true;
	}else if(code >= 0x2d && code <= 0x2e){
		res = true;
	}else if(code >= 0x25 && code <= 0x28){
		res = true;
	}
	else if("\b\r\t".indexOf(m, 0) >= 0){
		res = true;
	}
   return res;

}

function GetAddressFromPostCode(e)
{
    var org_action = document.f1.action;
    var org_target = document.f1.target;
    document.f1.action = 'getpost.php';
    document.f1.target = 'post_iframe';
    document.f1.submit();
    document.f1.action = org_action;
    document.f1.target = org_target;
}

function ContactInputCheck(){
	// 設定開始（チェックする項目を設定してください） 
	flag = 0;
	if(document.f1.name.value==""){ 
		alert("お名前を入力してください");
		document.f1.name.focus();
		flag = 1; 
	}
	else if(document.f1.email.value==""){ 
		alert("メールアドレスを入力してください");
		document.f1.email.focus();
		flag = 1; 
	}
	else if(!document.f1.email.value.match(/.+@.+\..+/)){ 
		alert("メールアドレスを正しく入力してください");
		document.f1.email.focus();
		flag = 1; 
	}
	else if(document.f1.comment.value==""){ 
		alert("内容を入力してください");
		document.f1.message.focus();
		flag = 1; 
	}
/*
	else if(document.f1.tel01.value==""){ 
		alert("電話番号を入力してください");
		document.f1.tel01.focus();
		flag = 1; 
	}
	else if(isNaN(document.f1.tel01.value)){ 
		alert("電話番号は半角数字で入力してください。");
		document.f1.tel01.focus();
		flag = 1; 
	}
	else if(document.f1.tel02.value==""){ 
		alert("電話番号を入力してください");
		document.f1.tel02.focus();
		flag = 1; 
	}
	else if(isNaN(document.f1.tel02.value)){ 
		alert("電話番号は半角数字で入力してください。");
		document.f1.tel02.focus();
		flag = 1; 
	}
	else if(document.f1.tel03.value==""){ 
		alert("電話番号を入力してください");
		document.f1.tel03.focus();
		flag = 1; 
	}
	else if(isNaN(document.f1.tel03.value)){ 
		alert("電話番号は半角数字で入力してください。");
		document.f1.tel03.focus();
		flag = 1; 
	}
*/
	if (flag == 0){
		DoSubmit(document.f1);
	}
}

function ConfirmBack(){
	document.f1.action="index.html";
	document.f1.method="post";
	DoSubmit(document.f1);
}

function ConfirmSubmit(){
	document.f1.action="finish.html";
	document.f1.method="post";
	DoSubmit(document.f1);
}

function MobileEmailCheck(val){
	var email_format = /^[\w\.\d\-_]+@([\w-]+\.)+[a-zA-Z]+$/;
	var ezweb = /\@ezweb\.ne\.jp$/;
	var vodafone = /\.vodafone\.ne\.jp$/;
	var docomo = /\@docomo\.ne\.jp$/;
	var softbank = /\@softbank\.ne\.jp$/;
	var iphone = /\@i\.softbank\.jp$/;
	var disney = /\@disney\.ne\.jp$/;
	var emnet = /\@emnet\.ne\.jp$/;
	var willcom = /\@willcom\.com$/;

	if(val == "" || ezweb.test(val) || vodafone.test(val) || softbank.test(val) || iphone.test(val) 
		|| disney.test(val) || docomo.test(val) || emnet.test(val) || willcom.test(val) || !email_format.test(val)){
		return true;
	}

	return false;
}

function RegistEmailCheck(){
	// 設定開始（チェックする項目を設定してください） 
	flag = 0;
	if(document.ff.regist.value==""){ 
		alert("メールアドレスを入力してください");
		document.ff.regist.focus();
		flag = 1; 
	}
	else if(!document.ff.regist.value.match(/.+@.+\..+/)){ 
		alert("メールアドレスを正しく入力してください");
		document.ff.regist.focus();
		flag = 1; 
	}
	else if(MobileEmailCheck(document.ff.regist.value) == false){
		alert("携帯のメールアドレスを入力してください");
		document.ff.regist.focus();
		flag = 1; 
	}
	if (flag == 0){
		DoSubmit(document.ff);
	}
	return false;
}

function RegistInputCheck(){
	// 設定開始（チェックする項目を設定してください） 
	flag = 0;
	if(document.f1.name.value==""){ 
		alert("お名前を入力してください");
		document.f1.name.focus();
		flag = 1; 
	}
	else if(document.f1.kana.value==""){ 
		alert("ひらがなを入力してください");
		document.f1.kana.focus();
		flag = 1; 
	}
	else if(document.f1.email.value==""){ 
		alert("メールアドレスを入力してください");
		document.f1.email.focus();
		flag = 1; 
	}
	else if(!document.f1.email.value.match(/.+@.+\..+/)){ 
		alert("メールアドレスを正しく入力してください");
		document.f1.email.focus();
		flag = 1; 
	}
	else if(MobileEmailCheck(document.f1.email.value) == false){
		alert("携帯のメールアドレスを入力してください");
		document.f1.email.focus();
		flag = 1; 
	}
	if (flag == 0){
		DoSubmit(document.f1);
	}
	return false;
}

function LogInCheck(){
	// 設定開始（チェックする項目を設定してください） 
	flag = 0;
	if(document.flog.email.value==""){ 
		alert("メールアドレスを入力してください");
		document.flog.email.focus();
		flag = 1; 
	}
	else if(document.flog.password.value==""){ 
		alert("パスワードを入力してください");
		document.flog.password.focus();
		flag = 1; 
	}
	if (flag == 0){
		DoSubmit(document.flog);
	}
	return false;
}

function AutoReload()
{
	var org_action = document.f1.action;
	var org_target = document.f1.target;
	document.f1.action = 'reload.html';
	document.f1.target = 'post_iframe';
	document.f1.submit();
	document.f1.action = org_action;
	document.f1.target = org_target;
}

