/**
* 定数
*/

//ドメインURL(例："https://esp.kanponoyado.japanpost.jp/" 最後の'/'を忘れないこと)
var domainUrl = "https://reserve.kanponoyado.japanpost.jp/"

/**
 * 空室の検索配下のプルダウンで選択された値を基に
 * 空室照会１画面を別ウィンドウで表示します。
 */
function openKuushitu(){

    //地域の選択値取得
    var select_area = document.f_roomsearch.k_area.selectedIndex;
    var area = document.f_roomsearch.k_area.options[select_area].value;

    //ご利用日(年)の選択値取得
    var select_yyyy = document.f_roomsearch.k_yyyy.selectedIndex;
    var yyyy = ("0" + document.f_roomsearch.k_yyyy.options[select_yyyy].value).slice(-4);

    //ご利用日(月)の選択値取得
    var select_mm = document.f_roomsearch.k_mm.selectedIndex;
    var mm = ("0" + document.f_roomsearch.k_mm.options[select_mm].value).slice(-2);

    //ご利用日(日)の選択値取得
    var select_dd = document.f_roomsearch.k_dd.selectedIndex;
    var dd = ("0" + document.f_roomsearch.k_dd.options[select_dd].value).slice(-2);

    //泊数の選択値取得
    var select_days = document.f_roomsearch.k_days.selectedIndex;
    var days = document.f_roomsearch.k_days.options[select_days].value;

    //大人人数の選択値取得
    var select_otona = document.f_roomsearch.k_otona.selectedIndex;
    var otona = document.f_roomsearch.k_otona.options[select_otona].value;

    //お子さま人数の選択値取得
    var select_kodomo = document.f_roomsearch.k_kodomo.selectedIndex;
    var kodomo = document.f_roomsearch.k_kodomo.options[select_kodomo].value;

    //幼児人数の選択値取得
    var select_youji = document.f_roomsearch.k_youji.selectedIndex;
    var youji = document.f_roomsearch.k_youji.options[select_youji].value;

    //室数の選択値取得
    var select_rooms = document.f_roomsearch.k_rooms.selectedIndex;
    var rooms = document.f_roomsearch.k_rooms.options[select_rooms].value;

    //空室照会１画面を別ウィンドウで表示
    setKuushitsuParam(area,yyyy,mm,dd,days,otona,kodomo,youji,rooms);

}

/**
 * 空室の検索配下のプルダウンで選択された値を基に
 * 空室照会１画面を別ウィンドウで表示します。
 * (※openKuushitu()メソッドから呼び出されます）
 */
function setKuushitsuParam(area,yyyy,mm,dd,days,otona,kodomo,youji,rooms) {
    //var uri = domainUrl + "inetweb/riyoyoyaku/gaiburenkei.do?operation=kuushitsu&k_area=" + area + "&k_yyyy=" + yyyy + "&k_mm=" + mm + "&k_dd=" + dd + "&k_otona=" + otona + "&k_kodomo=" + kodomo + "&k_youji=" + youji;
    //var uri = "/track/esp/convkuushitsu.html?operation=kuushitsu&k_area=" + area + "&k_yyyy=" + yyyy + "&k_mm=" + mm + "&k_dd=" + dd + "&k_otona=" + otona + "&k_kodomo=" + kodomo + "&k_youji=" + youji;
    //var uri = domainUrl + "rsvsearch/rsvsearchcalendar.aspx?a_cd=" + area + "&d_st=" + yyyy + mm + dd + "&d_cn=" + days + "&a_cn=" + otona + "&c1_cn=" + kodomo + "&c2_cn=" + youji + "&t_cn=" + rooms;
		var uri = "/track/esp/convkuushitsu.html?a_cd=" + area + "&d_st=" + yyyy + mm + dd + "&d_cn=" + days + "&a_cn=" + otona + "&c1_cn=" + kodomo + "&c2_cn=" + youji + "&t_cn=" + rooms;

    //var options = "width=860,height=700,scrollbars=yes";
    //var position = "top=0,left=0";
    //options = options + "," + position;

    window.open( uri ,"").focus();
}


/**
 * 宿泊プランの検索配下のプルダウンで選択された値を基に
 * プラン照会１画面を別ウィンドウで表示します。
 */
function openPlan(){
    //地域の選択値取得
    var select_area = document.f_plansearch.p_area.selectedIndex;
    var area = document.f_plansearch.p_area.options[select_area].value;

    //施設名の選択値取得
    var select_scd = document.f_plansearch.p_scd.selectedIndex;
    var scd = document.f_plansearch.p_scd.options[select_scd].value;

    //ご利用日(年)の選択値取得
    var select_yyyy = document.f_plansearch.p_yyyy.selectedIndex;
    var yyyy = ("0" + document.f_plansearch.p_yyyy.options[select_yyyy].value).slice(-4);

    //ご利用日(月)の選択値取得
    var select_mm = document.f_plansearch.p_mm.selectedIndex;
    var mm = ("0" + document.f_plansearch.p_mm.options[select_mm].value).slice(-2);

    //ご利用日(日)の選択値取得
    var select_dd = document.f_plansearch.p_dd.selectedIndex;
    var dd = ("0" + document.f_plansearch.p_dd.options[select_dd].value).slice(-2);

    //泊数の選択値取得
    var select_days = document.f_plansearch.p_days.selectedIndex;
    var days = document.f_plansearch.p_days.options[select_days].value;

    //大人人数の選択値取得
    var select_otona = document.f_plansearch.p_otona.selectedIndex;
    var otona = document.f_plansearch.p_otona.options[select_otona].value;

    //お子さま人数の選択値取得
    var select_kodomo = document.f_plansearch.p_kodomo.selectedIndex;
    var kodomo = document.f_plansearch.p_kodomo.options[select_kodomo].value;

    //幼児人数の選択値取得
    var select_youji = document.f_plansearch.p_youji.selectedIndex;
    var youji = document.f_plansearch.p_youji.options[select_youji].value;

    //室数の選択値取得
    var select_rooms = document.f_plansearch.p_rooms.selectedIndex;
    var rooms = document.f_plansearch.p_rooms.options[select_rooms].value;

    //空室照会１画面を別ウィンドウで表示
    setPlanParam(area,scd,yyyy,mm,dd,days,otona,kodomo,youji,rooms);

}

/**
 * 宿泊プランの検索配下のプルダウンで選択された値を基に
 * プラン照会１画面を別ウィンドウで表示します。
 * (※openPlan()メソッドから呼び出されます)
 */
function setPlanParam(area,scd,yyyy,mm,dd,days,otona,kodomo,youji,rooms) {

    //var uri = domainUrl + "inetweb/riyoyoyaku/gaiburenkei.do?operation=plan&p_scd=" + scd + "&p_yyyy=" + yyyy + "&p_mm=" + mm + "&p_dd=" + dd + "&p_otona=" + otona + "&p_kodomo=" + kodomo + "&p_youji=" + youji;
    //var uri = "/track/esp/convplan.html?operation=plan&p_scd=" + scd + "&p_yyyy=" + yyyy + "&p_mm=" + mm + "&p_dd=" + dd + "&p_otona=" + otona + "&p_kodomo=" + kodomo + "&p_youji=" + youji;
    //var uri = domainUrl + "rsvsearch/rsvsearchcalendar.aspx?a_cd=" + area + "&o_cd=" + scd + "&d_st=" + yyyy + mm + dd + "&d_cn=" + days + "&a_cn=" + otona + "&c1_cn=" + kodomo + "&c2_cn=" + youji + "&t_cn=" + rooms;
    var uri = "/track/esp/convplan.html?a_cd=" + area + "&o_cd=" + scd + "&d_st=" + yyyy + mm + dd + "&d_cn=" + days + "&a_cn=" + otona + "&c1_cn=" + kodomo + "&c2_cn=" + youji + "&t_cn=" + rooms;

    //var options = "width=860,height=700,scrollbars=yes";
    //var position = "top=0,left=0";
    //options = options + "," + position;
    window.open( uri ,"").focus();
}



/**
 * 宿泊プランの検索配下のプルダウンで選択された値を基に
 * プラン照会１画面を別ウィンドウで表示します。
 */
function openPlan2(){

    //施設名の選択値取得
    var select_scd = document.forms[3].p_scd.selectedIndex;
    var scd = document.forms[3].p_scd.value;

    //ご利用日(年)の選択値取得
    var select_yyyy = document.forms[3].p_yyyy.selectedIndex;
    var yyyy = document.forms[3].p_yyyy.options[select_yyyy].value;

    //ご利用日(月)の選択値取得
    var select_mm = document.forms[3].p_mm.selectedIndex;
    var mm = document.forms[3].p_mm.options[select_mm].value;

    //ご利用日(日)の選択値取得
    var select_dd = document.forms[3].p_dd.selectedIndex;
    var dd = document.forms[3].p_dd.options[select_dd].value;

    //大人人数の選択値取得
    var select_otona = document.forms[3].p_otona.selectedIndex;
    var otona = document.forms[3].p_otona.options[select_otona].value;

    //お子さま人数の選択値取得
    var select_kodomo = document.forms[3].p_kodomo.selectedIndex;
    var kodomo = document.forms[3].p_kodomo.options[select_kodomo].value;

    //幼児人数の選択値取得
    var select_youji = document.forms[3].p_youji.selectedIndex;
    var youji = document.forms[3].p_youji.options[select_youji].value;

    //空室照会１画面を別ウィンドウで表示
    setPlanParam2(scd,yyyy,mm,dd,otona,kodomo,youji);

}

/**
 * 宿泊プランの検索配下のプルダウンで選択された値を基に
 * プラン照会１画面を別ウィンドウで表示します。
 * (※openPlan()メソッドから呼び出されます)
 */
function setPlanParam2(scd,yyyy,mm,dd,otona,kodomo,youji) {

    //var uri = domainUrl + "inetweb/riyoyoyaku/gaiburenkei.do?operation=plan&p_scd=" + scd + "&p_yyyy=" + yyyy + "&p_mm=" + mm + "&p_dd=" + dd + "&p_otona=" + otona + "&p_kodomo=" + kodomo + "&p_youji=" + youji;
    var uri = "/track/esp/convyadoyoyaku.html?operation=plan&p_scd=" + scd + "&p_yyyy=" + yyyy + "&p_mm=" + mm + "&p_dd=" + dd + "&p_otona=" + otona + "&p_kodomo=" + kodomo + "&p_youji=" + youji;

    var options = "width=860,height=700,scrollbars=yes";
    var position = "top=0,left=0";
    options = options + "," + position;

    window.open( uri ,"", options ).focus();
}





/**
 * 予約照会画面を別ウィンドウで表示します。
 * ※会員・非会員の判定はサーバ側で行います。
 */
function openYoyakusyoukai() {

    //var uri = domainUrl + "inetweb/riyoyoyaku/gaiburenkei.do?operation=shokai";
		var uri =  "https://reserve.kanponoyado.japanpost.jp/rsvrevise/rsvreviseconflogin.aspx";
    var options = "width=860,height=700,scrollbars=yes";
    var position = "top=0,left=0";
    options = options + "," + position;

    window.open( uri ,"", options ).focus();
}


/**
 * メールマガジン登録画面を別ウィンドウで表示します。
 */
function openMailmagazineEntry() {

    var uri = "http://www.kanponoyado.japanpost.jp/track/esp/mailmagazineEntry.html";
    var options = "width=860,height=700,scrollbars=yes";
    var position = "top=0,left=0";
    options = options + "," + position;

    window.open( uri ,"", options ).focus();
}

/**
 * メールマガジン解除画面を別ウィンドウで表示します。
 */
function openMailmagazineCancel() {

    var uri = "http://www.kanponoyado.japanpost.jp/track/esp/mailmagazineCancel.html";
    var options = "width=860,height=700,scrollbars=yes";
    var position = "top=0,left=0";
    options = options + "," + position;

    window.open( uri ,"", options ).focus();
}

/**
 * 地域プルダウンで選択することにより
 * 施設名プルダウンで表示するデータを動的に変更します。
 * (※宿泊プランの検索で使用)
 *
 * !注意!
 * 下記施設の情報は、2008/07/22現在のものです。
 * マスタの設定内容により、施設の表示・非表示の判定を行っているため、
 * 作成の際はお客様に施設の表示可否について確認が必要です。
 *
 */
function replace () {
  area = document.f_plansearch.p_area.value;

  document.f_plansearch.p_scd.value = "";
  if (area == "") {
    area_();
  }
  else if (area == "0010") {
    area_0010();
  }
  else if (area == "0020") {
    area_0020();
  }
  else if (area == "0030") {
    area_0030();
  }
  else if (area == "0040") {
    area_0040();
  }
  else if (area == "0050") {
    area_0050();
  }
  else if (area == "0060") {
    area_0060();
  }
}
function area_() {
  document.f_plansearch.p_scd.length=1;
  document.f_plansearch.p_scd.options[0].text="選択してください";
  document.f_plansearch.p_scd.options[0].value="";
}
function area_0010 () {
  document.f_plansearch.p_scd.length=9;
  document.f_plansearch.p_scd.options[0].text="選択してください";
  document.f_plansearch.p_scd.options[0].value="";
  document.f_plansearch.p_scd.options[1].text="小樽";
  document.f_plansearch.p_scd.options[1].value="31020";
  document.f_plansearch.p_scd.options[2].text="十勝川";
  document.f_plansearch.p_scd.options[2].value="31040";
  document.f_plansearch.p_scd.options[3].text="一関";
  document.f_plansearch.p_scd.options[3].value="31060";
  document.f_plansearch.p_scd.options[4].text="横手";
  document.f_plansearch.p_scd.options[4].value="31080";
  document.f_plansearch.p_scd.options[5].text="松島（休館中）";
  document.f_plansearch.p_scd.options[5].value="31100";
  document.f_plansearch.p_scd.options[6].text="郡山";
  document.f_plansearch.p_scd.options[6].value="31120";
  document.f_plansearch.p_scd.options[7].text="いわき";
  document.f_plansearch.p_scd.options[7].value="31140";
  document.f_plansearch.p_scd.options[8].text="酒田";
  document.f_plansearch.p_scd.options[8].value="41020";
}
function area_0020 () {
  document.f_plansearch.p_scd.length=15;
  document.f_plansearch.p_scd.options[0].text="選択してください";
  document.f_plansearch.p_scd.options[0].value="";
  document.f_plansearch.p_scd.options[1].text="鴨川";
  document.f_plansearch.p_scd.options[1].value="32160";
  document.f_plansearch.p_scd.options[2].text="大洗";
  document.f_plansearch.p_scd.options[2].value="32020";
  document.f_plansearch.p_scd.options[3].text="潮来";
  document.f_plansearch.p_scd.options[3].value="32040";
  document.f_plansearch.p_scd.options[4].text="塩原";
  document.f_plansearch.p_scd.options[4].value="32060";
  document.f_plansearch.p_scd.options[5].text="栃木喜連川温泉";
  document.f_plansearch.p_scd.options[5].value="32080";
  document.f_plansearch.p_scd.options[6].text="草津";
  document.f_plansearch.p_scd.options[6].value="32100";
  document.f_plansearch.p_scd.options[7].text="磯部";
  document.f_plansearch.p_scd.options[7].value="32120";
  document.f_plansearch.p_scd.options[8].text="寄居";
  document.f_plansearch.p_scd.options[8].value="32140";
  document.f_plansearch.p_scd.options[9].text="青梅";
  document.f_plansearch.p_scd.options[9].value="33020";
  document.f_plansearch.p_scd.options[10].text="旭";
  document.f_plansearch.p_scd.options[10].value="32180";
  document.f_plansearch.p_scd.options[11].text="勝浦";
  document.f_plansearch.p_scd.options[11].value="32200";
  document.f_plansearch.p_scd.options[12].text="箱根";
  document.f_plansearch.p_scd.options[12].value="33040";
  document.f_plansearch.p_scd.options[13].text="石和";
  document.f_plansearch.p_scd.options[13].value="33060";
  document.f_plansearch.p_scd.options[14].text="諏訪";
  document.f_plansearch.p_scd.options[14].value="33100";
}
function area_0030 () {
  document.f_plansearch.p_scd.length=17;
  document.f_plansearch.p_scd.options[0].text="選択してください";
  document.f_plansearch.p_scd.options[0].value="";
  document.f_plansearch.p_scd.options[1].text="熱海（本館）";
  document.f_plansearch.p_scd.options[1].value="33120";
  document.f_plansearch.p_scd.options[2].text="熱海（別館）";
  document.f_plansearch.p_scd.options[2].value="33130";
  document.f_plansearch.p_scd.options[3].text="修善寺";
  document.f_plansearch.p_scd.options[3].value="33140";
  document.f_plansearch.p_scd.options[4].text="伊豆高原";
  document.f_plansearch.p_scd.options[4].value="33160";
  document.f_plansearch.p_scd.options[5].text="富山";
  document.f_plansearch.p_scd.options[5].value="34020";
  document.f_plansearch.p_scd.options[6].text="山代";
  document.f_plansearch.p_scd.options[6].value="34040";
  document.f_plansearch.p_scd.options[7].text="福井";
  document.f_plansearch.p_scd.options[7].value="34060";
  document.f_plansearch.p_scd.options[8].text="焼津";
  document.f_plansearch.p_scd.options[8].value="34080";
  document.f_plansearch.p_scd.options[9].text="浜名湖三ケ日";
  document.f_plansearch.p_scd.options[9].value="34100";
  document.f_plansearch.p_scd.options[10].text="三ヶ根";
  document.f_plansearch.p_scd.options[10].value="34120";
  document.f_plansearch.p_scd.options[11].text="知多美浜";
  document.f_plansearch.p_scd.options[11].value="34140";
  document.f_plansearch.p_scd.options[12].text="恵那";
  document.f_plansearch.p_scd.options[12].value="34160";
  document.f_plansearch.p_scd.options[13].text="岐阜羽島";
  document.f_plansearch.p_scd.options[13].value="34180";
  document.f_plansearch.p_scd.options[14].text="鳥羽";
  document.f_plansearch.p_scd.options[14].value="34200";
  document.f_plansearch.p_scd.options[15].text="熊野";
  document.f_plansearch.p_scd.options[15].value="34220";
  document.f_plansearch.p_scd.options[16].text="白山尾口";
  document.f_plansearch.p_scd.options[16].value="44020";
}
function area_0040 () {
  document.f_plansearch.p_scd.length=10;
  document.f_plansearch.p_scd.options[0].text="選択してください";
  document.f_plansearch.p_scd.options[0].value="";
  document.f_plansearch.p_scd.options[1].text="大和平群";
  document.f_plansearch.p_scd.options[1].value="35080";
  document.f_plansearch.p_scd.options[2].text="白浜";
  document.f_plansearch.p_scd.options[2].value="35120";
  document.f_plansearch.p_scd.options[3].text="彦根";
  document.f_plansearch.p_scd.options[3].value="35020";
  document.f_plansearch.p_scd.options[4].text="富田林";
  document.f_plansearch.p_scd.options[4].value="35060";
  document.f_plansearch.p_scd.options[5].text="奈良";
  document.f_plansearch.p_scd.options[5].value="35100";
  document.f_plansearch.p_scd.options[6].text="紀伊田辺";
  document.f_plansearch.p_scd.options[6].value="35140";
  document.f_plansearch.p_scd.options[7].text="有馬";
  document.f_plansearch.p_scd.options[7].value="35160";
  document.f_plansearch.p_scd.options[8].text="赤穂";
  document.f_plansearch.p_scd.options[8].value="35180";
  document.f_plansearch.p_scd.options[9].text="淡路島";
  document.f_plansearch.p_scd.options[9].value="35200";
}
function area_0050 () {
  document.f_plansearch.p_scd.length=12;
  document.f_plansearch.p_scd.options[0].text="選択してください";
  document.f_plansearch.p_scd.options[0].value="";
  document.f_plansearch.p_scd.options[1].text="皆生";
  document.f_plansearch.p_scd.options[1].value="36020";
  document.f_plansearch.p_scd.options[2].text="観音寺";
  document.f_plansearch.p_scd.options[2].value="36120";
  document.f_plansearch.p_scd.options[3].text="道後";
  document.f_plansearch.p_scd.options[3].value="36180";
  document.f_plansearch.p_scd.options[4].text="美作湯郷";
  document.f_plansearch.p_scd.options[4].value="36040";
  document.f_plansearch.p_scd.options[5].text="竹原";
  document.f_plansearch.p_scd.options[5].value="36060";
  document.f_plansearch.p_scd.options[6].text="光";
  document.f_plansearch.p_scd.options[6].value="36080";
  document.f_plansearch.p_scd.options[7].text="湯田";
  document.f_plansearch.p_scd.options[7].value="36100";
  document.f_plansearch.p_scd.options[8].text="坂出";
  document.f_plansearch.p_scd.options[8].value="36140";
  document.f_plansearch.p_scd.options[9].text="徳島";
  document.f_plansearch.p_scd.options[9].value="36160";
  document.f_plansearch.p_scd.options[10].text="伊野";
  document.f_plansearch.p_scd.options[10].value="36200";
  document.f_plansearch.p_scd.options[11].text="庄原";
  document.f_plansearch.p_scd.options[11].value="46020";
}
function area_0060 () {
  document.f_plansearch.p_scd.length=10;
  document.f_plansearch.p_scd.options[0].text="選択してください";
  document.f_plansearch.p_scd.options[0].value="";
  document.f_plansearch.p_scd.options[1].text="別府";
  document.f_plansearch.p_scd.options[1].value="37080";
  document.f_plansearch.p_scd.options[2].text="北九州";
  document.f_plansearch.p_scd.options[2].value="37020";
  document.f_plansearch.p_scd.options[3].text="柳川";
  document.f_plansearch.p_scd.options[3].value="37040";
  document.f_plansearch.p_scd.options[4].text="日田";
  document.f_plansearch.p_scd.options[4].value="37100";
  document.f_plansearch.p_scd.options[5].text="山鹿";
  document.f_plansearch.p_scd.options[5].value="37120";
  document.f_plansearch.p_scd.options[6].text="阿蘇";
  document.f_plansearch.p_scd.options[6].value="37140";
  document.f_plansearch.p_scd.options[7].text="日南";
  document.f_plansearch.p_scd.options[7].value="37160";
  document.f_plansearch.p_scd.options[8].text="宇佐";
  document.f_plansearch.p_scd.options[8].value="47020";
  document.f_plansearch.p_scd.options[9].text="那覇レク";
  document.f_plansearch.p_scd.options[9].value="37180";
}



function openLogin(){
    window.open(
        'https://reserve.kanponoyado.japanpost.jp/reg/reglogin.aspx',
        'login',
        'width=900,height=800,resizable=1,scrollbars=1,location=1,menubar=1,status=1,left=0,top=0'
    );
}

/**
 * かんぽの宿メンバーズカードの入会申込み画面を別ウィンドウで表示します。
 */
function openLoginEntry(){
    window.open(
        'https://reserve.kanponoyado.japanpost.jp/reg/regentry.aspx',
        'login',
        'width=900,height=800,resizable=1,scrollbars=1,location=1,menubar=1,status=1,left=0,top=0'
    );
}

/**
 * 宿泊料金カレンダ画面を別ウィンドウで表示します。
 */
function openCharge(scd,pcd){

    //宿泊料金カレンダ画面を別ウィンドウで表示
    var uri = domainUrl + "rsvsearch/rsvsearchcharge.aspx?o_cd=" + scd + "&p_cd=" + pcd;

    window.open( uri ,"").focus();
}

/**
* 問い合わせ画面を別ウィンドウで表示します。
*/
function Contact(scd){
    //問い合わせ画面画面を別ウィンドウで表示
    //var uri = domainUrl + "conreq/contactrequestselect.aspx?o_cd=" + scd;
		var uri = "/track/esp/contact.html?o_cd=" + scd;

    window.open( uri ,"").focus();
}


/* add */

window.onload=function(){
        var today    = new Date();
        var year = today.getFullYear();

        setYearOptions("k_yyyy", year);
        setYearOptions("p_yyyy1", year);
        setYearOptions("p_yyyy2", year);

        var tomorrow = new Date(Math.floor(today.getTime() + (1000*60*60*24)));

        setTomorrowDate("k_yyyy", tomorrow.getFullYear());
        setTomorrowDate("k_mm", tomorrow.getMonth() + 1);
        setTomorrowDate("k_dd", tomorrow.getDate());

        setTomorrowDate("p_yyyy1", tomorrow.getFullYear());
        setTomorrowDate("p_mm1", tomorrow.getMonth() + 1);
        setTomorrowDate("p_dd1", tomorrow.getDate());

        setTomorrowDate("p_yyyy2", tomorrow.getFullYear());
        setTomorrowDate("p_mm2", tomorrow.getMonth() + 1);
        setTomorrowDate("p_dd2", tomorrow.getDate());
}

function setTomorrowDate(name, date)
{
    if (document.getElementById(name)) {
        var element = document.getElementById(name);
        for (var i=0;i<element.options.length;i++) {
            if (element.options[i].value == date) {
                if (element.options[i].selected) {
                var selected = document.createAttribute("selected");
                element.options[i].attributes.setNamedItem(selected);
                element.options[i].setAttribute("selected","selected");
                } else {
                element.options[i].selected = "selected";
                }
            }
        }
    }
}

function setYearOptions(id,year)
{
    if (document.getElementById(id)) {
        for (var i=0; i<=1; i++) {  //1を増やすと年数が増えます。
            var element = document.createElement('option');
            element.value = year + i;
            element.innerHTML = year + i;
            document.getElementById(id).appendChild(element);
        }
    }
}


/* add */


