﻿<!--
/*************************************************************************
	Utilites VALIDATION MEMBER function @2006-08-15
	Modified by : anankoong@hotmail.com
	function..




*************************************************************************/

	var _lbl = new Array();
	
	_lbl[0] =  "ログインID（e-mail）";
	_lbl[1] =  "ログインパスワード";
	_lbl[2] =  "ニックネーム";
	_lbl[3] =  "氏名（漢字）";
	_lbl[4] =  "生年月日";
	_lbl[5] =  "性別";
	_lbl[6] =  "職業";
	_lbl[7] =  "パスワードを忘れた時の秘密の質問";
	_lbl[8] =  "その答え";
	_lbl[9] =  "現住所郵便番号";
	_lbl[10] =  "現住所";
	_lbl[11] =  "連絡先電話番号";
	_lbl[12] =  "興味のあるもの";
	_lbl[13] =  "アジスト メルマガ";
	_lbl[14] =  "アジスト インフォメール";
	_lbl[15] =  "利用規約 ";

	function isEmail( strValue) {
		var objRegExp  = /(^[a-zA-Z0-9]([a-zA-Z0-9_\.\-]*)@([a-zA-Z_\.\-]*)([.][a-zA-Z0-9]{3})$)|(^[a-zA-Z]([a-zA-Z0-9_\.\-]*)@([a-zA-Z0-9_\.\-]*)(\.[a-zA-Z0-9]*)(\.[a-zA-Z]*)*$)/i;
		
		return objRegExp.test(strValue);
	}//isEmail
	
	function validate2(){
	    if(!isEmail(str)){
	         return false;
        }
	    return true;
	}//validate2
	
	function echeck(str) {
	
			var at="@"
			var dot="."
			var lat=str.indexOf(at)
			var lstr=str.length
			var ldot=str.indexOf(dot)
			
			//alert(lstr+","+lat+","+ldot);
			
			if(lat > 25 || (lstr - lat) > 25 )
			{
				return false
			
			}
			
			if (str.indexOf(at)==-1){
			   //alert("Invalid E-mail ID")
			   return false
			}
	
			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			   //alert("Invalid E-mail ID")
			   return false
			}
	
			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			    //alert("Invalid E-mail ID")
			    return false
			}
	
			 if (str.indexOf(at,(lat+1))!=-1){
			    //alert("Invalid E-mail ID")
			    return false
			 }
	
			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			    //alert("Invalid E-mail ID")
			    return false
			 }
	
			 if (str.indexOf(dot,(lat+2))==-1){
			    //alert("Invalid E-mail ID")
			    return false
			 }
			
			 if (str.indexOf(" ")!=-1){
			    //alert("Invalid E-mail ID")
			    return false
			 }
	
	 		 return true					
	}//echeck
	
	function checkSearch(){
		objs = eval("document.fS");
		if(objs.key.value == ""){
			alert("店舗名を入力してください");
			objs.key.focus();
			return false;
		}else{
			objs.submit();	
		}
	}//checkSearch
	
	
	function validEmailEnter(){
		objs = eval("document.fE");
		if(objs._email.value == ""){
			alert("Ｅ－メールアドレスを入力してください。");
			objs._email.focus();
			return false;	
		
		}else if(echeck(objs._email.value)==false ||!isEmail( objs._email.value) ){
			alert("Ｅ－メールアドレスが正しくありません。");
			
			objs._email.focus();
			
			return false;					
		}else if(!emailvalidation(objs._email) ){
		
			alert("Ｅ－メールアドレスが正しくありません。");
			objs._email.focus();
			return false;
		}else{
			objs.submit();
		}
	}//validEmailEnter
	
	function emailvalidation(entered) {
		with (entered)	{
			apos=value.indexOf("@"); 
			dotpos=value.lastIndexOf(".");
			lastpos=value.length-1;
			if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 	{	
				//if (alertbox) {alert(alertbox);} 
				return 0;
			}else {return 1;}
		}
	}//emailvalidation


	function validMemberForm()	{
		var objs = eval("document.fR");
		
		
		//alert(doReverseString(objs.nickName.value));

		if(objs.email.value == "" || !emailvalidation(objs.email) || (objs.email.value != objs.reEmail.value) || (echeck(objs.email.value)==false) ||!isEmail( objs.email.value) ) {
			//var lbl_6 = document.getElementById("6");
			//var lbl_7 = document.getElementById("7");
			var lbl_0 = document.getElementById("0");
			
			if(objs.email.value == ""){
				lbl_0.innerHTML = "<font color=red>"+ _lbl[0] +"</font>";	
				objs.email.focus();	
				alert("Ｅ－メールアドレスを入力してください。");
			}else if((echeck(objs.email.value)==false) ||!isEmail( objs.email.value) ) {
				alert("Ｅ－メールアドレスが正しくありません。");
				lbl_0.innerHTML = "<font color=red>"+ _lbl[0] +"</font>";
				objs.email.focus();					
			}else if(!emailvalidation(objs.email))	{
				alert("Ｅ－メールアドレスが一致しません。");
				lbl_0.innerHTML = "<font color=red>"+ _lbl[0] +"</font>";
				objs.email.focus();		
			}else{
				alert("E-メールアドレスを確認してください。");
				lbl_0.innerHTML = "<font color=red>"+ _lbl[0] +"</font>";	
				objs.email.focus();	
			}
			return false;
			
		}else if(objs.nickName.value == "")	{
			var lbl_ = document.getElementById("2");
			

			alert(" 御希望のユーザー名入力してください。");
	
			lbl_.innerHTML = "<font color=red>"+ _lbl[2] +"</font>";
			objs.nickName.focus();
			
			return false;		
		
		}else if ((objs.password.value.length < 6) || objs.password.value == "" || objs.rePassword.value == "" || (objs.password.value != objs.rePassword.value)) {
			//alert(doReverseString(objs.password.value));
			var lbl_ = document.getElementById("1");
			var lbl_2 = document.getElementById("2");

			
			if(objs.password.value.length < 6)	{
				alert('6～12文字までのパスワード入力してください。');
				objs.password.focus();			
			}else if(objs.password.value == "")	{
				alert(_lbl[1] + " is Required.");
				objs.password.focus();
			}else if (objs.password.value != objs.rePassword.value){
				alert("パスワードを確認してください。");
				objs.password.focus();			
			}	
			lbl_.innerHTML = "<font color=red>"+ _lbl[1] +"</font>";

			return false;		
			
		}else if(objs.surName.value == "" || objs.firstName.value == "") {
			alert("氏名を入力してください。");
	
			lbl_.innerHTML = "<font color=red>"+ _lbl[3] +"</font>";
			
			if(objs.surName.value == "") {
				objs.surName.focus();
			}else{
				objs.firstName.focus();
			}
			
			return false;		
			
		}else if(objs.birthYear.value == "" || objs.birthMonth.value == "" ||objs.birthDay.value == ""){
			var lbl_4 = document.getElementById("4");
			alert("生年月日を正しく入力してください。");
	
			lbl_4.innerHTML = "<font color=red>"+ _lbl[4] +"</font>";
			
			
			return false;		
		
		}else if(objs.secret_question.value == "")	{
			var lbl_ = document.getElementById("7");
			alert("秘密の質問を指定してください。");
	
			lbl_.innerHTML = "<font color=red>"+ _lbl[7] +"</font>";
			objs.secret_question.focus();
			
			return false;		
		
		}else if(objs.secret_answer.value == ""){
			var lbl_ = document.getElementById("8");
			alert("秘密の質問の答えを入力してください。");
	
			lbl_.innerHTML = "<font color=red>"+ _lbl[8] +"</font>";
			objs.secret_answer.focus();
			
			return false;		
		
		}else if(objs.address.value.length > 1000){
			

			var lbl_10 = document.getElementById("10");
			alert("1000文字まで入力してください。");
	
			lbl_10.innerHTML = "<font color=red>"+ _lbl[10] +"</font>";
			objs.address.focus();
			
			return false;
			
		}else if(!objs.agreement.checked){
			var lbl_15 = document.getElementById("15");
		
			alert("  利用規約に同意してください。   ");		
			
			lbl_15.innerHTML = "<font color=red>"+ _lbl[15] +"</font>";
			objs.agreement.focus();
			
			return false;	
			
		}else{
			objs.submit();
		}
	}//validMemberForm
	
	function validObject(objs,objsLbl){
		if(objs.value != "")
		{
			var lblnickName = document.getElementById(objsLbl);							
			lblnickName.innerHTML = _lbl[objsLbl];
			
			//alert(objs.name);
			
			//if(objs.name == "secret_question")
				//objs.secret_answer.focus();

		}
	}//validObject
	
	function doReverseString(inputString){
	  // Function to reverse all characters in a string.
	  var newString = '';
	  for (var i=(inputString.length - 1); i>=0; i--) {
	    
	    for(var j=a;j<=z;j++)
	    {
	    		if(inputString.charAt(i) != j)
	  				return 0;  			
	    }
	  }
	}//doReverseString

//-->