﻿function Move_focus() {
	document.formjungum.incompany.focus();
}


function Check_onlyNumber() {
	if ((event.keyCode<48)||(event.keyCode>57)) {
		event.returnValue=false;
		//alert("Insert only numbers.");
		alert("数字のみ入力してください。");
	}
}


function Check_Email(CstrValue) { 
	emailEx1 = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/;
	//emailEx1 = /[^@]+@[A-Za-z0-9_-]+.[A-Za-z]+/;
	//emailEx2 = /[^@]+@[A-Za-z0-9_-]+.[A-Za-z0-9_-]+.[A-Za-z]+/;
	//emailEx3 = /[^@]+@[A-Za-z0-9_-]+.[A-Za-z0-9_-]+.[A-Za-z0-9_-]+.[A-Za-z]+/;

	if(emailEx1.test(CstrValue)) return true;;
	//if(emailEx2.test(CstrValue)) return true;
	//if(emailEx3.test(CstrValue)) return true;

	return false;
}

function Check_Input() {
  	var f = document.formjungum;
if(f.mode.value!='Edit') {	
	if(!f.inregnum1.value.length) {
		//alert("Insert the ID.");
		alert("IDを入力してください。");
		f.inregnum1.focus();
		return false;
	}
	
	
	
}	
	
	if(!f.inlicentcnt.value.length) {
		//alert("Insert number of licenses.");
		alert("ライセンス数を入力してください。");
		f.inlicentcnt.focus();
		return false;
	}
	if(!f.incompany.value.length) {
		//alert("Insert the name of the company.");
		alert("会社名を入力してください。");
		f.incompany.focus();
		return false;
	}
	if(!f.inceo.value.length) {
		//alert("Insert the representative.");
		alert("代表者を入力してください。");
		f.inceo.focus();
		return false;
	}

	if(!f.inaddress.value.length) {
		//alert("Insert the company's address.");
		alert("会社の住所を入力してください。");
		f.inaddress.focus();
		return false;
	}
	if(!f.inpurpose.value.length) {
		//alert("Insert the use of purpose.");
		alert("使用目的を入力してください。");
		f.inpurpose.focus();
		return false;
	}

if(f.mode.value!='Edit') {	
	if(!f.inagree.checked) {
		//alert("Agree to not use the JungUm Memopad commercially.");
		alert("商業的用途で使わないことに同意してください。");
		f.inagree.focus();
		return false;
	}
}
	
	if(!f.inusername.value.length) {
		//alert("Insert the name of the supervisor.");
		alert("担当者名を入力してください。");
		f.inusername.focus();
		return false;
	}
	if(!f.inuserpos.value.length) {
		//alert("Insert the supervisor's position.");
		alert("担当者の職位を入力してください。");
		f.inuserpos.focus();
		return false;
	}
	if(!f.inuseremail.value.length) {
		//alert("Insert the supervisor's e-mail address.");
		alert("担当者のメールアドレスを入力してください。");
		f.inuseremail.focus();
		return false;
	}
	
	if (!Check_Email(f.inuseremail.value)) { 
		//alert("The e-mail address is incorrect.");
		alert("メールアドレスが正確ではありません。");
		f.inuseremail.focus();
		return false;
	}
	if(!f.inusertel1.value.length) {
		//alert("Insert the supervisor's contact number.");
		alert("担当者の連絡先を入力してください。");
		f.inusertel1.focus();
		return false;
	}
	


		
	
	if(!f.inuserpwd1.value.length) {
		//alert("Insert the password.");
		alert("パスワードを入力してください。");
		f.inuserpwd1.focus();
		return false;
	}
	
	if(f.mode.value!='Edit') {
		if(!f.inuserpwd2.value.length) {
			//alert("Insert password confirmation.");
			alert("パスワードを確認してください。");
			f.inuserpwd2.focus();
			return false;
		}
		if(f.inuserpwd1.value!=f.inuserpwd2.value) {
			//alert("The password is incorrect.");
			alert("パスワードの確認に失敗しました。");
			f.inuserpwd2.focus();
	 		return false;
		}
	}


	f.submit();
}

