
//全体の入力チェック
function  check(the_form,registFlag,regUserCheckoutflag)
//registFlag  新規登録：１　　会員情報変更：0
//regUserCheckoutflag  チェックアウト：１　　Noチェックアウト：0
{	


	if (registFlag == 1)
	{
	   //会員IDのチェック	
	   if (Trim(the_form.userid.value)=="")
	   {
	     alert('会員IDが入力されていません。');
	     the_form.userid.focus();
	     return false;
	   }	
	      	
	   if (Trim(the_form.userid.value).length<4) 
	   {
	     alert("会員IDの桁数が正しくありません。") ; 
	     the_form.userid.focus(); 
	     return false;
	   }
	   
                 for(i=0;i<Trim(the_form.userid.value).length;i++){ 
                   if(char_test(Trim(the_form.userid.value).charAt(i))==0 && spchar_test(Trim(the_form.userid.value).charAt(i))==0) 
                   {
                      alert("会員IDには英数以外の文字が入っています。");
                      the_form.userid.focus(); 
                      return(false); 
                   }  	   
                 }
	   
	}
	
	
	if (regUserCheckoutflag == 0){
	  //パスワード取得
	  var pass1=the_form.password1.value;
	  var pass2=the_form.password2.value;		
	  //パスワードのチェック
	  if (Trim(pass1)=="")
	  {
	    alert('パスワードが入力されていません。');
	    the_form.password1.focus();
	    return false;
	  }	
		
	  if (Trim(pass1).length<4) 
	  {
	    alert("パスワードの桁数が正しくありません。") ; 
	    the_form.password1.focus(); 
	    return false;
	  }

                for(i=0;i<pass1.length;i++){ 
                   if(char_test(pass1.charAt(i))==0 && spchar_test(pass1.charAt(i))==0) 
                   {
                      alert("パスワードには英数以外の文字が入っています。");
                      the_form.password1.focus(); 
                      return(false); 
                   }  	   
                }
	 
	  if (Trim(pass2)=="")
	  {
	    alert('パスワードが入力されていません。');
	    the_form.password2.focus();
	    return false;
	  }	
		
	  if (Trim(pass2).length<4) 
	  {
	    alert("パスワードの桁数が正しくありません。") ; 
	    the_form.password2.focus(); 
	    return false;
	   }	 

                for(i=0;i<pass2.length;i++){ 
                   if(char_test(pass2.charAt(i))==0 && spchar_test(pass2.charAt(i))==0) 
                   {
                      alert("パスワードには英数以外の文字が入っています。");
                      the_form.password2.focus(); 
                      return(false); 
                   }  	   
                }
	 
	  if (pass1!=pass2)
	  {
	    alert("パスワードが一致しません。");
	    the_form.password2.focus(); 
	    return false 
	  }
	}
					
	//メールアドレスのチェック	
	if (! ismail(the_form.mailaddress1.value))
	{	
	  the_form.mailaddress1.focus();
	  return false ;
	}
	
	if (regUserCheckoutflag == 0){
	  if (! ismail(the_form.mailaddress2.value))
	  {
	    the_form.mailaddress2.focus();
	    return false ;
	  }
	  if (the_form.mailaddress1.value!=the_form.mailaddress2.value)
	  {
	    alert("メールアドレスが一致しません。");
	    the_form.mailaddress2.focus();		
	    return false 
	  }
	}


	
	//名前の姓のチェック
	if (Trim(the_form.username1.value)=="")
	{
	  alert('お名前が入力されていません。');
	  the_form.username1.focus();
	  return false;
	}
	//名前の名のチェック
	if (Trim(the_form.username2.value)=="")
	{
	  alert('お名前が入力されていません。');
	  the_form.username2.focus();
	  return false;
	}
	//名前のフリガナのチェック（姓）
	if (Trim(the_form.usernamekana1.value)=="") 
	{
	  alert('お名前のフリガナが入力されていません。');
	  the_form.usernamekana1.focus();
	  return false;
	}
	//名前のフリガナのチェック（名）						
	if (Trim(the_form.usernamekana2.value)=="") 
	{
	  alert('お名前のが入力されていません。');
	  the_form.usernamekana2.focus();
	  return false;
	}
	
	//年齢のチェック					
	if (Trim(the_form.age.value)=="") 
	{
	      alert('年齢が入力されていません。');
	      the_form.age.focus();
	      return false;
              }

              if (!isNumber(the_form.age.value))
	{
	      alert('年齢が正しくありません。');
	      the_form.age.focus();
	      return false;
              }
	
	//郵便番号のチェック（前）
	if (Trim(the_form.zipcode1.value) == "" )
	{
	  alert('郵便番号が入力されていません。');
	  the_form.zipcode1.focus();
	  return false;
	}	
	if (Trim(the_form.zipcode1.value).length!=3 )
	{
	  alert('郵便番号の桁数が正しくありません。');
	  the_form.zipcode1.focus();
	  return false;
	}
	
	if (!isNumber(the_form.zipcode1.value) )
	{
	  alert('郵便番号が正しくありません。');
	  the_form.zipcode1.focus();
	  return false;
	}	
	
	//郵便番号のチェック（後）
	if (Trim(the_form.zipcode2.value) == "" )
	{
	  alert('郵便番号が入力されていません。');
	  the_form.zipcode2.focus();
	  return false;
	}		
	if (Trim(the_form.zipcode2.value).length!=4)
	{
	  alert('郵便番号の桁数が正しくありません。');
	  the_form.zipcode2.focus();
	  return false;
	}
	
	if (!isNumber(the_form.zipcode2.value) )
	{
	  alert('郵便番号が正しくありません。');
	  the_form.zipcode2.focus();
	  return false;
	}
		
	//都道府県のチェック
	if ((the_form.address1.value=="都道府県") 
	   ||((Trim(the_form.address1.value) !="北海道") &&
                    (Trim(the_form.address1.value) !="青森県") &&	   
                    (Trim(the_form.address1.value) !="岩手県") &&	   
                    (Trim(the_form.address1.value) !="宮城県") &&	   
                    (Trim(the_form.address1.value) !="秋田県") &&	                        
                    (Trim(the_form.address1.value) !="山形県") &&	   
                    (Trim(the_form.address1.value) !="福島県") &&	   
                    (Trim(the_form.address1.value) !="茨城県") &&	   
                    (Trim(the_form.address1.value) !="栃木県") &&           
                    (Trim(the_form.address1.value) !="群馬県") &&	   
                    (Trim(the_form.address1.value) !="埼玉県") &&	   
                    (Trim(the_form.address1.value) !="千葉県") &&	   
                    (Trim(the_form.address1.value) !="東京都") &&	                        
                    (Trim(the_form.address1.value) !="神奈川県") &&	   
                    (Trim(the_form.address1.value) !="新潟県") &&	   
                    (Trim(the_form.address1.value) !="富山県") &&	   
                    (Trim(the_form.address1.value) !="石川県") &&  
                    (Trim(the_form.address1.value) !="福井県") &&	   
                    (Trim(the_form.address1.value) !="山梨県") &&	   
                    (Trim(the_form.address1.value) !="長野県") &&	   
                    (Trim(the_form.address1.value) !="岐阜県") &&	                        
                    (Trim(the_form.address1.value) !="静岡県") &&	   
                    (Trim(the_form.address1.value) !="愛知県") &&	   
                    (Trim(the_form.address1.value) !="三重県") &&	   
                    (Trim(the_form.address1.value) !="滋賀県") &&  
                    (Trim(the_form.address1.value) !="京都府") &&	   
                    (Trim(the_form.address1.value) !="大阪府") &&	   
                    (Trim(the_form.address1.value) !="兵庫県") &&	   
                    (Trim(the_form.address1.value) !="奈良県") &&	                        
                    (Trim(the_form.address1.value) !="和歌山県") &&	   
                    (Trim(the_form.address1.value) !="鳥取県") &&	   
                    (Trim(the_form.address1.value) !="島根県") &&	   
                    (Trim(the_form.address1.value) !="岡山県") &&  
                    (Trim(the_form.address1.value) !="広島県") &&	   
                    (Trim(the_form.address1.value) !="山口県") &&	   
                    (Trim(the_form.address1.value) !="徳島県") &&	   
                    (Trim(the_form.address1.value) !="香川県") &&	                        
                    (Trim(the_form.address1.value) !="愛媛県") &&	   
                    (Trim(the_form.address1.value) !="高知県") &&	   
                    (Trim(the_form.address1.value) !="福岡県") &&	   
                    (Trim(the_form.address1.value) !="佐賀県") &&  
                    (Trim(the_form.address1.value) !="長崎県") &&	   
                    (Trim(the_form.address1.value) !="熊本県") &&	   
                    (Trim(the_form.address1.value) !="大分県") &&	   
                    (Trim(the_form.address1.value) !="宮崎県") &&	                        
                    (Trim(the_form.address1.value) !="鹿児島県") &&	   
                    (Trim(the_form.address1.value) !="沖縄県")   
	   ))
	{
	  alert("都道府県が選択されていません。");
	  the_form.address1.focus();
	  return false;
	}
	//住所のチェック
	if (Trim(the_form.address2.value)=="")
	{
	  alert('住所が入力されていません。');
	  the_form.address2.focus();
	  return false;
	}

	
	//電話番号のチェック	
	if (Trim(the_form.firsttele1.value)=="")
	{
	  alert('電話番号が入力されていません。');
	  the_form.firsttele1.focus();
	  return false;
	}
	
	if (!isNumber(the_form.firsttele1.value) )
	{
	  alert('電話番号が正しくありません。');
	  the_form.firsttele1.focus();
	  return false;
	}	
						
	if (Trim(the_form.secondtele1.value)=="")
	{
	  alert('電話番号が入力されていません。');
	  the_form.secondtele1.focus();
	  return false;
	}
	
	if (!isNumber(the_form.secondtele1.value) )
	{
	  alert('電話番号が正しくありません。');
	  the_form.secondtele1.focus();
	  return false;
	}		
						
	if (Trim(the_form.thirdtele1.value)=="")
	{
	  alert('電話番号が入力されていません。');
	  the_form.thirdtele1.focus();
	  return false;
	}

	if (!isNumber(the_form.thirdtele1.value) )
	{
	  alert('電話番号が正しくありません。');
	  the_form.thirdtele1.focus();
	  return false;
	}

	//その他の連絡先のチェック	
	if (Trim(the_form.firsttele2.value)!="" || Trim(the_form.secondtele2.value)!="" || Trim(the_form.thirdtele2.value)!="")
	{
	  if (Trim(the_form.firsttele2.value)=="")
	  {
	    alert('電話番号が入力されていません。');
	    the_form.firsttele2.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.firsttele2.value) )
	  {
	    alert('電話番号が正しくありません。');
	    the_form.firsttele2.focus();
	    return false;
	  }	  

	  				
	  if (Trim(the_form.secondtele2.value)=="")
	  {
	    alert('電話番号が入力されていません。');
	    the_form.secondtele2.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.secondtele2.value) )
	  {
	    alert('電話番号が正しくありません。');
	    the_form.secondtele2.focus();
	    return false;
	  }		  
	  					
	  if (Trim(the_form.thirdtele2.value)=="")
	  {
	    alert('電話番号が入力されていません。');
	    the_form.thirdtele2.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.thirdtele2.value) )
	  {
	    alert('電話番号が正しくありません。');
	    the_form.thirdtele2.focus();
	    return false;
	  }		  
	  
	}

	//重複コミットチェック
	if (!checkReSubmit()){
	   return false;
	}

	return true;

}

function check2()
{
   if (Trim(formview.point.value)=="")
   {
     alert('ポイントが入力されていません。');
     return false;
   }
	  
   if (!isNumber(formview.point.value) )
   {
      alert('ポイントが正しくありません。');
      return false;
   }

   if (formview.bikou.value.length > 512){
      alert('備考の長さが限度を超えています：' + formview.bikou.value.length);
      formview.bikou.focus();
      return false;  	
   }     	
return true;
   
   //重複コミットチェック
   if (!checkReSubmit()){
      return false;
   }   
   
   return true;

}

function  checkSearch(the_form){
	//年齢
	if (Trim(the_form.agefrom.value)!="")
	{
	   if (!isNumber(the_form.agefrom.value) )
	   {
	     alert('年齢が正しくありません。');
	     the_form.agefrom.focus();
	   return false;
	   }
	}

	if (Trim(the_form.ageto.value)!="")
	{
	   if (!isNumber(the_form.ageto.value) )
	   {
	     alert('年齢が正しくありません。');
	     the_form.ageto.focus();
	   return false;
	   }
	}	

	//会員登録時間のチェック	
	if (Trim(the_form.registyearfrom.value)!="" || Trim(the_form.registmonthfrom.value)!="" || Trim(the_form.registdayfrom.value)!="")
	{
	  if (Trim(the_form.registyearfrom.value)=="")
	  {
	    alert('会員登録時間が入力されていません。');
	    the_form.registyearfrom.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.registyearfrom.value) )
	  {
	    alert('会員登録時間が正しくありません。');
	    the_form.registyearfrom.focus();
	    return false;
	  }

	  if (Trim(the_form.registyearfrom.value).length!=4)
	  {
	    alert('会員登録時間が正しくありません。');
	    the_form.registyearfrom.focus();
	    return false;
	  }
	  				
	  if (Trim(the_form.registmonthfrom.value)=="")
	  {
	    alert('会員登録時間が入力されていません。');
	    the_form.registmonthfrom.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.registmonthfrom.value) )
	  {
	    alert('会員登録時間が正しくありません。');
	    the_form.registmonthfrom.focus();
	    return false;
	  }
	  else if (the_form.registmonthfrom.value.length < 2)
	  {
	    the_form.registmonthfrom.value = "0" + the_form.registmonthfrom.value;
	  }

	  					
	  if (Trim(the_form.registdayfrom.value)=="")
	  {
	    alert('会員登録時間が入力されていません。');
	    the_form.registdayfrom.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.registdayfrom.value) )
	  {
	    alert('会員登録時間が正しくありません。');
	    the_form.registdayfrom.focus();
	    return false;
	  }		  
	  else if (the_form.registdayfrom.value.length < 2)
	  {
	    the_form.registdayfrom.value = "0" + the_form.registdayfrom.value;
	  }
	  
	}
	if (Trim(the_form.registyearto.value)!="" || Trim(the_form.registmonthto.value)!="" || Trim(the_form.registdayto.value)!="")
	{
	  if (Trim(the_form.registyearto.value)=="")
	  {
	    alert('会員登録時間が入力されていません。');
	    the_form.registyearto.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.registyearto.value) )
	  {
	    alert('会員登録時間が正しくありません。');
	    the_form.registyearto.focus();
	    return false;
	  }

	  if (Trim(the_form.registyearto.value).length!=4)
	  {
	    alert('会員登録時間が正しくありません。');
	    the_form.registyearto.focus();
	    return false;
	  }
	  				
	  if (Trim(the_form.registmonthto.value)=="")
	  {
	    alert('会員登録時間が入力されていません。');
	    the_form.registmonthto.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.registmonthto.value) )
	  {
	    alert('会員登録時間が正しくありません。');
	    the_form.registmonthto.focus();
	    return false;
	  }		  
	  else if (the_form.registmonthto.value.length < 2)
	  {
	    the_form.registmonthto.value = "0" + the_form.registmonthto.value;
	  }
	  					
	  if (Trim(the_form.registdayto.value)=="")
	  {
	    alert('会員登録時間が入力されていません。');
	    the_form.registdayto.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.registdayto.value) )
	  {
	    alert('会員登録時間が正しくありません。');
	    the_form.registdayto.focus();
	    return false;
	  }		  
	  else if (the_form.registdayto.value.length < 2)
	  {
	    the_form.registdayto.value = "0" + the_form.registdayto.value;
	  }
	  
	}




	//会員ラベル変更時間のチェック	
	if (Trim(the_form.changeyearfrom.value)!="" || Trim(the_form.changemonthfrom.value)!="" || Trim(the_form.changedayfrom.value)!="")
	{
	  if (Trim(the_form.changeyearfrom.value)=="")
	  {
	    alert('会員ラベル変更時間が入力されていません。');
	    the_form.changeyearfrom.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.changeyearfrom.value) )
	  {
	    alert('会員ラベル変更時間が正しくありません。');
	    the_form.changeyearfrom.focus();
	    return false;
	  }

	  if (Trim(the_form.changeyearfrom.value).length!=4)
	  {
	    alert('会員ラベル変更時間が正しくありません。');
	    the_form.changeyearfrom.focus();
	    return false;
	  }
	  				
	  if (Trim(the_form.changemonthfrom.value)=="")
	  {
	    alert('会員ラベル変更時間が入力されていません。');
	    the_form.changemonthfrom.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.changemonthfrom.value) )
	  {
	    alert('会員ラベル変更時間が正しくありません。');
	    the_form.changemonthfrom.focus();
	    return false;
	  }		  
	  else if (the_form.changemonthfrom.value.length < 2)
	  {
	    the_form.changemonthfrom.value = "0" + the_form.changemonthfrom.value;
	  }
	  					
	  if (Trim(the_form.changedayfrom.value)=="")
	  {
	    alert('会員ラベル変更時間が入力されていません。');
	    the_form.changedayfrom.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.changedayfrom.value) )
	  {
	    alert('会員ラベル変更時間が正しくありません。');
	    the_form.changedayfrom.focus();
	    return false;
	  }		  
	  else if (the_form.changedayfrom.value.length < 2)
	  {
	    the_form.changedayfrom.value = "0" + the_form.changedayfrom.value;
	  }
	  
	}
	if (Trim(the_form.changeyearto.value)!="" || Trim(the_form.changemonthto.value)!="" || Trim(the_form.changedayto.value)!="")
	{
	  if (Trim(the_form.changeyearto.value)=="")
	  {
	    alert('会員ラベル変更時間が入力されていません。');
	    the_form.changeyearto.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.changeyearto.value) )
	  {
	    alert('会員ラベル変更時間が正しくありません。');
	    the_form.changeyearto.focus();
	    return false;
	  }

	  if (Trim(the_form.changeyearto.value).length!=4)
	  {
	    alert('会員ラベル変更時間が正しくありません。');
	    the_form.changeyearto.focus();
	    return false;
	  }
	  				
	  if (Trim(the_form.changemonthto.value)=="")
	  {
	    alert('会員ラベル変更時間が入力されていません。');
	    the_form.changemonthto.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.changemonthto.value) )
	  {
	    alert('会員ラベル変更時間が正しくありません。');
	    the_form.changemonthto.focus();
	    return false;
	  }		  
	  else if (the_form.changemonthto.value.length < 2)
	  {
	    the_form.changemonthto.value = "0" + the_form.changemonthto.value;
	  }
	  					
	  if (Trim(the_form.changedayto.value)=="")
	  {
	    alert('会員ラベル変更時間が入力されていません。');
	    the_form.changedayto.focus();
	    return false;
	  }
	  
	  if (!isNumber(the_form.changedayto.value) )
	  {
	    alert('会員ラベル変更時間が正しくありません。');
	    the_form.changedayto.focus();
	    return false;
	  }		  
	  else if (the_form.changedayto.value.length < 2)
	  {
	    the_form.changedayto.value = "0" + the_form.changedayto.value;
	  }
	  
	}	
	
	//重複コミットチェック
	if (!checkReSubmit()){
	   return false;
	}	
	return true;
}