<!--
/*==================================================================*/
/* Title   : 教材データベース (検索関連)                        */
/* Program : 株式会社ゴビ (H.Imanishi)                              */
/*        Copyright (C) 2007-2008 GOV Co.,Ltd. All Rights Reserved. */
/*==================================================================*/
/*---------- トップページ ----------*/
/* キーワード入力ボックス処理 (Enterキー認識版) */
function get_enter_key(getKeyCode, sSearch) {
  if (getKeyCode == 13) {
    with (document.frmSearch) {
      hidSearch.value = sSearch;
      submit();
    }
  }
}

/* 検索選択処理 (sSearch - 検索種類(material:教材、textbook:教科書、study:学習指導)) */
function btn_search(sSearch) {
  with (document.frmSearch) {
    hidSearch.value = sSearch;
    submit();
  }
}

/*---------- 検索結果(全体) ----------*/
/* 表示順変更時処理 (sSearch - 検索種類(material:教材、textbook:教科書、study:学習指導)) */
function change_order(sSearch) {
  with (document.frmOrder) {
    if (sSearch == "material") {
      location.href = "material_setting.php?St=order&Ord=" + selOrder.options[selOrder.selectedIndex].value;
    } else if (sSearch == "textbook") {
      location.href = "textbook_setting.php?St=order&Ord=" + selOrder.options[selOrder.selectedIndex].value;
    } else if (sSearch == "study") {
      location.href = "study_setting.php?St=order&Ord=" + selOrder.options[selOrder.selectedIndex].value;
    }
  }
}

/* 表示件数変更時処理 (sSearch - 検索種類(material:教材、textbook:教科書、study:学習指導)) */
function change_viewcount(sSearch) {
  with (document.frmOrder) {
    if (sSearch == "material") {
      location.href = "material_setting.php?St=count&VCnt=" + selViewCount.options[selViewCount.selectedIndex].value;
    } else if (sSearch == "textbook") {
      location.href = "textbook_setting.php?St=count&VCnt=" + selViewCount.options[selViewCount.selectedIndex].value;
    } else if (sSearch == "study") {
      location.href = "study_setting.php?St=count&VCnt=" + selViewCount.options[selViewCount.selectedIndex].value;
    }
  }
}

/*---------- 学習指導要領から探す ----------*/
/* 選択肢変更時処理 (sTable - 変更セレクトボックス) */
function change_sg_category(sTable) {
  with (document.frmSearch) {
    action = "study_category.php?St=search&ch=" + sTable;
    submit();
  }
}
function change_sg_middle(sCdScKind, sCdSubject, sCdScYearField, sCdSg, sCdSgD) {
  with (document.frmSearch) {
    action = "study_setting.php?St=middle&ch=SgDetail";
    document.getElementById('selCdScKind').value = sCdScKind;
    document.getElementById('selCdSubject').value = sCdSubject;
    document.getElementById('selCdScYearField').value = sCdScYearField;
    document.getElementById('selCdSg').value = sCdSg;
    document.getElementById('selCdSgD').value = sCdSgD;
    submit();
  }
}
function change_sg_select(sTable) {
  with (document.frmSearch) {
    action = "study_setting.php?St=search&ch=" + sTable;
    submit();
  }
}

/*---------- 教材分類から探す ----------*/
/* 選択肢変更時処理 (sTable - 変更セレクトボックス) */
function change_cf_category(sTable) {
  with (document.frmSearch) {
    action = "classify_category.php?St=search&ch=" + sTable;
    submit();
  }
}
function change_cf_middle(sCdScKind, sCdSubject, sCdScYearField, sCdTmFunction, sCdTmLarge) {
  with (document.frmSearch) {
    action = "classify_setting.php?St=middle&ch=SgDetail";
    document.getElementById('selCdScKind').value = sCdScKind;
    document.getElementById('selCdSubject').value = sCdSubject;
    document.getElementById('selCdScYearField').value = sCdScYearField;
    document.getElementById('selCdTmFunction').value = sCdTmFunction;
    document.getElementById('selCdTmLarge').value = sCdTmLarge;
    submit();
  }
}
function change_cf_select(sTable) {
  with (document.frmSearch) {
    action = "classify_setting.php?St=search&ch=" + sTable;
    submit();
  }
}

/*---------- 教科書の目次から選ぶ ----------*/
/* 選択肢変更時処理 (sTable - 変更セレクトボックス) */
function change_tb_category(sTable) {
  with (document.frmSearch) {
    action = "textbook_category.php?St=search&ch=" + sTable;
    submit();
  }
}
function change_tb_middle(sCdScKind, sCdSubject, sCdScYearField, sCdTb, sNoContents) {
  with (document.frmSearch) {
    action = "textbook_setting.php?St=middle&ch=TbContents";
    document.getElementById('selCdScKind').value = sCdScKind;
    document.getElementById('selCdSubject').value = sCdSubject;
    document.getElementById('selCdScYearField').value = sCdScYearField;
    document.getElementById('selCdTb').value = sCdTb;
    document.getElementById('selNoContents').value = sNoContents;
    submit();
  }
}
function change_tb_select(sTable) {
  with (document.frmSearch) {
    action = "textbook_setting.php?St=search&ch=" + sTable;
    submit();
  }
}

/*---------- レビュー投稿 ----------*/
/* 入力完了ボタン処理 */
function btn_review_input() {
  var iFlag = 0;  // チェック用変数

  with (document.frmInput) {
    // タイトルチェック
    if (txtTxtTitle.value == "") {
      alert("タイトル ： 未入力です。");
      txtTxtTitle.focus();
      iFlag = 1;
    }

    // レビュー本文チェック
    if (iFlag == 0) {
      if (txtTxtReview.value == "") {
        alert("レビュー本文 ： 未入力です。");
        txtTxtReview.focus();
        iFlag = 1;
      }
    }

    // 添付ファイルチェック
    if (iFlag == 0) {
      if (fileNmUploadFile.value != "") {
        if (ReviewExtCheck(fileNmUploadFile, "添付ファイル") == 1) {
          iFlag = 1;
        }
      }
    }

    // Submit処理
    if (iFlag == 0) {
      action = "review_setting.php?Action=check";
      submit();
    }
  }
}


/*---------- レビュー投稿確認ページ ----------*/
/* 登録するボタン処理 */
function btn_review_insert() {
  location.href = "review_db.php";
}

/* 修正するボタン処理 */
function btn_review_revise() {
  location.href = "review_input.php";
}


/*---------- トップからダイレクトに、学習指導要領から探す ----------*/
/* 選択肢変更時処理 (sCdScKind - 校種コード, sCdSubject - 教科コード) */
function btnStudy(sFolder, sCdScKind, sCdSubject) {
  with (document.frmSearch) {
    //action = sFolder + "study_setting.php?St=search&ch=Subject";
    action = sFolder + "study_category.php?St=search&ch=Subject";
    document.getElementById('selCdScKind').value = sCdScKind;
    document.getElementById('selCdSubject').value = sCdSubject;
    submit();
  }
}

/*---------- トップからダイレクトに、教材分類から探す ----------*/
/* 選択肢変更時処理 (sCdScKind - 校種コード, sCdSubject - 教科コード) */
function btnClassify(sFolder, sCdScKind, sCdSubject) {
  with (document.frmSearch) {
    //action = sFolder + "classify_setting.php?St=search&ch=Subject";
    action = sFolder + "classify_category.php?St=search&ch=Subject";
    document.getElementById('selCdScKind').value = sCdScKind;
    document.getElementById('selCdSubject').value = sCdSubject;
    submit();
  }
}

/*---------- トップからダイレクトに、教科書の目次から選ぶ ----------*/
/* 選択肢変更時処理 (sCdScKind - 校種コード, sCdSubject - 教科コード) */
function btnTextbook(sFolder, sCdScKind, sCdSubject) {
  with (document.frmSearch) {
    //action = sFolder + "textbook_setting.php?St=search&ch=Subject";
    action = sFolder + "textbook_category.php?St=search&ch=Subject";
    document.getElementById('selCdScKind').value = sCdScKind;
    document.getElementById('selCdSubject').value = sCdSubject;
    submit();
  }
}



/*---------- クッキーを削除 ----------*/
/* 有効期限を前日に設定し無効化 */
/* param    myCookie: クッキー名 */
function myDelCookie(myCookie){
  expireDate = new Date();
  expireDate.setYear(expireDate.getYear()-1);
  setdata = myCookie + "='';expires=" + expireDate.toGMTString();
  document.cookie = setdata;
}

//-->

