<%
Dim shortest, longest, fdate, yr, fmonth, fday, ovulation1, ovulation2, thedate, fertile1, fertile2, fertile3, firstsafe1, firstsafe2, firstsafe3, secondsafe1, secondsafe2, secondsafe3, nextperiod1, nextperiod2,pos,ahead,ahead1,ahead2
shortest=request("shortest")
if shortest="Days" then Response.Redirect "datNatural_Family_Planning.asp"
longest=request("longest")
if longest="Days" then Response.Redirect "datNatural_Family_Planning.asp"
ahead=request("ahead")
if ahead="?" then ahead=1
yr=request("fyear")
if yr="?" or yr="" then yr=year(date)
fmonth=request("Fmonth")
if fmonth="Month" then Response.Redirect "datNatural_Family_Planning.asp"
fday=request("Fday")
if fday="Day" then Response.Redirect "datNatural_Family_Planning.asp"
thedate=DateSerial(yr, fmonth, fday)
ovulation1=DateAdd("d",shortest-14,thedate)
ovulation2=DateAdd("d",longest-14,thedate)
fertile1=DateAdd("d",-7,ovulation1)
fertile2=DateAdd("d",1,ovulation1)
fertile3=DateAdd("d",1,ovulation2)
firstsafe1=FormatDateTime(thedate,1)
firstsafe2=FormatDateTime(DateAdd("d",-1,fertile1),1)
firstsafe3=FormatDateTime(DateAdd("d",-1,fertile2),1)
secondsafe1=FormatDateTime(DateAdd("d",1,fertile3),1)
secondsafe2=FormatDateTime(DateAdd("d",shortest,thedate),1)
secondsafe3=FormatDateTime(DateAdd("d",longest,thedate),1)
nextperiod1=FormatDateTime(DateAdd("d",shortest,thedate),1)
nextperiod2=FormatDateTime(DateAdd("d",longest,thedate),1)
ahead1=FormatDateTime((thedate+ahead*shortest),1)
ahead2=FormatDateTime((thedate+ahead*longest),1)
if fmonth="1" then fmonth="January"
if fmonth="2" then fmonth="February"
if fmonth="3" then fmonth="March"
if fmonth="4" then fmonth="April"
if fmonth="5" then fmonth="May"
if fmonth="6" then fmonth="June"
if fmonth="7" then fmonth="July"
if fmonth="8" then fmonth="August"
if fmonth="9" then fmonth="September"
if fmonth="10" then fmonth="October"
if fmonth="11" then fmonth="November"
if fmonth="12" then fmonth="December"
if fday=1 or fday=21 or fday=31 then
pos="st"
elseif fday=2 or fday=22 then
pos="nd"
elseif fday=3 or fday=23 then
pos="rd"
else pos="th"
end if %>
Calculations are based on the following facts==>>
|