<%@ Language=VBScript %>
<%
' I don't know how to implement a Dictionary in VB,
' so I haven't implemented the event feature.
dayNames = Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")
daysInMonth = Array(31, "?", 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
today = now
thisDay = day(today)
thisMonth = month(today)
thisYear = year(today)
displayMonth = request("month")
if displayMonth = "" then
displayMonth = thisMonth
end if
displayYear = request("year")
if displayYear = "" then
displayYear = thisYear
end if
displayMonthName = monthname(displayMonth)
' find first day of month
firstDayOfMonth = WeekDay(displayMonth & "/1/" & displayYear)
calendarDay = 1 - firstDayOfMonth
' find last day of month
lastDayOfMonth = daysInMonth(displayMonth-1)
if lastDayOfMonth = "?" then
if displayYear mod 400 = 0 or ( displayYear mod 100 <> 0 and displayYear mod 4 = 0 ) then
lastDayOfMonth = 29
else
lastDayOfMonth = 28
end if
end if
prevMonth = displayMonth - 1
prevYear = displayYear
if prevMonth = 0 then
prevMonth = 12
prevYear = prevYear - 1
end if
nextMonth = displayMonth + 1
nextYear = displayYear
if nextMonth > 12 then
nextMonth = 1
nextYear = nextYear + 1
end if
%>
displayMonthName & " " & displayYear
displayMonthName & " " & displayYear
dayNames
dayName
<% Do While calendarDay < lastDayOfMonth %>
<% Loop %>
<%
For dayOfWeek = 1 To 7
calendarDay = calendarDay + 1
if calendarDay = thisDay and displayMonth = thisMonth and displayYear = thisYear then
dayId = "id=""today"""
else
dayId = ""
end if
if 1 <= calendarDay and calendarDay <= lastDayOfMonth then
cellClass = "this-month"
displayDate = calendarDay
else
cellClass = "other-month"
displayDate = " "
end if
%>
<%
Next
%>
<%= dayId %>
cellClass
displayDate
<%= request("SCRIPT_NAME") & "?month=" & prevMonth & "&year=" & prevYear %>
<%= request("SCRIPT_NAME") & "?month=" & nextMonth & "&year=" & nextYear %>