<script language=javascript>
function fnsubmit(strpage)
{
document.forms[0].action= strpage
document.forms[0].submit()
}
</script>
<%
call writedropdowns
sub writedropdowns()
dim strselflink
strselflink = request.servervariables("script_name")
response.write "<form name=dates method=post>" & vbcrlf
response.write monthdropdown("month1",false,request("month1"),strselflink) & " " & daydropdown("day1", "",getdaysinmonth(request("month1"),request("year1")),request("day1")) & " " & yeardropdown("year1","","", request("year1"),strselflink) & vbcrlf
response.write "</form>" & vbcrlf
end sub
function monthdropdown(strname, blnnum, strselected, strselflink)
dim strtemp, i, strselectedstring
strtemp = "<select name=" & strname& " onchange=javascript: fnsubmit(" & chr(34) & strselflink & chr(34) & ")>" & vbcrlf
strtemp = strtemp & "<option value=" & 0 & ">" & "month" & "</option>" & vbcrlf
for i = 1 to 12
if strselected = cstr(i) then
strselectedstring = "selected"
else
strselectedstring = ""
end if
if blnnum then
strtemp = strtemp & "<option value=" & i & " " & strselectedstring & " >" & i & "</option>" & vbcrlf
else
strtemp = strtemp & "<option value=" & i & " " & strselectedstring & " >" & monthname(i) & "</option>" & vbcrlf
end if
next
strtemp = strtemp & "</select>" & vbcrlf
monthdropdown = strtemp
end function
function yeardropdown(strname, intstartyear, intendyear, strselected, strselflink)
dim strtemp, i, strselectedstring
if intstartyear = "" then
intstartyear = year(now())
end if
if intendyear = "" then
intendyear = year(now()) + 9
end if
strtemp = "<select name=" & strname& " onchange=javascript: fnsubmit(" & chr(34) & strselflink & chr(34) & ")>" & vbcrlf
strtemp = strtemp & "<option value=" & 0 & ">" & "year" & "</option>" & vbcrlf
for i = intstartyear to intendyear
if strselected = cstr(i) then
strselectedstring = "selected"
else
strselectedstring = ""
end if
strtemp = strtemp & "<option value=" & i & " " & strselectedstring & " >" & i & "</option>" & vbcrlf
next
strtemp = strtemp & "</select>" & vbcrlf
yeardropdown = strtemp
end function
function daydropdown(strname, intstartday, intendday, strselected )
dim strtemp, i, strselectedstring
if intstartday = "" then
intstartday = 1
end if
if intendday = "" then
intendday = getdaysinmonth(month(now()),year(now()))
end if
strtemp = "<select name=" & strname& ">" & vbcrlf
strtemp = strtemp & "<option value=" & 0 & ">" & "day" & "</option>" & vbcrlf
for i = intstartday to intendday
if strselected = cstr(i) then
strselectedstring = "selected"
else
strselectedstring = ""
end if
strtemp = strtemp & "<option value=" & i & " " & strselectedstring & " >" & i & "</option>" & vbcrlf
next
strtemp = strtemp & "</select>" & vbcrlf
daydropdown = strtemp
end function
function getdaysinmonth(strmonth,stryear)
dim strdays
select case cint(strmonth)
case 1,3,5,7,8,10,12:
strdays = 31
case 4,6,9,11:
strdays = 30
case 2:
if ( (cint(stryear) mod 4 = 0 and cint(stryear) mod 100 <> 0) or ( cint(stryear) mod 400 = 0) ) then
strdays = 29
else
strdays = 28
end if
case else:
end select
getdaysinmonth = strdays
end function
%>
