function focusit(strThis, strAlert){ alert(strAlert); strThis.focus(); return (false)
}
function Form_Validator(theForm){ var oError = new Error(); if (theForm.Medication.value == "< -- PLEASE CHOOSE ONE -- >"){ return focusit(theForm.Medication, 'Please choose a medication.');}
var goodEmail = theForm.Email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.org)|(\.biz)|(\.info)|(\.us)|(\..{2,2}))$)\b/gi); if (goodEmail){ good = true
}
else{ alert('Please enter a valid e-mail address'); theForm.Email.focus(); theForm.Email.select(); return (false);}
if ((theForm.FirstName.value.length < 1)){ return focusit(theForm.FirstName, 'Please enter your First name.');}
if ((theForm.LastName.value.length < 1)){ return focusit(theForm.LastName, 'Please enter your Last name.');}
if (theForm.DayTimePhone.value == ""){ return focusit(theForm.DayTimePhone, 'Please enter your Day Time Phone.');}
if (theForm.DayTimePhone.value.length < 10){ return focusit(theForm.DayTimePhone, 'Please enter your full telephone number, area code first.');}
if ((theForm.BillingName.value.length < 2)){ return focusit(theForm.BillingName, 'Please enter the Credit Card Holder\'s name.');}
if (theForm.CreditCardType.value == "< -- Choose Card -- >"){ return focusit(theForm.CreditCardType, 'Please choose a credit card type');}
if ((theForm.cardverification.value.length < 2)){ return focusit(theForm.cardverification, 'Please enter your credit card verification number');}
if ((theForm.CreditCardNumber.value.length < 14)){ return focusit(theForm.CreditCardNumber, 'Please enter your credit card number correctly');}
if ((theForm.CreditCardExpirationDate.value.length != 5)){ return focusit(theForm.CreditCardExpirationDate, 'Please enter your credit card expiration date correctly as shown in the example');}
if ((theForm.BillingStreet.value.length < 1)){ return focusit(theForm.BillingStreet, 'Please enter your billing street address');}
if ((theForm.BillingCity.value.length < 1)){ return focusit(theForm.BillingCity, 'Please enter your billing city');}
if (theForm.BillingState.value == "< -- Choose State -- >"){ return focusit(theForm.BillingState, 'Please choose your billing state');}
if ((theForm.BillingZipCode.value.length < 5)){ return focusit(theForm.BillingZipCode, 'Please enter your billing zip code');}
if ((theForm.ShippingStreet.value.length < 1)){ return focusit(theForm.ShippingStreet, 'Please enter your shipping street address');}
if (theForm.ShippingCity.value.length < 1){ return focusit(theForm.ShippingCity, 'Please enter your shipping city');}
if (theForm.ShippingState.value == "< -- Choose State -- >"){ return focusit(theForm.ShippingState, 'Please choose your shipping state');}
if (theForm.ShippingZipCode.value.length < 5){ return focusit(theForm.ShippingZipCode, 'Please enter your shipping zip code');}
if (theForm.M_DateOfBirth.value.length < 6){ return focusit(theForm.M_DateOfBirth, 'Please enter your date of birth correctly');}
if (theForm.M_Sex.value == "Choose"){ return focusit(theForm.M_Sex, 'Please choose your sex');}
if (theForm.M_HighBloodPressure.value == "Choose"){ return focusit(theForm.M_HighBloodPressure, 'Do you have high blood pressure?');}
if (theForm.M_IAgreeOTC.value == "Choose"){ return focusit(theForm.M_IAgreeOTC, 'Agree not to take OTC medicine?');}
if (theForm.M_IAgreeBloodPressure.value == "Choose"){ return focusit(theForm.M_IAgreeBloodPressure, 'Agree to check your blood pressure?');}
if (theForm.M_MedicalConditions.value == ""){ return focusit(theForm.M_MedicalConditions, 'Do you have any medical conditions? If no, type none');}
if (theForm.M_CurrentMedications.value == ""){ return focusit(theForm.M_CurrentMedications, 'Are you taking any medications? If no, type none');}
if (theForm.M_MedicationList.value == ""){ return focusit(theForm.M_MedicationList, 'Do you plan to take any medications? If no, type none');}
if (theForm.M_MedicationList.value.length < 1){ return focusit(theForm.M_MedicationList, 'Do you plan to take any medications? If no, type none');}
if (theForm.M_Allergies.value.length < 1){ return focusit(theForm.M_Allergies, 'Do you have any allergies? If no, type none');}
if (theForm.M_Surgery.value.length < 1){ return focusit(theForm.M_Surgery, 'Have you ever had surgery? If no, type none');}
if (theForm.M_MedicalHistory.value.length < 1){ return focusit(theForm.M_MedicalHistory, 'Anything else relevant to medical history? If no, type none');}
if (theForm.PatientResponsibilityStatement.value == "Choose"){ return focusit(theForm.PatientResponsibilityStatement, 'Agree with the Patient Responsibility Statement to proceed');}
if (theForm.PatientResponsibilityStatement.value == "No"){ return focusit(theForm.PatientResponsibilityStatement, 'Agree with the Patient Responsibility Statement to proceed');}
if (theForm.InformedConsent.value == "Choose"){ return focusit(theForm.InformedConsent, 'Agree with the Informed Consent Statement to proceed');}
if (theForm.InformedConsent.value == "No"){ return focusit(theForm.InformedConsent, 'Agree with the Informed Consent Statement to proceed');}
}
function compute(){ var f = self.document.forms[0]; w = f.wt.value; v = f.htf.value; u = f.hti.value; if (!chkw(u)){ var ii = 0; f.hti.value = 0;} else { var ii = parseInt(f.hti.value);}
var fi = parseInt(f.htf.value * 12); var i = fi + ii; if (!chkw(v)){ focusit(f.htf, 'Please enter a number for your height');}
if (!chkw(w)){ focusit(f.wt, 'Please enter a number for your weight');}
f.bmi.value = cal_bmi(w, i); f.bmi.focus();}
var ShippingStreet; var ShippingSuite; var ShippingCity; var ShippingState
var ShippingZipCode; var ShippingStateIndex = 0; function InitSaveVariables(form) { ShippingStreet = form.ShippingStreet.value; ShippingSuite = form.ShippingSuite.value; ShippingCity = form.ShippingCity.value; ShippingZipCode = form.ShippingZipCode.value; ShippingStateIndex = form.ShippingState.selectedIndex; ShippingState = form.ShippingState[ShippingStateIndex].value;}
function ShipToBillPerson(form) { if (form.copy.checked) { InitSaveVariables(form); form.ShippingStreet.value = form.BillingStreet.value; form.ShippingSuite.value = form.BillingSuite.value; form.ShippingCity.value = form.BillingCity.value; form.ShippingZipCode.value = form.BillingZipCode.value; form.ShippingState.selectedIndex = form.BillingState.selectedIndex;}
else { form.ShippingStreet.value = ShippingStreet; form.ShippingSuite.value = ShippingSuite; form.ShippingCity.value = ShippingCity; form.ShippingZipCode.value = ShippingZipCode; form.ShippingState.selectedIndex = ShippingStateIndex;}
}
function check_date(field){ var checkstr = "0123456789"; var DateField = field; var DateValue = ""; var DateTemp = ""; var seperator = "/"; var day = 0; var month = 0; var year = 0; var leap = 0; var err = 0; var i; err = 0; DateValue = DateField.value; for (i = 0; i < DateValue.length; i++) { if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) { DateTemp = DateTemp + DateValue.substr(i,1);}
}
DateValue = DateTemp; if (DateValue.length == 6) { DateValue = DateValue.substr(0,4) + '19' + DateValue.substr(4,2);}
if (DateValue.length != 8) { err = 19;}
year = DateValue.substr(4,4); if (year == 0) { err = 20;}
month = DateValue.substr(0,2); if ((month < 1) || (month > 12)) { err = 21;}
day = DateValue.substr(2,2); if (day < 1) { err = 22;}
if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) { leap = 1;}
if ((month == 2) && (leap == 1) && (day > 29)) { err = 23;}
if ((month == 2) && (leap != 1) && (day > 28)) { err = 24;}
if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) { err = 25;}
if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) { err = 26;}
if ((day == 0) && (month == 0) && (year == 00)) { err = 0; day = ""; month = ""; year = ""; seperator = "";}
if (err == 0) { DateField.value = month + seperator + day + seperator + year;}
else { alert("Date is incorrect!"); DateField.select(); DateField.focus();}
}
function disableForm(theform) { if (document.all || document.getElementById) { for (i = 0; i < theform.length; i++) { var tempobj = theform.elements[i]; if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
tempobj.disabled = true;}
setTimeout('alert("Your form has been submitted.  Notice how the submit and reset buttons were disabled upon submission.")', 2000); return true;}
else { alert("The form has been submitted.  But, since you're not using IE 4+ or NS 6, the submit button was not disabled on form submission."); return false;}
}
