// Calendar.js Copyright 2005 M-international All right reserved.
<!--　カレンダーのスクリプト　//-->
function makeCalendar() {
today = new Date()
var thisDay = today.getDate()
var monthDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31)
var year = today.getYear()
if(year > 1000){
　year = year - 1900
}
year = year + 1900
if(year < 1980){
　year = year + 137
}
if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
　monthDays[1] = 29
}
var nowDays = monthDays[today.getMonth()]
var nowMonth = today.getMonth() + 1
firstday = new Date()
firstday.setDate(1)
var startDay = firstday.getDay()
var koyomi = "<TABLE BORDER='1'><TR><TD COLSPAN='7' BGCOLOR='blue' ALIGN='center'><FONT COLOR='white'>" + year + "年" + nowMonth + "月" + "</FONT></TD></TR>"
koyomi += "<TR><TD><FONT COLOR='red'>日</FONT></TD><TD>月</TD><TD>火</TD><TD>水</TD><TD>木</TD><TD>金</TD><TD><FONT COLOR='blue'>土</FONT></TD></TR>"
var column = 0
for(i = 0 ; i < startDay ; i++) {
　koyomi += "<TD>　</TD>"
　column++
}
for(i = 1 ; i <= nowDays ; i++) {
　if(i == thisDay) {
　　koyomi += "<TD BGCOLOR='yellow' ALIGN='right'>" + i + "</TD>"
　　column++
　}
　else
　if(column == 6) {
　　koyomi += "<TD ALIGN='right'><FONT COLOR='blue'>" + i + "</FONT></TD>"
　　column++
　}
　else
　if(column == 0) {
　　koyomi += "<TD ALIGN='right'><FONT COLOR='red'>" + i + "</FONT></TD>"
　　column++
　}
　else {
　　koyomi += "<TD ALIGN='right'>" + i + "</TD>"
　　column++
　}
　if(column == 7) {
　　koyomi += "<TR>"
　　column = 0
　}
}
koyomi += "</TABLE>"
document.write(koyomi)
}

