


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;
}

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


// 休みで無い日を追加する
// 休みの追加 月は０からスタート （9月の場合 [8] ）

// 1月1日公休、1月2日〜1月10日営業（年始）
yasumi[0][1] = "1";
eigyo[0] = [,,1,1,1,1,1,1,1,1,1,];

// 2月1日〜14日営業（節分、バレンタインデー）
eigyo[1] = [,1,1,1,1,1,1,1,1,1,1,1,1,1,1,];

// 3月1日〜31日営業（ひな祭り、ホワイトデー、卒業）
eigyo[2] = [,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];

// 4月1日〜4月10日営業（新学期）
eigyo[3] = [,1,1,1,1,1,1,1,1,1,1,];

// 5月1日〜12日営業（ゴールデンウイークと母の日）
eigyo[4] = [,1,1,1,1,1,1,1,1,1,1,1,1,];

// 6月11日〜18日営業（父の日）
eigyo[5] = [,,,,,,,,,,,1,1,1,1,1,1,1,1,];

// 7月なし

// 8月1日〜18日（お盆）
eigyo[7] = [,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,];

// 9月11日〜18日営業（敬老の日）
eigyo[8] = [,,,,,,,,,,,1,1,1,1,1,1,1,1,];

// 10月なし

// 11月なし

// 12月10日〜31日営業（クリスマス、年末）
eigyo[11] = [,,,,,,,,,,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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 BORDER=1 CELLSPACING=0 style=\"font-size:13px;\"><TR><TH COLSPAN=7 style=\"background-color:#CFCFCF;\">");
      document.writeln(today.getMonth() + 1 + "");
      document.writeln("月</TH> </TR>")
      DispCalWeek();
      loop = -firstday;
      for ( cal_week = 0 ; cal_week < rowcount ; cal_week++){
        document.writeln("<TR>\n");
        for ( cal_day = 0 ; cal_day < 7 ; cal_day++){
          loop++;
          ////// set color
          day_color="black";
          if ( cal_day == 0)day_color="red";
//          if ( cal_day == 6)day_color="blue";
          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><font color=white.</font></TD>");
          }
        }
        document.writeln("</TR>\n");
      }
      document.writeln("</TABLE>");
      return true;
    }
    function DispTheDay(color,day,mon){
      document.write("<TD ALIGN=CENTER");

      if ( cal_day == 4 && eigyo[mon][day] != 1) {document.write(' style=\"background-color:#ffcccc;\"');}
      if (yasumi[mon][day] == 1 && eigyo[mon][day] != 1) {document.write(' style=\"background-color:#ffcccc;\"');}

      document.writeln('><FONT COLOR="',color,'">');
      //当日を green 太字で表示
      if (color == "blue") {
        document.writeln(day);
      } else {
        document.writeln(day);
      }
      document.writeln("</FONT>");
      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 style=\"font-color:red;\">日</TH>")
      document.writeln("<TH>月</TH>")
      document.writeln("<TH>火</TH>");
      document.writeln("<TH>水</TH>");
      document.writeln("<TH>木</TH>");
      document.writeln("<TH>金</TH>");
      document.writeln("<TH>土</TH>");
      document.writeln("</TR>");
    }



// ページに表示する部分
myDate = new Date();
document.write('<table><tr><td valign=top>');
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';}
document.write('</td><td valign=top>');
Disp_Calendar((new Date(raigetu)),1);
document.write('</td></tr></table>');
// ページに表示ここまで





