now = new Date();
nen=now.getYear(); //今年の年（下２桁）
tuk=now.getMonth()+1; //今月の月
nit=now.getDate(); //今日の日付
you=now.getDay(); //曜日（日曜日が０）
var hizuke=1; //日付
var ok=0;
max = new Array(12); //１月から１２月までのその月の日数
max[1]=31;max[2]=28;max[3]=31;max[4]=30;max[5]=31;max[6]=30;max[7]=31;max[8]=31;max[9]=30;max[10]=31;max[11]=30;max[12]=31;
if (now.getYear() % 4 == 0){
    max[2] = 29;
  }
  if (now.getYear()%100 == 0 && now.getYear()%400 == 0){
    max[2] = 28;
  }
for(i=nit;i>1;i--){
if(you==0){you=6;} //１日の曜日を判定
else{you--;}
}
//document.write("<B>"+nen+"/</B>");
//document.write("<B>"+tuk+"</B>");
document.write("<TABLE BORDER=3 CELLSPACING=0 CELLPADDING=0 align=right>");
document.write("<tr><b>Today is " + myMonth + "/" + myDate + "/" + myYear + ".</b></tr>");
document.write("<TR><TD><FONT COLOR=red>sun</FONT></TD><TD>mon</TD><TD>tue</TD><TD>wed</TD><TD>thu</TD><TD>fri</TD><TD>sat</TD></TR>");
for(i=1;i<7;i++){
document.write("<TR>");
for(j=1;j<8;j++){
if(hizuke==nit & you<1){ //今日の日付にマーク
document.write("<TD BGCOLOR=yellow WIDTH=24>");
}
else {document.write("<TD WIDTH=24>");}
if(you-->0 || hizuke>max[tuk]){
document.write(".");
document.write("</TD>");
}
else{
//shuku(tuk*100+hizuke); //祝日？
if(j==1 || ok==1){ //日曜日？
document.write("<FONT COLOR=red>");
document.write(hizuke++);
document.write("</FONT>");
if(j==1 && ok==1){ok=1;} //振替休日？
else{ok=0;}
}
else {document.write(hizuke++);}
}
document.write("</TD>");
}
document.write("</TR>");
}
document.write("</TABLE>");


