<% Option Explicit %> <% if PG="" then PG = "ATM OB Calculator" if HREFOFST="" then HREFOFST = "" if UPDATED="" then UPDATED = "December 28, 2007" if JSCRIPT="" then JSCRIPT = "" if LOGINREQUIRED="" then LOGINREQUIRED = "" dim z dim D_Months, D_Weekday Set D_Months = Server.CreateObject("Scripting.Dictionary") D_Months.add 1, "January" D_Months.add 2, "February" D_Months.add 3, "March" D_Months.add 4, "April" D_Months.add 5, "May" D_Months.add 6, "June" D_Months.add 7, "July" D_Months.add 8, "August" D_Months.add 9, "September" D_Months.add 10, "October" D_Months.add 11, "November" D_Months.add 12, "December" Set D_Weekday = Server.CreateObject("Scripting.Dictionary") D_Weekday.add 1, "Sunday" D_Weekday.add 2, "Monday" D_Weekday.add 3, "Tuesday" D_Weekday.add 4, "Wednesday" D_Weekday.add 5, "Thursday" D_Weekday.add 6, "Friday" D_Weekday.add 7, "Saturday" function MonthLength(monthNum, theYr) dim isLeap select case monthNum case 1 MonthLength = 31 case 2 isLeap = ((CInt(theYr) mod 4) = 0) if isLeap then MonthLength = 29 else MonthLength = 28 end if case 3 MonthLength = 31 case 4 MonthLength = 30 case 5 MonthLength = 31 case 6 MonthLength = 30 case 7 MonthLength = 31 case 8 MonthLength = 31 case 9 MonthLength = 30 case 10 MonthLength = 31 case 11 MonthLength = 30 case 12 MonthLength = 31 case else MonthLength = 0 end select end function dim mn, theDay, yr, obtype, yourname, cycle if PGPOSTED then mn = request.form("month") theDay = request.form("day") yr = request.form("year") obtype = request.form("obtype") yourname = request.form("yourname") cycle = request.form("cycle") else mn = D_Months.item(Month(Now())) theDay = Day(Now()) yr = Year(Now()) obtype = "" yourname = "" cycle = 28 end if %>
Due Date Calculator
Calculate based on:
/> Last menses, on a day cycle.    /> Date of Conception.    /> Due Date.
 /   / 

Your Name:

<% if PGPOSTED then dim DArr(366), dateStr dateStr = mn & " " & theday & ", " & yr select case obtype case "menses" 'do nothing case "conception" dateStr = DateAdd("d", x - 13, dateStr) case "duedate" dateStr = DateAdd("d", x - 280, dateStr) end select for x = 1 to 366 DArr(x) = DateAdd("d", x - 1, dateStr) next %>

Congratulations!
Your due date is <%=CStr(D_Weekday.item(Weekday(DArr(281))) & ", " & D_Months.item(Month(DArr(281))) & " " & Day(DArr(281)) & ", " & Year(DArr(281)))%>!


Your Pregnancy Calendar
Printable Version

Name <%=yourname%> Based On <%=iif(obtype="menses" , "Last Menses - " & cycle & " day cycle" , iif(obtype="conception" , "Conception Date", iif(obtype="duedate" , "Due Date" , "") ) )%> Chart Date <%=FormatDateTime(CSTNow())%>
Last Menses <%=FormatDateTime(DArr(1),1)%> Conception <%=FormatDateTime(DArr(14),1)%> Due Date <%=FormatDateTime(DArr(281),1)%>
<% dim w, d, x, m, color dim cal(3), monStartWkDay, currentMonth, blnWrite, currentWkDay, monthDay dim dayNumValue, dayValue, endOfMonth, hasStarted, lengthOfMonth, monthCount w = 0 d = 0 x = 1 monthCount = 1 cal(0) = Weekday(DArr(x)) cal(1) = Month(DArr(x)) cal(2) = Day(DArr(x)) cal(3) = Year(DArr(x)) currentMonth = 0 blnWrite = false hasStarted = false monStartWkDay = Weekday(CDate(cal(1) & " 1, " & cal(3))) for m = 1 to 24 if m = CInt(cal(1)) then blnWrite = true if blnWrite then currentMonth = CInt(Month(DArr(x))) dayNumValue = "" dayValue = "" lengthOfMonth = MonthLength(Month(DArr(x)),Year(DArr(x))) if monthCount = 1 then %><% end if %> <% monthCount = monthCount + 1 if monthCount = 3 then monthCount = 1 %><% end if %> <% end if %> <% next %> <%=iif(monthCount<>1,"","")%>
<% currentWkDay = 1 monthDay = 1 endOfMonth = false for d = 1 to 42 %><%=iif(currentWkDay = 1,"","")%><% if monStartWkDay > d or endOfMonth then %> <% currentWkDay = currentWkDay + 1 else color = "" if ((hasStarted or monthDay=cal(2)) and blnWrite) then hasStarted = true if x=1 or x=14 or x=281 then _ color="class=""c_special""" %> <% x = x + 1 if x > 295 then blnWrite = false else %> <% end if monthDay = monthDay + 1 endOfMonth = (monthDay > lengthOfMonth) currentWkDay = currentWkDay + 1 if endOfMonth then monStartWkDay = currentWkDay end if if currentWkDay = 8 then %><%=""%><% currentWkDay = 1 end if %> <% next %>
<%=D_Months.item(Month(DArr(x)))%> <%=Year(DArr(x))%>
Sun Mon Tue Wed Thu Fri Sat
 
 
>
<%=monthDay%>
<%=x%> / <%=Int((x-1)/7)%>+<%=Int((x-1) mod 7)%>
<%=monthDay%>
 
<% end if %>