%
option explicit
'on error resume next
%>
<%
dim oConn
set oConn = server.createobject("adodb.connection")
oConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("/db/kcrhca.mdb") & ";"
%>
<%
dim anchorDate
dim nextAnchor
dim prevAnchor
dim iYear
dim iMonth
dim iDay
dim iWeekDay
dim iMonthLen
dim ssDate
dim linkDate
dim startDate
dim ssNextMo
dim oRS
dim sql
dim aRS
dim cal
dim w1, w2, w3, w4, w5, w6
dim ii
dim bNothing
dim rr
dim headline
dim output
function getMonthLen()
dim str
dim dat
dim monthlength
iDay = day(anchorDate)
iMonth = month(anchorDate)
iYear = year(anchorDate)
if iMonth = 12 then
str = "01/01/" & cstr(cint(iYear) + 1)
else
str = cstr(cint(iMonth) + 1) & "/01/" & iYear
end if
dat = cdate(str) - 1
monthlength = day(dat)
getMonthLen = monthlength
end function
function getCell(d)
dim displaymeeting, fid, gC
dim sDate
dim rr
gC = "
" & formatnumber(d,0) & "
"
if bNothing then
getCell = gC
exit function
end if
for rr = 0 to ubound(aRS,2)
if day(aRS(1,rr)) = d then
sDate = formatdatetime(aRS(1,rr),0)
gC = "
"
if iWeekday > 1 then
for ii = 1 to (iWeekday - 1)
cal = cal & "
"
next
for w1 = 1 to 7 - (ii - 1)
linkDate = iMonth & "/" & w1 & "/" & iYear
cal = cal & getCell(w1)
next
else
for w1 = 1 to 7
linkDate = iMonth & "/" & w1 & "/" & iYear
cal = cal & getCell(w1)
next
end if
cal = cal & "
"
for w2 = (w1) to (w1 + 6)
linkDate = iMonth & "/" & w2 & "/" & iYear
cal = cal & getCell(w2)
next
cal = cal & "
"
for w3 = (w2) to (w2 + 6)
linkDate = iMonth & "/" & w3 & "/" & iYear
cal = cal & getCell(w3)
next
cal = cal & "
"
for w4 = (w3) to (w3 + 6)
linkDate = iMonth & "/" & w4 & "/" & iYear
cal = cal & getCell(w4)
next
cal = cal & "
"
for w5 = (w4) to (w4 + 6)
if w5 <= iMonthLen then
linkDate = iMonth & "/" & w5 & "/" & iYear
cal = cal & getCell(w5)
end if
next
if w5 <= iMonthLen then
cal = cal & "
"
end if
for w6 = (w5) to (w5 + 6)
if w6 <= iMonthLen then
linkDate = iMonth & "/" & w6 & "/" & iYear
cal = cal & getCell(w6)
end if
next
cal = cal & "
"
'END CALENDAR
'START NEWS
sql = "SELECT id, [date], title, location, [time], body FROM calendar WHERE homepage = 1 ORDER BY [date] desc, [time] asc "
set oRs = oConn.execute(sql)
if not oRs.eof then
aRs = oRs.getrows()
set oRs = nothing
for rr = 0 to ubound(aRs,2)
headline = aRs(2,rr)
output = output & "