%@Language="VBScript"%>
<%Option Explicit%>
<%
Public Function Main()
Dim v, l, i
Dim n
Dim sEvents
DocHeader ""
BodyStart True, False, ""
CenterText "WSS&PS is a unit of United States Power Squadrons Sail and Power Boating
| ")
ShowSmartMiscText "Welcome", "{para:centertitle}Welcome!"
sEvents = ""
v = ExecSQLArray("SELECT COUNT(*) FROM Events WHERE (EventDate > (Now - 1)) AND (EventDate < (Now + 7))", l)
If (l > 0) Then
n = FixupNumber(v(0, 0))
If (n > 0) Then
sEvents = "There " & IIf(n = 1, "is ", "are ") & CStr(n) & " event" & IIf(n = 1, "", "s") & " coming up in the next week"
End If
End If
v = ExecSQLArray("SELECT COUNT(*) FROM Events WHERE (EventDate > (Now - 1)) AND (EventDate < (Now + 30))", l)
If (l > 0) Then
n = FixupNumber(v(0, 0))
If (n > 0) Then
If (Len(sEvents) > 0) Then
sEvents = sEvents & ", and "
Else
sEvents = "There " & IIf(n = 1, "is ", "are ")
End If
sEvents = sEvents & CStr(n) & " event" & IIf(n = 1, "", "s") & " coming up in the next month"
End If
End If
If (Len(sEvents) > 0) Then
sEvents = sEvents & ". Click here to see what's coming up!" Else sEvents = "Click here to see what events are coming up!" End If CenterText "" & sEvents & "" Response.Write(" | ")
v = ExecSQLArray("SELECT NewsDate, NewsTitle, NewsText " & _
"FROM News " & _
"WHERE ((NewsExpire IS NULL) AND (NewsDate > (Now - 30))) " & _
"OR (NewsExpire > Now) " & _
"ORDER BY NewsDate DESC", l)
If (l > 0) Then
Response.Write("
| ")
End If
Response.Write("