﻿
var yasumi = new Array(12);
for (i = 0; i < 12; i++) {
	var base = new Array(31);
	for (j = 0; j < 31; j++) {base[j] = "";}
	yasumi[i] = base;
}




// 休みの追加 月は 0 からスタート （9月の場合 [8] ）

// 1月
yasumi[0][1] = "1";
yasumi[0][7] = "1";
yasumi[0][14] = "1";
yasumi[0][21] = "1";
yasumi[0][28] = "1";
//


// 2月
yasumi[1][3] = "1";
yasumi[1][4] = "1";
yasumi[1][11] = "1";
yasumi[1][18] = "1";
yasumi[1][25] = "1";
//


// 3月
yasumi[2][4] = "1";
yasumi[2][11] = "1";
yasumi[2][18] = "1";
yasumi[2][25] = "1";
//


// 4月
yasumi[3][1] = "1";
yasumi[3][8] = "1";
yasumi[3][15] = "1";
yasumi[3][22] = "1";
yasumi[3][28] = "1";
//


// 5月
yasumi[4][6] = "1";
yasumi[4][13] = "1";
yasumi[4][20] = "1";
yasumi[4][27] = "1";
//


// 6月
yasumi[5][3] = "1";
yasumi[5][10] = "1";
yasumi[5][17] = "1";
yasumi[5][24] = "1";
//


// 7月
yasumi[6][1] = "1";
yasumi[6][8] = "1";
yasumi[6][15] = "1";
yasumi[6][22] = "1";
yasumi[6][29] = "1";
//


// 8月
yasumi[7][5] = "1";
yasumi[7][10] = "1";
yasumi[7][19] = "1";
yasumi[7][26] = "1";
//


// 9月
yasumi[8][3] = "1";
yasumi[8][10] = "1";
yasumi[8][17] = "1";
yasumi[8][24] = "1";
//


// 10月
yasumi[9][1] = "1";
yasumi[9][8] = "1";
yasumi[9][15] = "1";
yasumi[9][20] = "1";
yasumi[9][21] = "1";
yasumi[9][22] = "1";
yasumi[9][29] = "1";
//


// 11月
yasumi[10][5] = "1";
yasumi[10][12] = "1";
yasumi[10][19] = "1";
yasumi[10][26] = "1";


// 12月
yasumi[11][3] = "1";
yasumi[11][10] = "1";
yasumi[11][17] = "1";
yasumi[11][25] = "1";
//


// 設定はここまでです。














//////// これ以降は変更禁止です ////////

    function Disp_Calendar(today,rai){
      loop = 0;
      leng = new monthleng(today);
      firstday = getFirstDay(today);
      rowcount = getRowCount(leng[today.getMonth()]);

      //disp Month
      document.writeln("<table cellpadding=\"0\" cellspacing=\"1\" class=\"Calendar\"><tr><th colspan=\"7\" class=\"Month\">");
      if (myDate.getYear() < 2000) {nenf = (myDate.getYear() + 1900);}
      else {nenf = myDate.getYear();}
      document.write(nenf);
      document.write("年");
      if (today.getMonth() + 1 <10) {document.write("0");}
      document.write(today.getMonth() + 1);
      document.writeln("月</th></tr>")
      DispCalWeek();
      loop = -firstday;
      for ( cal_week = 0 ; cal_week < rowcount ; cal_week++){
        document.writeln("<tr class=\"Day\">\n");
        for ( cal_day = 0 ; cal_day < 7 ; cal_day++){
          loop++;
          ////// set color
          day_color="black";
          if ( cal_day == 0) day_color="red";
          if ( loop == today.getDate() && rai != 1) day_color="blue";
          ///// print the day
          if (loop>0 && loop <=leng[today.getMonth()]){
            DispTheDay(day_color,loop,today.getMonth());
          }else{
            document.writeln("<td class=\"\">&nbsp;</td>");
          }
        }
        document.writeln("</tr>");
      }
      document.writeln("</table>");
      return true;
    }
    function DispTheDay(color,day,mon){

      if (yasumi[mon][day] == 1) {tcls = "Rholi";}
      else {tcls = "";}

      document.write('<td class="' + tcls + '">');
      document.write(day);
      document.writeln("</td>");
    }
    function monthleng(theDay){
      this[0] = 31;
      this[1] = 28;
      this[2] = 31;
      this[3] = 30;
      this[4] = 31;
      this[5] = 30;
      this[6] = 31;
      this[7] = 31;
      this[8] = 30;
      this[9] = 31;
      this[10] = 30;
      this[11] = 31;
      if (theDay.getYear() % 4 == 0){
        this[1] = 29;
      }
      if (theDay.getYear()%100 == 0 && theDay.getYear()%400 != 0){
        this[1] = 28;
      }
    }
    function getFirstDay(theDay){
      firstdate = new Date(theDay);
      firstdate.setDate(1);
      return firstdate.getDay();
    }

// 追加（2004年11月30日）
    function getRowCount(mcoun){
      if ((firstday + mcoun) % 7) {amari = 1;}
      else {amari = 0;}
      mrow = Math.floor((firstday + mcoun) / 7) + amari;
      return mrow;
    }

    function DispCalWeek(){
      document.writeln("<tr>")
      document.writeln("<th class=\"Sun\">日</th>")
      document.writeln("<th class=\"\">月</th>")
      document.writeln("<th class=\"\">火</th>");
      document.writeln("<th class=\"\">水</th>");
      document.writeln("<th class=\"\">木</th>");
      document.writeln("<th class=\"\">金</th>");
      document.writeln("<th class=\"Sat\">土</th>");
      document.writeln("</tr>");
    }



// ページに表示する部分
myDate = new Date();
//document.write('<font size=2>本日は' , (myDate.getMonth()+1) , '月' , myDate.getDate() , '日です</font><br>');
Disp_Calendar(myDate);
if (myDate.getYear() < 2000) {Ryear = (myDate.getYear() + 1900);}
else {Ryear = myDate.getYear();}
if (myDate.getMonth() == 11) {raigetu = (Ryear+1) + '/1/1';}
else {raigetu = Ryear + '/' + (myDate.getMonth()+2) + '/1';}
Disp_Calendar((new Date(raigetu)),1);
// ページに表示ここまで





