//----次画面へ------//
function next_order(p1) {
  //alert ("p1=" + p1);
  //alert ("mode=" + document.form1.mode.value);
  //alert ("deli_kbn[0]vl=" + document.form1.deli_kbn[0].value);
  //alert ("deli_kbn[0]ch=" + document.form1.deli_kbn[0].checked);

  //J-Payment接続パラメータ
  //alert ("aid=" + document.form1.aid.value);
  //alert ("cod=" + document.form1.cod.value);
  //alert ("jb=" + document.form1.jb.value);
  //alert ("am=" + document.form1.am.value);
  //alert ("tx=" + document.form1.tx.value);
  //alert ("sf=" + document.form1.sf.value);

  //var errflg=0;
  var payflg=0;

  document.form1.action = "./cart_order.php";
  document.form1.mode.value = p1;

  switch (p1) {
    case "":
    case "dele":
      document.form1.action = "./cart.php";   //未使用
      break;
    case "adr":
      break;
    case "pym":

      //背景色を白に
      document.form1.lnm.style.backgroundColor='#ffffff';
      document.form1.fnm.style.backgroundColor='#ffffff';
      document.form1.lnm_kana.style.backgroundColor='#ffffff';
      document.form1.fnm_kana.style.backgroundColor='#ffffff';
      document.form1.mail1.style.backgroundColor='#ffffff';
      document.form1.mail2.style.backgroundColor='#ffffff';
      document.form1.tel1.style.backgroundColor='#ffffff';
      document.form1.tel2.style.backgroundColor='#ffffff';
      document.form1.tel3.style.backgroundColor='#ffffff';
      document.form1.postcode1.style.backgroundColor='#ffffff';
      document.form1.postcode2.style.backgroundColor='#ffffff';
      document.form1.prf.style.backgroundColor='#ffffff';
      document.form1.address1.style.backgroundColor='#ffffff';
      document.form1.shp_lnm.style.backgroundColor='#ffffff';
      document.form1.shp_fnm.style.backgroundColor='#ffffff';
      document.form1.shp_lnm_kana.style.backgroundColor='#ffffff';
      document.form1.shp_fnm_kana.style.backgroundColor='#ffffff';
      document.form1.shp_tel1.style.backgroundColor='#ffffff';
      document.form1.shp_tel2.style.backgroundColor='#ffffff';
      document.form1.shp_tel3.style.backgroundColor='#ffffff';
      document.form1.shp_postcode1.style.backgroundColor='#ffffff';
      document.form1.shp_postcode2.style.backgroundColor='#ffffff';
      document.form1.shp_prf.style.backgroundColor='#ffffff';
      document.form1.shp_address1.style.backgroundColor='#ffffff';

      //エラーチェック
      if (!document.form1.lnm.value) {
        alert ("お名前（姓）を入力して下さい");
        document.form1.lnm.style.backgroundColor='#ffcccc';
        document.form1.lnm.focus();
        document.form1.lnm.select();
        return;
      }
      if (isZenCheck(document.form1.lnm.value) == false){
        alert ("お名前（姓）は全角で入力して下さい");
        document.form1.lnm.style.backgroundColor='#ffcccc';
        document.form1.lnm.focus();
        document.form1.lnm.select();
        return;
      }
      if (!document.form1.fnm.value) {
        alert ("お名前（名）を入力して下さい");
        document.form1.fnm.style.backgroundColor='#ffcccc';
        document.form1.fnm.focus();
        document.form1.fnm.select();
        return;
      }
      if (isZenCheck(document.form1.fnm.value) == false){
        alert ("お名前（名）は全角で入力して下さい");
        document.form1.fnm.style.backgroundColor='#ffcccc';
        document.form1.fnm.focus();
        document.form1.fnm.select();
        return;
      }
      if (!document.form1.lnm_kana.value) {
        alert ("お名前（姓フリガナ）を入力して下さい");
        document.form1.lnm_kana.style.backgroundColor='#ffcccc';
        document.form1.lnm_kana.focus();
        document.form1.lnm_kana.select();
        return;
      }
      if (isZenkanaCheck(document.form1.lnm_kana.value) == false){
        alert ("お名前（姓フリガナ）は全角カナで入力して下さい");
        document.form1.lnm_kana.style.backgroundColor='#ffcccc';
        document.form1.lnm_kana.focus();
        document.form1.lnm_kana.select();
        return;
      }
      if (!document.form1.fnm_kana.value) {
        alert ("お名前（名フリガナ）を入力して下さい");
        document.form1.fnm_kana.style.backgroundColor='#ffcccc';
        document.form1.fnm_kana.focus();
        document.form1.fnm_kana.select();
        return;
      }
      if (isZenkanaCheck(document.form1.fnm_kana.value) == false){
        alert ("お名前（名フリガナ）は全角カナで入力して下さい");
        document.form1.fnm_kana.style.backgroundColor='#ffcccc';
        document.form1.fnm_kana.focus();
        document.form1.fnm_kana.select();
        return;
      }
      if (!document.form1.mail1.value) {
        alert ("メールアドレスを入力して下さい");
        document.form1.mail1.style.backgroundColor='#ffcccc';
        document.form1.mail1.focus();
        document.form1.mail1.select();
        return;
      }
      if (isAlphaNumCheck(document.form1.mail1.value) == false){
        alert ("メールアドレスは半角英数字で入力して下さい");
        document.form1.mail1.style.backgroundColor='#ffcccc';
        document.form1.mail1.focus();
        document.form1.mail1.select();
        return;
      }
      if (isMailCheck(document.form1.mail1.value) == false) {
        alert ("メールアドレスが正しくありません");
        document.form1.mail1.style.backgroundColor='#ffcccc';
        document.form1.mail1.focus();
        document.form1.mail1.select();
        return;
      }
      if (!document.form1.mail2.value) {
        alert ("メールアドレス（確認用）を入力して下さい");
        document.form1.mail2.style.backgroundColor='#ffcccc';
        document.form1.mail2.focus();
        document.form1.mail2.select();
        return;
      }
      if (isAlphaNumCheck(document.form1.mail2.value) == false){
        alert ("メールアドレス（確認用）は半角英数字で入力して下さい");
        document.form1.mail2.style.backgroundColor='#ffcccc';
        document.form1.mail2.focus();
        document.form1.mail2.select();
        return;
      }
      if (document.form1.mail1.value != document.form1.mail2.value) {
        alert ("「メールアドレス」と「メールアドレス（確認用）」が違います。");
        document.form1.mail2.style.backgroundColor='#ffcccc';
        document.form1.mail2.focus();
        document.form1.mail2.select();
        return;
      }
      if (document.form1.birth_year.value) {
        if (isNumberCheck(document.form1.birth_year.value) == false) {
          alert ("生年は数字のみで入力して下さい");
          document.form1.birth_year.style.backgroundColor='#ffcccc';
          document.form1.birth_year.focus();
          document.form1.birth_year.select();
          return;
        }
        if (document.form1.birth_year.value.length != 4) {
          alert ("生年は西暦４桁で入力して下さい");
          document.form1.birth_year.style.backgroundColor='#ffcccc';
          document.form1.birth_year.focus();
          document.form1.birth_year.select();
          return;
        }
      }
      if (!document.form1.tel1.value) {
        alert ("電話番号を入力して下さい");
        document.form1.tel1.style.backgroundColor='#ffcccc';
        document.form1.tel1.focus();
        document.form1.tel1.select();
        return;
      }
      if (!document.form1.tel2.value) {
        alert ("電話番号を入力して下さい");
        document.form1.tel2.style.backgroundColor='#ffcccc';
        document.form1.tel2.focus();
        document.form1.tel2.select();
        return;
      }
      if (!document.form1.tel3.value) {
        alert ("電話番号を入力して下さい");
        document.form1.tel3.style.backgroundColor='#ffcccc';
        document.form1.tel3.focus();
        document.form1.tel3.select();
        return;
      }
      if (isNumberCheck(document.form1.tel1.value) == false) {
        alert ("電話番号は数字のみで入力して下さい");
        document.form1.tel1.style.backgroundColor='#ffcccc';
        document.form1.tel1.focus();
        document.form1.tel1.select();
        return;
      }
      if (isNumberCheck(document.form1.tel2.value) == false) {
        alert ("電話番号は数字のみで入力して下さい");
        document.form1.tel2.style.backgroundColor='#ffcccc';
        document.form1.tel2.focus();
        document.form1.tel2.select();
        return;
      }
      if (isNumberCheck(document.form1.tel3.value) == false) {
        alert ("電話番号は数字のみで入力して下さい");
        document.form1.tel3.style.backgroundColor='#ffcccc';
        document.form1.tel3.focus();
        document.form1.tel3.select();
        return;
      }
      if (!document.form1.postcode1.value) {
        alert ("郵便番号を入力して下さい");
        document.form1.postcode1.style.backgroundColor='#ffcccc';
        document.form1.postcode1.focus();
        document.form1.postcode1.select();
        return;
      }
      if (!document.form1.postcode2.value) {
        alert ("郵便番号を入力して下さい");
        document.form1.postcode2.style.backgroundColor='#ffcccc';
        document.form1.postcode2.focus();
        document.form1.postcode2.select();
        return;
      }
      if (isNumberCheck(document.form1.postcode1.value) == false) {
        alert ("郵便番号は数字のみで入力して下さい");
        document.form1.postcode1.style.backgroundColor='#ffcccc';
        document.form1.postcode1.focus();
        document.form1.postcode1.select();
        return;
      }
      if (isNumberCheck(document.form1.postcode2.value) == false) {
        alert ("郵便番号は数字のみで入力して下さい");
        document.form1.postcode2.style.backgroundColor='#ffcccc';
        document.form1.postcode2.focus();
        document.form1.postcode2.select();
        return;
      }
      if (!document.form1.prf.value) {
        alert ("都道府県を選択して下さい");
        document.form1.prf.style.backgroundColor='#ffcccc';
        document.form1.prf.focus();
        document.form1.prf.select();
        return;
      }
      if (!document.form1.address1.value) {
        alert ("ご住所（市区町村・番地）を入力して下さい");
        document.form1.address1.style.backgroundColor='#ffcccc';
        document.form1.address1.focus();
        document.form1.address1.select();
        return;
      }
      if (isZenCheck(document.form1.address1.value) == false){
        alert ("ご住所（市区町村・番地）は全角で入力して下さい");
        document.form1.address1.style.backgroundColor='#ffcccc';
        document.form1.address1.focus();
        document.form1.address1.select();
        return;
      }

      if (document.form1.deli_kbn[1].checked) {
        if (!document.form1.shp_lnm.value) {
          alert ("「配送先を指定する 」を選択した場合、「お名前（性）」を入力して下さい。");
          document.form1.shp_lnm.style.backgroundColor='#ffcccc';
          document.form1.shp_lnm.focus();
          document.form1.shp_lnm.select();
          return;
        }
        if (!document.form1.shp_fnm.value) {
          alert ("「配送先を指定する 」を選択した場合、「お名前（名）」を入力して下さい。");
          document.form1.shp_fnm.style.backgroundColor='#ffcccc';
          document.form1.shp_fnm.focus();
          document.form1.shp_fnm.select();
          return;
        }
        if (!document.form1.shp_lnm_kana.value) {
          alert ("「配送先を指定する 」を選択した場合、「お名前（姓フリガナ）」を入力して下さい。");
          document.form1.shp_lnm_kana.style.backgroundColor='#ffcccc';
          document.form1.shp_lnm_kana.focus();
          document.form1.shp_lnm_kana.select();
          return;
        }
        if (isZenkanaCheck(document.form1.shp_lnm_kana.value) == false){
          alert ("「配送先を指定する 」を選択した場合、お名前（姓フリガナ）は全角カナで入力して下さい");
          document.form1.shp_lnm_kana.style.backgroundColor='#ffcccc';
          document.form1.shp_lnm_kana.focus();
          document.form1.shp_lnm_kana.select();
          return;
        }
        if (!document.form1.shp_fnm_kana.value) {
          alert ("「配送先を指定する 」を選択した場合、「お名前（名フリガナ）」を入力して下さい。");
          document.form1.shp_fnm_kana.style.backgroundColor='#ffcccc';
          document.form1.shp_fnm_kana.focus();
          document.form1.shp_fnm_kana.select();
          return;
        }
        if (isZenkanaCheck(document.form1.shp_fnm_kana.value) == false){
          alert ("「配送先を指定する 」を選択した場合、お名前（名フリガナ）は全角カナで入力して下さい");
          document.form1.shp_fnm_kana.style.backgroundColor='#ffcccc';
          document.form1.shp_fnm_kana.focus();
          document.form1.shp_fnm_kana.select();
          return;
        }
        if (!document.form1.shp_tel1.value) {
          alert ("「配送先を指定する 」を選択した場合、「電話番号」を入力して下さい。");
          document.form1.shp_tel1.style.backgroundColor='#ffcccc';
          document.form1.shp_tel1.focus();
          document.form1.shp_tel1.select();
          return;
        }
        if (!document.form1.shp_tel2.value) {
          alert ("「配送先を指定する 」を選択した場合、「電話番号」を入力して下さい。");
          document.form1.shp_tel2.style.backgroundColor='#ffcccc';
          document.form1.shp_tel2.focus();
          document.form1.shp_tel2.select();
          return;
        }
        if (!document.form1.shp_tel3.value) {
          alert ("「配送先を指定する 」を選択した場合、「電話番号」を入力して下さい。");
          document.form1.shp_tel3.style.backgroundColor='#ffcccc';
          document.form1.shp_tel3.focus();
          document.form1.shp_tel3.select();
          return;
        }
        if (isNumberCheck(document.form1.shp_tel1.value) == false) {
          alert ("「配送先を指定する 」を選択した場合、「電話番号」は数字のみで入力して下さい。");
          document.form1.shp_tel1.style.backgroundColor='#ffcccc';
          document.form1.shp_tel1.focus();
          document.form1.shp_tel1.select();
          return;
        }
        if (isNumberCheck(document.form1.shp_tel2.value) == false) {
          alert ("「配送先を指定する 」を選択した場合、「電話番号」は数字のみで入力して下さい。");
          document.form1.shp_tel2.style.backgroundColor='#ffcccc';
          document.form1.shp_tel2.focus();
          document.form1.shp_tel2.select();
          return;
        }
        if (isNumberCheck(document.form1.shp_tel3.value) == false) {
          alert ("「配送先を指定する 」を選択した場合、「電話番号」は数字のみで入力して下さい。");
          document.form1.shp_tel3.style.backgroundColor='#ffcccc';
          document.form1.shp_tel3.focus();
          document.form1.shp_tel3.select();
          return;
        }
        if (!document.form1.shp_postcode1.value) {
          alert ("「配送先を指定する 」を選択した場合、「郵便番号」を入力して下さい。");
          document.form1.shp_postcode1.style.backgroundColor='#ffcccc';
          document.form1.shp_postcode1.focus();
          document.form1.shp_postcode1.select();
          return;
        }
        if (!document.form1.shp_postcode2.value) {
          alert ("「配送先を指定する 」を選択した場合、「郵便番号」を入力して下さい。");
          document.form1.shp_postcode2.style.backgroundColor='#ffcccc';
          document.form1.shp_postcode2.focus();
          document.form1.shp_postcode2.select();
          return;
        }
        if (isNumberCheck(document.form1.shp_postcode1.value) == false) {
          alert ("「配送先を指定する 」を選択した場合、「郵便番号」は数字のみで入力して下さい。");
          document.form1.shp_postcode1.style.backgroundColor='#ffcccc';
          document.form1.shp_postcode1.focus();
          document.form1.shp_postcode1.select();
          return;
        }
        if (isNumberCheck(document.form1.shp_postcode2.value) == false) {
          alert ("「配送先を指定する 」を選択した場合、「郵便番号」は数字のみで入力して下さい。");
          document.form1.shp_postcode2.style.backgroundColor='#ffcccc';
          document.form1.shp_postcode2.focus();
          document.form1.shp_postcode2.select();
          return;
        }
        if (!document.form1.shp_prf.value) {
          alert ("「配送先を指定する 」を選択した場合、「都道府県」を選択して下さい。");
          document.form1.shp_prf.style.backgroundColor='#ffcccc';
          document.form1.shp_prf.focus();
          document.form1.shp_prf.select();
          return;
        }
        if (!document.form1.shp_address1.value) {
          alert ("「配送先を指定する 」を選択した場合、「ご住所（市区町村・番地）を入力して下さい」を入力して下さい。");
          document.form1.shp_address1.style.backgroundColor='#ffcccc';
          document.form1.shp_address1.focus();
          document.form1.shp_address1.select();
          return;
        }
      }
      break;
    case "cfm":
      //エラーチェック
      payflg=0;

      //配列かどうか
      if (document.form1.paydeli[1]) {
        for(i=0; i < document.form1.paydeli.length; i++) {
          if(document.form1.paydeli[i].checked){ 
            payflg=1;
            break;
          }
        }
        if (payflg==0) {
          alert ("お支払い方法を選択して下さい");
          document.form1.paydeli[0].checked=true;
          document.form1.paydeli[0].focus();
          document.form1.paydeli[0].select();
          return;
        }
      } else {
        if (document.form1.paydeli.checked==true) {
          payflg=1;
        }
        if (payflg==0) {
          alert ("お支払い方法を選択して下さい");
          document.form1.paydeli.checked=true;
          document.form1.paydeli.focus();
          document.form1.paydeli.select();
          return;
        }
      }
	  //配送日チェックが必須の場合
	  if (document.form1.MdeliDateCheck.value == 1) {
			if (document.form1.delidate.value == "") {
				  alert ("配送日を選択して下さい");
				  document.form1.delidate.focus();
				  return;
			}
      }

    case "odr":
      break;
    case "cdt":
      document.form1.action = "https://credit.j-payment.co.jp/gateway/payform.aspx";
      break;
    default:
      break;
  }

  document.form1.submit();
}





//----------------------------------------------------------------------------------------
// 【 入力項目のチェック 】
//----------------------------------------------------------------------------------------
//   [ 目的 ]       ： 入力項目のチェックを行う
//
//   [ パラメータ ] ：
//
//     ( 配列区分 )                strArray     → 配列かどうか
//                                                 0:配列でない, 1:配列
//                                 nAryno       → 配列の行
//     ( 項目名 )                  strEnm       → Element名
//                                 strKoumoku   → 項目名（日本語）
//     ( 必須チェック )            nChkMust     → 必須チェック
//                                                 0:しない, 1:する
//     ( 文字数チェック )          nChkLimit    → 文字数チェック
//                                                 0:しない, 1:する
//                                 nLimit       → 半角文字数上限
//                                 strMojiAlert → 文字数Alert（日本語）
//                                                 例：「半角200」 or 「全角100」などと記載
//     ( 半角全角英数字チェック )  nChkByte     → 半角全角英数字チェック
//                                                 0:しない, 1:する
//                                 nZenHan      → 1:半角数字のみ, 2:半角英数字のみ, 3:全角のみ, 4:全角カナのみ
//     ( 日付チェック )            nChkDate     → 日付チェック
//                                                 0:しない, 1:日付のみチェック, 2:日付＆時刻をチェック, 3:時刻のみチェック
//     ( メールアドレスチェック )  nChkMail     → メールアドレスチェック
//                                                 0:しない, 1:する
//
//----------------------------------------------------------------------------------------
function checkitem(strArray,nAryno,strEnm,strKoumoku,nChkMust,nChkLimit,nLimit,strMojiAlert,nChkByte,nZenHan,nChkDate,nChkMail) {
  //alert ("nAryno=" + nAryno);
  //alert ("strEnm=" + strEnm);
  //alert ("nChkMust=" + nChkMust);
  //alert ("nChkMail=" + nChkMail);
  //alert ("INPUT_lastnm=" + document.form1.elements['INPUT_lastnm'].value);

  var strWK;
  var flg;

  if (strArray==0) {
    strWK = document.form1.elements[strEnm].value;
  } else {
    strWK = document.form1.elements[strEnm][nAryno].value;
  }
  //alert ("strWK=" + strWK);

  //------------------------------------------------------------------
  // 必須チェック
  //------------------------------------------------------------------
  if (nChkMust==1) {
    if (!strWK) {
      alert (strKoumoku + "は必須入力です。");
      if (strArray==0) {
        document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
        //document.form1.elements[strEnm].focus();
        //document.form1.elements[strEnm].select();
      } else {
        document.form1.elements[strEnm][nAryno].style.backgroundColor='#ffcccc';
        //document.form1.elements[strEnm][nAryno].focus();
        //document.form1.elements[strEnm][nAryno].select();
      }
      //document.form1.next.disabled=true;
      return false;
    }
  }

  //------------------------------------------------------------------
  // 文字数チェック
  //------------------------------------------------------------------

  if ((nChkLimit==1) && (strWK)) {
    //文字数取得
    count = 0;
    for ( var i = 0; i < strWK.length; ++i ) {
      sub = strWK.substring(i, i + 1);
      //全角の場合２バイト追加。
      if( checkIsZenkaku(sub) ){
        count += 2;
      } else {
        count += 1;
      }
    }
    //alert ("count=" + count);

    if (count>nLimit) {
      alert (strKoumoku + "は" + strMojiAlert + "文字以内で記述してください。");
      if (strArray==0) {
        document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
        //document.form1.elements[strEnm].focus();
        //document.form1.elements[strEnm].select();
      } else {
        document.form1.elements[strEnm][nAryno].style.backgroundColor='#ffcccc';
        //document.form1.elements[strEnm][nAryno].focus();
        //document.form1.elements[strEnm][nAryno].select();
      }
      //document.form1.next.disabled=true;
      return false;
    }
  }

  //------------------------------------------------------------------
  // 半角全角英数字チェック
  //------------------------------------------------------------------

  if ((nChkByte==1) && (strWK)) {
    switch (nZenHan) {
      case "1":
        //半角数字のみ
        if (isNumberCheck(strWK) == false){
          alert (strKoumoku + "は半角数字で入力して下さい");
          if (strArray==0) {
            document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
            //document.form1.elements[strEnm].focus();
            //document.form1.elements[strEnm].select();
          } else {
            document.form1.elements[strEnm][nAryno].style.backgroundColor='#ffcccc';
            //document.form1.elements[strEnm][nAryno].focus();
            //document.form1.elements[strEnm][nAryno].select();
          }
          //document.form1.next.disabled=true;
          return false;
        }
        break;
      case "2":
        //半角英数字のみ
        if (isAlphaNumCheck(strWK) == false){
          alert (strKoumoku + "は半角英数字で入力して下さい");
          if (strArray==0) {
            document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
            //document.form1.elements[strEnm].focus();
            //document.form1.elements[strEnm].select();
          } else {
            document.form1.elements[strEnm][nAryno].style.backgroundColor='#ffcccc';
            //document.form1.elements[strEnm][nAryno].focus();
            //document.form1.elements[strEnm][nAryno].select();
          }
          //document.form1.next.disabled=true;
          return false;
        }
        break;
      case "3":
        //全角のみ
        if (isZenCheck(strWK) == false){
          alert (strKoumoku + "は全角で入力して下さい");
          if (strArray==0) {
            document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
            //document.form1.elements[strEnm].focus();
            //document.form1.elements[strEnm].select();
          } else {
            document.form1.elements[strEnm][nAryno].style.backgroundColor='#ffcccc';
            //document.form1.elements[strEnm][nAryno].focus();
            //document.form1.elements[strEnm][nAryno].select();
          }
          //document.form1.next.disabled=true;
          return false;
        }
        break;
      case "4":
        //全角カナのみ
        if (isZenkanaCheck(strWK) == false){
          alert (strKoumoku + "は全角カナで入力して下さい");
          if (strArray==0) {
            document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
            //document.form1.elements[strEnm].focus();
            //document.form1.elements[strEnm].select();
          } else {
            document.form1.elements[strEnm][nAryno].style.backgroundColor='#ffcccc';
            //document.form1.elements[strEnm][nAryno].focus();
            //document.form1.elements[strEnm][nAryno].select();
          }
          //document.form1.next.disabled=true;
          return false;
        }
        break;
      default:
        break;
    }
  }

  //------------------------------------------------------------------
  // 日付チェック
  //------------------------------------------------------------------

  if ((nChkDate != 0) && (nChkDate) && (strWK)) {
    switch (nChkDate) {
      case "1":
        //日付のみ
        // 正規表現による書式チェック 
        if(!strWK.match(/^\d{4}\/\d{2}\/\d{2}$/)){ 
          alert (strKoumoku + "は‘yyyy/mm/dd’の書式で入力してください。");
          document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
          //document.form1.elements[strEnm].focus();
          //document.form1.elements[strEnm].select();
          //document.form1.next.disabled=true;
          return false;
        } else {
          // データチェック
          var vYear = strWK.substr(0, 4) - 0; 
          var vMonth = strWK.substr(5, 2) - 1; // Javascriptは、0-11で表現 
          var vDay = strWK.substr(8, 2) - 0; 
          flg = 0;
          // 月,日の妥当性チェック 
          if(vMonth >= 0 && vMonth <= 11 && vDay >= 1 && vDay <= 31){ 
            var vDt = new Date(vYear, vMonth, vDay); 
            if(isNaN(vDt)){ 
              flg = 1;
            }else if(vDt.getFullYear() == vYear && vDt.getMonth() == vMonth && vDt.getDate() == vDay){ 
              flg = 0;
            }else{ 
              flg = 1;
            }
          }else{
            flg = 1;
          }
          //alert ("flg=" + flg);
          if (flg==1) {
            alert ("日付が正しくありません。\n正しい日付を入力してください。");
            if (strArray==0) {
              document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
              //document.form1.elements[strEnm].focus();
              //document.form1.elements[strEnm].select();
            } else {
              document.form1.elements[strEnm][nAryno].style.backgroundColor='#ffcccc';
              //document.form1.elements[strEnm][nAryno].focus();
              //document.form1.elements[strEnm][nAryno].select();
            }
            //document.form1.next.disabled=true;
            return false;
          }
        }
        break;
      case "2":
        //日付＆時刻
        // 正規表現による書式・数値チェック 
        if(!strWK.match(/^\d{4}\/\d{2}\/\d{2}\s([01]?[0-9]|2[0-3]):([0-5][0-9])$/)){ 
          alert (strKoumoku + "は‘yyyy/mm/dd hh:mm（00:00～23:59）’の書式で入力してください。");
          document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
          //document.form1.elements[strEnm].focus();
          //document.form1.elements[strEnm].select();
          //document.form1.next.disabled=true;
          return false;
        }
        break;
      case "3":
        //時刻のみ
        // 正規表現による書式・数値チェック 
        if(!strWK.match(/^([01]?[0-9]|2[0-3]):([0-5][0-9])$/)){ 
          alert (strKoumoku + "は‘hh:mm（00:00～23:59）’の書式で入力してください。");
          document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
          //document.form1.elements[strEnm].focus();
          //document.form1.elements[strEnm].select();
          //document.form1.next.disabled=true;
          return false;
        }
        break;
      default:
        break;
    }
  }

  //------------------------------------------------------------------
  // メールアドレスチェック
  //------------------------------------------------------------------

  if ((nChkMail==1) && (strWK)) {
    if (isMailCheck(strWK) == false){
      alert ("メールアドレスが正しくありません。");
      if (strArray==0) {
        document.form1.elements[strEnm].style.backgroundColor='#ffcccc';
        //document.form1.elements[strEnm].focus();
        //document.form1.elements[strEnm].select();
      } else {
        document.form1.elements[strEnm][nAryno].style.backgroundColor='#ffcccc';
        //document.form1.elements[strEnm][nAryno].focus();
        //document.form1.elements[strEnm][nAryno].select();
      }
      //document.form1.next.disabled=true;
      return false;
    }
  }

  if (strArray==0) {
    document.form1.elements[strEnm].style.backgroundColor='#ffffff';
  } else {
    document.form1.elements[strEnm][nAryno].style.backgroundColor='#ffffff';
  }
  //document.form1.next.disabled=false;
  return true;

}





//-------------------------------------------------
//   文字の全角チェック（文字数取得で使用）
//-------------------------------------------------
function checkIsZenkaku(value) {
  for (var i = 0; i < value.length; ++i) {
    var c = value.charCodeAt(i);
    //  半角カタカナは不許可
    if (c < 256 || (c >= 0xff61 && c <= 0xff9f)) {
      return false;
    }
  }
  return true;
}

//-------------------------------------------------
//   半角英文字チェック
//   true  : 半角英文字のみ
//   false : 半角英文字のみでない
//-------------------------------------------------
function isAlphabetCheck(str) {
   if( str.match( /[^A-Za-z\/@\s.-]+/ ) ) {
      return false;
   }
   return true;
}

//-------------------------------------------------
//   半角数字チェック
//   true  : 半角数字のみ
//   false : 半角数字のみでない
//-------------------------------------------------
function isNumberCheck(str) {
   if( str.match( /[^0-9]+/ ) ) {
      return false;
   }
   return true;
}

//-------------------------------------------------
//   半角英数字チェック
//   true  : 半角英数字のみ
//   false : 半角英数字のみでない
//-------------------------------------------------
function isAlphaNumCheck(str) {
   if( str.match( /[^A-Za-z0-9_\/:@\s\.\-]+/ ) ) {
      return false;
   }
   return true;
}

//-------------------------------------------------
//   全角チェック
//   true  : 全角のみ
//   false : 全角のみでない
//-------------------------------------------------
function isZenCheck(str) {
   if( str.match( /^[ 　]*[^ -~｡-ﾟ]*[ 　]*$/ ) ) {
      return true;
   }
   return false;
}

//-------------------------------------------------
//   全角カナチェック
//   true  : 全角カナのみ
//   false : 全角カナのみでない
//-------------------------------------------------
function isZenkanaCheck(str) {
   if( str.match( /[^ァ-ンヴー・，、．”’（）＝　１２３４５６７８９０ＡＢＣＤＥＦＧＨＩＪＫＬＭＬＯＰＱＲＳＴＵＶＷＸＹＺ\s]+/ ) ) {
      return false;
   }
   return true;
}

//-------------------------------------------------
//   ふりがなチェック
//   true  : 「ひらがな」・「カタカナ」のみ
//   false : 「ひらがな」・「カタカナ」のみでない
//-------------------------------------------------
function isFuriganaCheck(str) {
   if( str.match( /[^ぁ-んァ-ン　\s]+/ ) ) {
      return false;
   }
   return true;
}

//-------------------------------------------------
//   メールアドレスチェック
//   true  : メールアドレスが正しい
//   false : メールアドレスが正しくない
//-------------------------------------------------
function isMailCheck(str) {
  var Seiki="^[0-9a-zA-Z\-\._]+@+[0-9a-zA-Z\-_]+\.+[0-9a-zA-Z\-_]+[^.]$";

  if(str!=""){
    if(str.match(Seiki)){
      //alert(str.match(Seiki)+"\n\nメールアドレスの形式は正しいです");
      return true;
    }else{
      //alert("メールアドレスの形式が不正です");
      return false;
    }
  }else{
    /* 何も入力されていない場合はアラート表示 */
    //alert("メールアドレスを入力してください");
    return false;
  }
}

//-------------------------------------------------
//   バイト数カウント
//   count : バイト数
//-------------------------------------------------
function countByte(str) {
    var count = 0;
    for(var i = 0; i < str.length; i++) {
       if (escape(str.charAt(i)).length < 4) {
          count++;
       }
       else {
          count += 2;
       }
    }
    return count;
}

