var emailformat=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
var mobileformat=/^[0-9]{8,11}$/;
function per_check(){
	if(document.form1.username.value==''){
		document.form1.username.focus();
		alert('ユーザー名を入力してください');
		return false;
	}
	if(document.form1.password.value==''){
		document.form1.password.focus();
		alert('パスワードを入力してください');
		return false;
	}
	if(document.form1.repass.value != document.form1.password.value){
		document.form1.repass.focus();
		alert('パスワードが一致しません');
		return false;
	}
	if(document.form1.name.value==''){
		document.form1.name.focus();
		alert('名前を入力してください');
		return false;
	}
	if(document.form1.birthday.value==''){
		document.form1.birthday.focus();
		alert('生年月日を入力してください');
		return false;
	}
	if(document.form1.peraddr.value==''){
		document.form1.peraddr.focus();
		alert('住所を入力してください');
		return false;
	}
	if(document.form1.mobile.value==''){
		document.form1.mobile.focus();
		alert('携帯番号を入力してください');
		return false;
	}
	if((!mobileformat.exec(document.form1.mobile.value)) && (document.form1.mobile.value!='')){
		document.form1.mobile.focus();
		alert('携帯番号を正しく入力してください');
		return false;
	}
}

function com_check(){
	if(document.form2.username.value==''){
		document.form2.username.focus();
		alert('ユーザー名を入力してください');
		return false;
	}
	if(document.form2.password.value==''){
		document.form2.password.focus();
		alert('パスワードを入力してください');
		return false;
	}
	if(document.form2.repass.value != document.form2.password.value){
		document.form2.repass.focus();
		alert('パスワードが一致しません');
		return false;
	}
	if(document.form2.comname.value==''){
		document.form2.comname.focus();
		alert('会社名称を入力してください');
		return false;
	}
	if(document.form2.comaddr.value==''){
		document.form2.comaddr.focus();
		alert('会社住所を入力してください');
		return false;
	}
	if(document.form2.tel.value==''){
		document.form2.tel.focus();
		alert('電話番号を入力してください');
		return false;
	}
	if(document.form2.email.value==''){
		document.form2.email.focus();
		alert('メールアドレスを入力してください');
		return false;
	}
	if((!emailformat.exec(document.form2.email.value)) && (document.form2.email.value!='')){
		document.form2.email.focus();
		alert('メールアドレスを正しく入力してください');
		return false;
	}
	if(document.form2.contname.value==''){
		document.form2.contname.focus();
		alert('担当者の名前を入力してください');
		return false;
	}
	if(document.form2.job.value==''){
		document.form2.job.focus();
		alert('担当者の役職を入力してください');
		return false;
	}
	if(document.form2.mobile.value==''){
		document.form2.mobile.focus();
		alert('担当者の携帯番号を入力してください');
		return false;
	}
	if((!mobileformat.exec(document.form2.mobile.value)) && (document.form2.mobile.value!='')){
		document.form2.mobile.focus();
		alert('担当者の携帯番号を正しく入力してください');
		return false;
	}
	if(document.form2.contemail.value==''){
		document.form2.contemail.focus();
		alert('担当者のメールアドレスを入力してください');
		return false;
	}
	if((!emailformat.exec(document.form2.contemail.value)) && (document.form2.contemail.value!='')){
		document.form2.contemail.focus();
		alert('担当者のメールアドレスを正しく入力してください');
		return false;
	}
	if(!document.form2.type[0].checked && !document.form2.type[1].checked && !document.form2.type[2].checked && !document.form2.type[3].checked){
		alert('会員種類を選択してください');
		return false;
	}
}

function username1_vali(){
	if(document.form1.username.value != ""){
		$.get("index.php?c=user&a=ajaxusername&n="+Math.random(),{username:document.form1.username.value},function(data){		
			if(data == '0'){
				alert("すでに同一のユーザ名が登録されています");
				document.form1.username.value="";
				document.form1.username.focus();
			}
		});
	}
}

function username2_vali(){
	if(document.form2.username.value != ""){
		$.get("index.php?c=user&a=ajaxusername&n="+Math.random(),{username:document.form2.username.value},function(data){		
			if(data == '0'){
				alert("すでに同一のユーザ名が登録されています");
				document.form2.username.value="";
				document.form2.username.focus();
			}
		});
	}
}

function faq_check(){
	if(document.form1.title.value==''){
		document.form1.title.focus();
		alert('请输入标题！');
		return false;
	}
	if(document.form1.content.value==''){
		document.form1.content.focus();
		alert('请输入内容！');
		return false;
	}
}

function resume_check(){
	
	if(document.form1.name.value==''){
		document.form1.name.focus();
		alert('请输入姓名！');
		return false;
	}
	if(document.form1.birthday.value==''){
		document.form1.birthday.focus();
		alert('请输入出生日期！');
		return false;
	}
	if(document.form1.email.value==''){
		document.form1.email.focus();
		alert('请输入电子邮件！');
		return false;
	}
	if((!emailformat.exec(document.form1.email.value)) && (document.form1.email.value!='')){
		document.form1.email.focus();
		alert('电子邮件格式不正确！');
		return false;
	}
	if(document.form1.mobile.value==''){
		document.form1.mobile.focus();
		alert('请输入手机号码！');
		return false;
	}
	if((!mobileformat.exec(document.form1.mobile.value)) && (document.form1.mobile.value!='')){
		document.form1.mobile.focus();
		alert('手机号格式不正确！');
		return false;
	}
}
