<!--Begin
function isValidDate(dateStr){var datePat=/^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;var matchArray=dateStr.match(datePat);if(matchArray==null){alert("Tarih Geçerli formatda değil.")
return false;}
month=matchArray[1];day=matchArray[3];year=matchArray[4];if(month<1||month>12){alert("Ay 1 ile 12 arasında olmalı.");return false;}
if(day<1||day>31){alert("gün 1 ve 31 arasında olmalı.");return false;}
if((month==4||month==6||month==9||month==11)&&day==31){alert("Month "+month+" doesn't have 31 days!")
return false;}
if(month==2){var isleap=(year%4==0&&(year%100!=0||year%400==0));if(day>29||(day==29&&!isleap)){alert("February "+year+" doesn't have "+day+" days!");return false;}}
return true;}
function dispDate(dateObj){month=dateObj.getMonth()+1;month=(month<10)?"0"+month:month;day=dateObj.getDate();day=(day<10)?"0"+day:day;year=dateObj.getYear();if(year<2000)year+=1900;return(month+"/"+day+"/"+year);}
function pregnancyCalc(pregform){menstrual=new Date();ovulation=new Date();duedate=new Date();today=new Date();cycle=0,luteal=0;if(isValidDate(pregform.menstrual.value)){menstrualinput=new Date(pregform.menstrual.value);menstrual.setTime(menstrualinput.getTime())}
else return false;cycle=(pregform.cycle.value==""?28:pregform.cycle.value);if(pregform.cycle.value!=""&&(pregform.cycle.value<22||pregform.cycle.value>45)){alert("Your cycle length is either too short or too long for \n"
+"calculations to be very accurate!  We will still try to \n"
+"complete the calculation with the figure you entered. ");}
luteal=(pregform.luteal.value==""?14:pregform.luteal.value);if(pregform.luteal.value!=""&&(pregform.luteal.value<9||pregform.luteal.value>16)){alert("Your luteal phase length is either too short or too long for \n"
+"calculations to be very accurate!  We will still try to complete \n"
+"the calculation with the figure you entered. ");}
ovulation.setTime(menstrual.getTime()+(cycle*86400000)-(luteal*86400000));pregform.conception.value=dispDate(ovulation);duedate.setTime(ovulation.getTime()+266*86400000);pregform.duedate.value=dispDate(duedate);var fetalage=14+266-((duedate-today)/86400000);weeks=parseInt(fetalage/7);days=Math.floor(fetalage%7);fetalage=weeks+" hafta"+(weeks>1?" ":"")+", "+days+" gün";pregform.fetalage.value=fetalage;return false;}
