function SetSel()
{
  //年月日時のリスト設定
  set_eYearMonth();
  document.MyForm.eYearMonth.value = document.MyForm.Jikoku_Y.value +"年"+ document.MyForm.Jikoku_M.value  +"月";

  set_eDay();
  document.MyForm.eDay.value = document.MyForm.Jikoku_D.value;
  
  set_eTime();
  document.MyForm.eTime.value = document.MyForm.Jikoku_H.value;
  
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function set_eYearMonth()
{
  var now1 = new Date(SetDate());
  var before14 = new Date(now1.getFullYear(),now1.getMonth(),now1.getDate()-14);
  
  //一旦消去
  for(I=0 ; I<2; I++) {
    if (document.MyForm.eYearMonth.options[I] != null)
      document.MyForm.eYearMonth.options[I] = null;
  }  
  
  sMM = now1.getFullYear() +"年"+ (now1.getMonth()+1)  +"月";
  document.MyForm.eYearMonth.options[0] = new Option(sMM, sMM);

  if (now1.getMonth() != before14.getMonth()){
    sMM = before14.getFullYear() +"年"+ (before14.getMonth()+1)  +"月";
    document.MyForm.eYearMonth.options[1] = new Option(sMM, sMM);
  } 
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function set_eDay()
{
  var aDay  = new Array(14);
  var now1 = new Date(SetDate());
  var newMonth = now1.getMonth();

  //選択された年月の日数を取得して設定//
  for(I=0 ; I<14; I++) {
    aDay[I] = new Date(now1.getFullYear(),now1.getMonth(),now1.getDate()-I);
  }

  //選択されている年月を取得
  YMNo = document.MyForm.eYearMonth.selectedIndex;
  
  
  //一旦消去
  for(I=0 ; I<14; I++) {
    if (document.MyForm.eDay.options[I] != null)
      document.MyForm.eDay.options[I] = null;
  }  
 
  CNT = 0;
  //設定を反映
  for(I=0 ; I<14; I++) {
     mm = aDay[I].getMonth();
     dd = aDay[I].getDate();
     if (YMNo == 0 && mm == newMonth) {
       document.MyForm.eDay.options[CNT++] = new Option(dd, dd);
     }
     if (YMNo == 1 && mm != newMonth) {
       document.MyForm.eDay.options[CNT++] = new Option(dd, dd);
     }
  }
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function set_eTime()
{
  var aTime  = new Array(24);
  var now1 = new Date(SetDate());
  var nowDay  = now1.getDate();

  //選択された年月日から時間数を取得して設定//
  DYNo = document.MyForm.eDay.selectedIndex;
  sDay = document.MyForm.eDay.options[DYNo].value;
  
  for(I=0 ; I<24; I++) {
    if (nowDay == sDay)
      aTime[I] = new Date(now1.getFullYear(),now1.getMonth(),now1.getDate(), now1.getHours()-I-1);
    else
      aTime[I] = new Date(now1.getFullYear(),now1.getMonth(),now1.getDate(), 24-I-1);
  }
  
  //一旦消去
  for(I=0 ; I<24; I++) {
    if (document.MyForm.eTime.options[0] != null)
      document.MyForm.eTime.options[0] = null
  }  
  //設定を反映
  for(I=0 ; I<24; I++) {
    dd = aTime[I].getDate();
    tt = aTime[I].getHours();
      if (dd == nowDay)
        if (tt == 0)
          document.MyForm.eTime.options[I] = new Option("1", "1");
        else
          document.MyForm.eTime.options[I] = new Option(tt+1, tt+1);
  }
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ChangeYearMonth()
{
  set_eDay();
  set_eTime();
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ChangeDay()
{
  set_eTime();
}

function load_Time_html()
{
  //変数設定
  var aMonth    = new Array(3);
  var aYearNo   = new Array(3);
  var aMonthNo  = new Array(3);
  var eYMi = document.MyForm.eYearMonth.selectedIndex;
  var eDi = document.MyForm.eDay.selectedIndex;
  var eTi = document.MyForm.eTime.selectedIndex;
  var now1 = new Date(SetDate());

  //最新年月日時から過去３ヶ月分の年月を取得
  for(I=0 ; I<3; I++) {
    aMonth[I] = new Date(now1.getFullYear(),now1.getMonth()-I,now1.getDate());
    aYearNo[I] = aMonth[I].getFullYear(); 
    aMonthNo[I] = aMonth[I].getMonth()+1; 
  }

  //年の設定
  tyy = aYearNo[eYMi];
  //月の設定
  tmm = aMonthNo[eYMi];
  //日の設定
  tdd = document.MyForm.eDay.options[eDi].value;
  //時の設定
  ttt = document.MyForm.eTime.options[eTi].value;
  if ( tmm == now1.getMonth()+1 & tdd == now1.getDate() & ttt == now1.getHours() ){    self.location.href = "realtime.htm";
  }else{
    yyyy=tyy+""
    yy = yyyy.substr(2, 2);
    //月の設定
    if (tmm > 9) mm = tmm;
    else         mm = "0" + tmm;
    //日の設定
    if (tdd > 9) dd = tdd;
    else         dd = "0" + tdd;
    //時間の設定
    if (ttt > 9) tt = ttt;
    else         tt = "0" + ttt;
    
    self.location.href = "realtime_" +yy+mm+dd+tt+".htm";
  }
}


