//==================== function AAsubmitBuyNowV3(ProductType, offer, page) //==================== // used on submit of form AA_BuyNow, checkes entries and then displays "AA_ConfirmDetails" { ProductType = getProductType ( ProductType ); if ( AAvalidate_Cover(ProductType, offer) ) { save_form(); location.href = page + location.search; } } //==================== function AAchangeDetailsV3(ProductType, offer, page) //==================== { ProductType = getProductType ( ProductType ); if (ProductType == "AccidentSupportPlan" ) { location.href = "AA_AccidentSupportPlan_" + page + location.search ; } else { location.href = "AA_" + page + location.search ; } } //==================== function AAcalculateQuoteV3(ProductType, offer, page) //==================== // page: AA_Quote: check details and calculate and display quote { ProductType = getProductType(ProductType); //Reset any Red static text.... colorChangeValueProvided(CoverDOB); colorChangeValueProvided(Covertxt); if ( ProductType == "FuneralCover" || ProductType == "TermLife" || ProductType == "MPI" || ProductType == "CriticalCare" || ProductType == "GuaranteedLife") { colorChangeValueProvided(Coversmoke); } // check Cover ======================= if ( ProductType == "FuneralCover" || ProductType == "TermLife" || ProductType == "MPI" || ProductType == "CriticalCare" || ProductType == "AccidentalDeath") { if (document.forms[0].Cover.options[document.forms[0].Cover.selectedIndex].text == "-Select-" ) { colorChangeValueRequired(Covertxt); document.forms[0].Cover.focus(); alert( "Please select your cover amount" ); return false; } else { colorChangeValueProvided(Covertxt); } } else if ( ProductType == "GuaranteedLife") { if (document.forms[0].premium.options[document.forms[0].premium.selectedIndex].text == "-Select-" ) { colorChangeValueRequired(Covertxt); document.forms[0].premium.focus(); alert( "Please select your premium amount" ); return false; } else { colorChangeValueProvided(Covertxt); } } // check DOB ========================= var minAge = document.forms[0].minAge.value; var maxAge = document.forms[0].maxAge.value; switch ( ProductType ) { case "TPD": minAge = 16; maxAge = 59; break; case "TermLife": minAge = 16; maxAge = 59; break; case "FuneralCover": minAge = 16; maxAge = 75; break; case "MPI": minAge = 16; maxAge = 59; break; case "CriticalCare": minAge = 16; maxAge = 59; break; case "GuaranteedLife": minAge = 50; maxAge = 79; break; case "AccidentalDeath": minAge = 16; maxAge = 74; break; case "AccidentSupportPlan": minAge = 16; maxAge = 79; break; default: minAge = 0; maxAge = 0; break; } if ( ProductType == "FuneralCover" || ProductType == "TermLife" || ProductType == "MPI" || ProductType == "CriticalCare" || ProductType == "GuaranteedLife" || ProductType == "AccidentalDeath") { formatDOBV2( "Your"); document.forms[0].AgeOK.value = "ok" if ( checkValidDate(document.forms[0].DOB.value) ) { colorChangeValueProvided(CoverDOB); } else { alert(" Please check your date of birth. It is not a valid date") document.forms[0].AgeOK.value = "notok" colorChangeValueRequired(CoverDOB); return false; } // calculate and check Age =========== var intCalcAge; intCalcAge = calculateAge(document.forms[0].DOB_YYYY.options[document.forms[0].DOB_YYYY.selectedIndex].text, document.forms[0].DOB_MM.options[document.forms[0].DOB_MM.selectedIndex].text, document.forms[0].DOB_DD.options[document.forms[0].DOB_DD.selectedIndex].text) document.forms[0].CalcAge.value = intCalcAge; if ( ( intCalcAge < minAge ) || ( intCalcAge > maxAge ) ) { document.forms[0].AgeOK.value = "notok" } } // check Gender ====================== if ( ProductType == "FuneralCover" || ProductType == "TermLife" || ProductType == "MPI" || ProductType == "CriticalCare" || ProductType == "GuaranteedLife") { if (getSelectedRadioTag(document.forms[0].gender) == "") { alert("Please select your gender") colorChangeValueRequired(Gender); return false; } else { colorChangeValueProvided(Gender); } } // check Smoker ====================== if ( ProductType == "FuneralCover" || ProductType == "TermLife" || ProductType == "MPI" || ProductType == "CriticalCare" || ProductType == "GuaranteedLife") { smokerOption = -1 for (i=0; i= bmi_max) | ((self.parent.GetValue('bmi') * 1) <= bmi_min) ) { special = "b"; } else { special = "c"; } } } document.forms[0].special.value = special; return special; } // =================== function setRadioButtonValue ( sName , sNewValue ) // =================== { var oRadioButtons = document.getElementsByName ( sName ); if ( oRadioButtons ) { for(var iRBloop=0; iRBloop 59 ) { document.forms[0].AgeOK.value = "notok" location.href = 'AA_NeedsAnalysis_AboveAge?OpenDocument' return false; } else if ( intCalcAge < 16 ) { document.forms[0].AgeOK.value = "notok" location.href = 'AA_NeedsAnalysis_BelowAge?OpenDocument' return false; } location.href = 'AA_NeedsAnalysis_2?OpenDocument' + NeedsQueryString; } // =================== function AAupdatePremiumFrequency( freqID ) // =================== { if (freqID == 1) { for(i=0; i < document.forms[0].PaymentType.length; i++) { if (document.forms[0].PaymentType[i].value == 'Cheque') { document.forms[0].PaymentType[i].disabled = true; if (document.forms[0].PaymentType[i].checked == true) { document.forms[0].PaymentType[i].checked = false; showPaymentFields('None'); } } } } else { for(i=0; i < document.forms[0].PaymentType.length; i++) { if (document.forms[0].PaymentType[i].value == 'Cheque') { document.forms[0].PaymentType[i].disabled = false; } } } } // =================== function getProductType(ProductType) // =================== { var prodtyp = ProductType.toLowerCase(); switch ( prodtyp ) { case "tpd": ProductType = "TPD"; break; case "termlife": ProductType = "TermLife"; break; case "funeralcover": ProductType = "FuneralCover"; break; case "mpi": ProductType = "MPI"; break; case "criticalcare": ProductType = "CriticalCare"; break; case "guaranteedlife": ProductType = "GuaranteedLife"; break; case "accidentaldeath": ProductType = "AccidentalDeath"; break; case "accidentsupportplan": ProductType = "AccidentSupportPlan" break; default: break; } return ProductType; } // =================== function showPartner(ProductType) // =================== { if ( ProductType == "FuneralCover" ) { document.getElementById( "PartnerInfo" ).style.display = "block" } else { document.getElementById( "PartnerInfo" ).style.display = "none" } } // =================== function ConfirmClientDetails() // =================== { product = getSelectedRadioTag(document.forms[0].ProductType); if ( ValidateQuoteDetails() ) { save_form(); if (product == '') { action = "AACentre_Quote"; } else { action = "AACentre_Quote_" + product; } action = action + '?OpenDocument'; action = action + '&aa=' + document.forms[0].AAMemberYN.value; action = action + '&ca=' + document.forms[0].CalcAge.value; action = action + '&g=' + document.forms[0].gender.value; action = action + '&s=' + document.forms[0].Smoker.value; action = action + '&aok=ok'; action = action + '&offer='; action = action + '&ProductType=' + product; action = action + '&c=' + document.forms[0].Cover.options[document.forms[0].Cover.selectedIndex].text; if (product == 'FuneralCover') { action = action + '&pa=' + getSelectedRadioTag(document.forms[0].PartnerYN); } location.href = action; } else { return false; } } // =================== function confirmDetails() // =================== { if ( ValidateClientDetails() ) { document.forms[0].mPremium.value = ""; document.forms[0].qPremium.value = ""; document.forms[0].hPremium.value = ""; document.forms[0].yPremium.value = ""; document.forms[0].QuoteMessage.value = ""; save_form(); location.href = "AACentre_Quote"; } else { return false; } } function makeSafe(str) { str = replace(str, " ", "%20"); str = replace(str, "&", "%26"); str = replace(str, "$", ""); str = replace(str, ",", ""); str = replace(str, ".", ""); return str; } AP_divs = new Array("AP_SAME","AP_DIFF"); function showApplicantDetails( divID ) { for ( i = 0; i < AP_divs.length ; i++) { if (AP_divs[i] == divID) { document.getElementById( AP_divs[i] ).style.display = "block" } else { document.getElementById( AP_divs[i] ).style.display = "none" } } } APP_Title_divs = new Array("AppOther","AppAnother"); function showAppOtherFields( divID ) { for ( i = 0; i < APP_Title_divs.length ; i++) { if (APP_Title_divs[i] == divID) { document.getElementById( APP_Title_divs[i] ).style.display = "block" } else { document.getElementById( APP_Title_divs[i] ).style.display = "none" } } } function ValidateClientDetails() { if (getSelectedRadioTag(document.forms[0].ApplicantInsured) == "") { alert( "Please specify if the applicant is also the life insured" ); colorChangeValueRequired(PaymentTypeCaption); return false; } else if (getSelectedRadioTag(document.forms[0].ApplicantInsured) == "AP_DIFF") { //Applicant is not life insured colorChangeValueProvided(PaymentTypeCaption); if (document.forms[0].Beneficiary_Title.options[document.forms[0].Beneficiary_Title.selectedIndex].text == "-Select-" ) { alert( "Please enter the applicants Title" ); document.forms[0].Beneficiary_Title.focus(); colorChangeValueRequired(AppTitle); return false; } else { if (document.forms[0].Beneficiary_Title.options[document.forms[0].Beneficiary_Title.selectedIndex].text == "Other") { if (document.forms[0].Beneficiary_OtherTitle.value == "") { alert( "Please enter the applicants Title" ); colorChangeValueRequired(AppTitle); document.forms[0].Beneficiary_OtherTitle.focus(); return false; } else { colorChangeValueProvided(Title); } } else { colorChangeValueProvided(Title); } } if (document.forms[0].Beneficiary_FirstNames.value == "" ) { alert( "Please provide the applicants First Name(s)" ); document.forms[0].Beneficiary_FirstNames.focus(); colorChangeValueRequired(ApplicantFirstName); return false; } else { colorChangeValueProvided(ApplicantFirstName); } if (document.forms[0].Beneficiary_LastName.value == "" ) { alert( "Please provide the applicants Last name" ); document.forms[0].Beneficiary_LastName.focus(); colorChangeValueRequired(ApplicantLastName); return false; } else { colorChangeValueProvided(ApplicantLastName); } if (document.forms[0].Beneficiary_Title.options[document.forms[0].Beneficiary_Title.selectedIndex].text == "Other" ) { document.forms[0].Beneficiary_FullName.value = document.forms[0].Beneficiary_OtherTitle.value + " " +document.forms[0].Beneficiary_FirstNames.value + " " + document.forms[0].Beneficiary_LastName.value } else { document.forms[0].Beneficiary_FullName.value = document.forms[0].Beneficiary_Title.options[document.forms[0].Beneficiary_Title.selectedIndex].text + " " +document.forms[0].Beneficiary_FirstNames.value + " " + document.forms[0].Beneficiary_LastName.value } if (document.forms[0].BeneAddress.value == "" ) { alert( "Please provide the applicants Address" ); document.forms[0].BeneAddress.focus(); colorChangeValueRequired(ApplicantAddress); return false; } else { colorChangeValueProvided(ApplicantAddress); } if (document.forms[0].BeneSuburb.value == "" ) { alert( "Please provide the applicants suburb" ); document.forms[0].BeneSuburb.focus(); colorChangeValueRequired(ApplicantSuburb); return false; } else { colorChangeValueProvided(ApplicantSuburb); } if (document.forms[0].BeneCity.value == "" ) { alert( "Please provide the applicants City" ); document.forms[0].BeneCity.focus(); colorChangeValueRequired(ApplicantCity); return false; } else { colorChangeValueProvided(ApplicantCity); } if (checkPhoneNumber(document.forms[0].BeneAreaCode_HomeNumber.value, document.forms[0].BeneHomeNumber.value)) { colorChangeValueProvided(ApplicantHomeTelephone); document.forms[0].BeneFullHomeNumber.value = document.forms[0].BeneAreaCode_HomeNumber.value + ' ' + document.forms[0].BeneHomeNumber.value; } else { // alert("The applicants Home Phone number provided is not a valid phone number."); // document.forms[0].BeneAreaCode_HomeNumber.focus(); // colorChangeValueRequired(ApplicantHomeTelephone); // return false; } if ( document.forms[0].BeneAreaCode_WorkNumber.value.length != "0" || document.forms[0].BeneWorkNumber.value.length != "0" ) { document.forms[0].BeneFullWorkNumber.value = document.forms[0].BeneAreaCode_WorkNumber.value + ' ' + document.forms[0].BeneWorkNumber.value; } else { document.forms[0].BeneFullWorkNumber.value = ""; } if (document.forms[0].BeneEmail.value=="") { alert( "Please provide the applicants Email address"); document.forms[0].BeneEmail.focus(); colorChangeValueRequired(ApplicantEmail); return false; } else { if (checkEmailAddress(document.forms[0].BeneEmail.value)){ colorChangeValueProvided(ApplicantEmail); } else { document.forms[0].BeneEmail.focus(); colorChangeValueRequired(ApplicantEmail); return false; } } } colorChangeValueProvided(PaymentTypeCaption); //Validate the Life Insured details if (document.forms[0].Title.options[document.forms[0].Title.selectedIndex].text == "-Select-" ) { alert( "Please enter the Title for the Life Insured" ); document.forms[0].Title.focus(); colorChangeValueRequired(Title); return false; } else { if (document.forms[0].Title.options[document.forms[0].Title.selectedIndex].text == "Other") { if (document.forms[0].OtherTitle.value == "") { alert( "Please enter the Title for the Life Insured" ); colorChangeValueRequired(Title); document.forms[0].OtherTitle.focus(); return false; } else { colorChangeValueProvided(Title); } } else { colorChangeValueProvided(Title); } } if (document.forms[0].FirstNames.value == "" ) { alert( "Please provide the First Name(s) for the Life Insured" ); document.forms[0].FirstNames.focus(); colorChangeValueRequired(FirstNames); return false; } else { colorChangeValueProvided(FirstNames); } if (document.forms[0].LastName.value == "" ) { alert( "Please provide the Last name for the Life Insured" ); document.forms[0].LastName.focus(); colorChangeValueRequired(LastName); return false; } else { colorChangeValueProvided(LastName); } if (document.forms[0].Title.options[document.forms[0].Title.selectedIndex].text == "Other" ) { document.forms[0].FullName.value = document.forms[0].OtherTitle.value + " " +document.forms[0].FirstNames.value + " " + document.forms[0].LastName.value } else{ document.forms[0].FullName.value = document.forms[0].Title.options[document.forms[0].Title.selectedIndex].text + " " +document.forms[0].FirstNames.value + " " + document.forms[0].LastName.value } document.forms[0].DOB.value = document.forms[0].DOB_DD.options[document.forms[0].DOB_DD.selectedIndex].text + "/" + document.forms[0].DOB_MM.options[document.forms[0].DOB_MM.selectedIndex].text + "/" + document.forms[0].DOB_YYYY.options[document.forms[0].DOB_YYYY.selectedIndex].text; document.forms[0].DOBDDMMYYYY.value = document.forms[0].DOB.value; if ( checkValidDate(document.forms[0].DOB.value) ) { colorChangeValueProvided(DOB); } else{ alert(" Please check the date of birth. It is not a valid date") colorChangeValueRequired(DOB); return false; } var intCalcAge; intCalcAge = calculateAge(document.forms[0].DOB_YYYY.options[document.forms[0].DOB_YYYY.selectedIndex].text, document.forms[0].DOB_MM.options[document.forms[0].DOB_MM.selectedIndex].text, document.forms[0].DOB_DD.options[document.forms[0].DOB_DD.selectedIndex].text) document.forms[0].CalcAge.value = intCalcAge; smokerOption = -1 for (i=0; i 75) { //to old for all products alert ('Life insured is to old to be covered by AA Life products.'); for(var i=0;i 59) { //to old for term life for(var i=0;i this.beforeLength) && (this.value.length >= this.maxLength)) this.nextField.focus(); downStrokeField=null; } divs = new Array("AnnuallyPayment","NotAnnuallyPayment", "PM_EasyPay", "PM_Other", "Credit Card" , "Direct Debit" , "Cheque", "Direct Debit Online", "Other","Another", "Has Individual Signing Authority", "Does not have Individual Signing Authority", "BeneOther","BeneAnother", "BlankValues", "ValuesFilled", "Please send me a Direct Debit form","I will download a Direct Debit form"); //==================== function AAshowDivFields( divID ) //==================== { for ( i = 0; i < divs.length ; i++) { if (divs[i] == divID) { document.getElementById( divs[i] ).style.display = "block" } else { document.getElementById( divs[i] ).style.display = "none" } } } //==================== function AAvalidate_Cover(ProductType, offer) //==================== //used in function "AAsubmitBuyNow(ProductType, offer)" to check the application details on page "AA_BuyNow" { document.forms[0].offer.value = offer; document.forms[0].ProductType.value = ProductType; if (offer = "0" ) { if (document.forms[0].Customer_HearAbout.options[document.forms[0].Customer_HearAbout.selectedIndex].text == "-Select-" ) { alert( "Please select how you heard about us." ); document.forms[0].Customer_HearAbout.focus(); colorChangeValueRequired(HowDidYouHearAboutUs); return false; } else { colorChangeValueProvided(HowDidYouHearAboutUs); if (document.forms[0].Customer_HearAbout.options[document.forms[0].Customer_HearAbout.selectedIndex].text == "Other" ) { if (document.forms[0].Customer_HearAbout_Specify.value == "" ) { alert( "Please provide more information on how you heard about us." ); document.forms[0].Customer_HearAbout_Specify.focus(); colorChangeValueRequired(HowDidYouHearAboutUs_Specify); return false; } else { colorChangeValueProvided(HowDidYouHearAboutUs_Specify); } } else { document.forms[0].Customer_HearAbout_Specify.value = document.forms[0].Customer_HearAbout.options[document.forms[0].Customer_HearAbout.selectedIndex].text; } var hearaboutcode = document.forms[0].Customer_HearAbout.options[document.forms[0].Customer_HearAbout.selectedIndex].value; document.forms[0].Customer_HearAbout_Code.value = hearaboutcode; } } if ( ProductType != "AccidentSupportPlan" ) { // ---Premium ---------------- PremiumOption = -1 for (i=0; i maxAge ) ) { alert(" We don't cover this age.") document.forms[0].AgeOK.value = "notok" colorChangeValueRequired(DOB); return false; } } // ---Address ------------------ if (document.forms[0].Address.value == "" ) { alert( "Please provide your Address" ); document.forms[0].Address.focus(); colorChangeValueRequired(Address); return false; } else { colorChangeValueProvided(Address); } // ---Suburb ------------------ if (document.forms[0].Suburb.value == "" ) { alert( "Please provide your suburb" ); document.forms[0].Suburb.focus(); colorChangeValueRequired(Suburb); return false; } else { colorChangeValueProvided(Suburb); } // ---City ------------------ if (document.forms[0].City.value == "" ) { alert( "Please provide your City" ); document.forms[0].City.focus(); colorChangeValueRequired(City); return false; } else { colorChangeValueProvided(City); } // ---HomePhoneNumber ------------------ if (checkPhoneNumber(document.forms[0].AreaCode_HomeNumber.value, document.forms[0].HomeNumber.value)) { colorChangeValueProvided(HomeTelephone); document.forms[0].FullHomeNumber.value = document.forms[0].AreaCode_HomeNumber.value + ' ' + document.forms[0].HomeNumber.value; } else { // alert("The Home Phone number provided is not a valid phone number."); // document.forms[0].AreaCode_HomeNumber.focus(); // colorChangeValueRequired(HomeTelephone); // return false; } // ---WorkPhoneNumber ------------------ if ( document.forms[0].AreaCode_WorkNumber.value.length != "0" || document.forms[0].WorkNumber.value.length != "0" ) { document.forms[0].FullWorkNumber.value = document.forms[0].AreaCode_WorkNumber.value + ' ' + document.forms[0].WorkNumber.value; } else { document.forms[0].FullWorkNumber.value = ""; } // ---Email ------------------ if (document.forms[0].Email.value=="") { alert( "Please provide your Email address"); document.forms[0].Email.focus(); colorChangeValueRequired(Email); return false; } else { if ( checkEmailAddress(document.forms[0].Email.value) ) { //do nothing - this is correct... colorChangeValueProvided(Email); } else { document.forms[0].Email.focus(); colorChangeValueRequired(Email); return false; } } // ---AAMember ------------------ if ( ProductType == "AccidentSupportPlan" ) { AAMemberOption = -1 for (i=0; i'; if (freqID == 1) { for(i=0; i < document.forms[0].PaymentType.length; i++) { if (document.forms[0].PaymentType[i].value == 'Cheque') { document.forms[0].PaymentType[i].disabled = true; if (document.forms[0].PaymentType[i].checked == true) { document.forms[0].PaymentType[i].checked = false; showPaymentFields('None'); } } } } else { for(i=0; i < document.forms[0].PaymentType.length; i++) { if (document.forms[0].PaymentType[i].value == 'Cheque') { document.forms[0].PaymentType[i].disabled = false; } } } } //==================== function validate_Radio(radio,msg) //==================== // not used in another function here { vld = 0; for (var x = 0;x < radio.length; x++) { if (radio[x].checked) { vld = 1; return "1"; } } if(vld == 0) { alert(msg); return "0"; } } PaymentFreq = new Array("AnnuallyPayment","NotAnnuallyPayment"); //==================== function showPaymentFreqFields( divID ) //==================== // not used in another function here { for ( i = 0; i < PaymentFreq.length ; i++) { if (PaymentFreq[i] == divID) { document.getElementById( PaymentFreq[i] ).style.display = "block" } else { document.getElementById( PaymentFreq[i] ).style.display = "none" } } } //==================== function showAAMemberFields( divID ) //==================== // maybe used in AccidentSupportPlan { if (divID == "Yes") { document.getElementById( "AAMember_Caption" ).style.display = "block"; document.getElementById( "AAMember_Caption" ).style.visibility = "visible" // document.getElementById( "AAMember_Number" ).style.display = "block"; // document.getElementById( "AAMember_Number" ).style.visibility = "visible" document.getElementById( "Cover_AADiscount" ).style.display = "block"; document.getElementById( "Cover_AADiscount" ).style.visibility = "visible" document.getElementById( "Cover_Normal" ).style.display = "none"; document.getElementById( "Cover_Normal" ).style.visibility = "hidden" } else { document.getElementById( "AAMember_Caption" ).style.display = "none"; document.getElementById( "AAMember_Caption" ).style.visibility = "hidden" // document.getElementById( "AAMember_Number" ).style.display = "none"; // document.getElementById( "AAMember_Number" ).style.visibility = "hidden" document.getElementById( "Cover_AADiscount" ).style.display = "none"; document.getElementById( "Cover_AADiscount" ).style.visibility = "hidden" document.getElementById( "Cover_Normal" ).style.display = "block"; document.getElementById( "Cover_Normal" ).style.visibility = "visible" } for(var i=0;i 12) || (month < 1)) { return false; } else if (month == 2) { var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); if ((day > 29) || (day < 1) || ((day == 29) && !isleap)) { return false; } } else if ((month==4 || month==6 || month==9 || month==11) && ((day > 30) || (day < 1))) { return false; } else if ((day > 31) || (day < 1)) { return false; } return true; } //========================= function calculateAge(dobYear, dobMonth, dobDay) //========================= { var nowDate = new Date(); var nowYear = nowDate.getYear(); if (nowYear == 0) { nowYear = 2000; } else if (nowYear < 1900) { nowYear = nowYear + 1900; } var nowMonth = nowDate.getMonth() + 1; var nowDay = nowDate.getDate(); var currAge = nowYear - dobYear; if ((nowMonth < dobMonth) || ((nowMonth == dobMonth) && (nowDay < dobDay))) { currAge = currAge - 1; } if (currAge < 0) { currAge = 0; } return currAge; } //==================== function checkPartner() //==================== { // check partner's title =============== if (document.forms[0].PartnerTitle.options[document.forms[0].PartnerTitle.selectedIndex].text == "-Select-" ) { alert( "Please enter your partner's Title" ); document.forms[0].PartnerTitle.focus(); // colorChangeValueRequired(PartnerTitle); return false; } else { colorChangeValueProvided(PartnerTitle); } if (document.forms[0].PartnerTitle.options[document.forms[0].PartnerTitle.selectedIndex].text == "Other" && document.forms[0].PartnerOtherTitle.value == "") { alert( "Please enter your partner's Title" ); document.forms[0].PartnerOtherTitle.focus(); // colorChangeValueRequired(PartnerTitle); return false; } else { colorChangeValueProvided(PartnerTitle); } // check partner's first names =============== if (document.forms[0].PartnerFirstNames.value == "" ) { alert( "Please provide your partner's First Name(s)" ); document.forms[0].PartnerFirstNames.focus(); return false; } // check partner's last name =============== if (document.forms[0].PartnerLastName.value == "" ) { alert( "Please provide your partner's Last name" ); document.forms[0].PartnerLastName.focus(); return false; } // check partner's DOB ======================= formatDOBV2( "Partner" ); if ( checkValidDate(document.forms[0].Partner_DOB.value) ) { colorChangeValueProvided(PartnerCoverDOB); } else { alert(" Please check your partner's date of birth. It is not a valid date") colorChangeValueRequired(PartnerCoverDOB); return false; } return true; } // ================= function AAcalcRefCode( ProductType, offer) // ================= { //----------------------------------------------------------- //Offer AAMember Customer_HearAbout_Code ReferenceCode //"0" Yes B03 //"0" No B04 //!="0" Yes "" | "99" B09 //!="0" No "" | "99" B10 //!="0" Yes !"" & !="99" Customer_HearAbout_Code //!="0" No !"" & !="99" Customer_HearAbout_Code //----------------------------------------------------------- // if ( document.forms[0].ReferenceCode.value == "" ) // { sAAMember = ""; if (isObject(document.getElementById("AAMemberYN"))) { if (document.getElementById("AAMemberYN").value == undefined) { sAAMember = getSelectedRadioTag(document.getElementById("AAMemberYN")); } else { sAAMember = document.getElementById("AAMemberYN").value; } } if ( sAAMember == "" ) sAAMember = "No"; sAltChannelCode = ""; if (isObject(document.getElementById("Customer_HearAbout_Code"))) { sAltChannelCode = document.getElementById("Customer_HearAbout_Code").value; } if ( sAltChannelCode == "") sAltChannelCode = "99"; // ---------------------------------- // calculation of reference Code // ---------------------------------- var refcode = "" if (offer == "0") { if (sAAMember == "Yes") { refcode = "B03"; } else { refcode = "B04"; } } else if ( sAltChannelCode == "99") { if (sAAMember == "Yes") { refcode = "B09"; } else { refcode = "B10"; } } else { refcode = sAltChannelCode; } document.forms[0].ReferenceCode.value = refcode; // } } // ================= function save_form() // ================= { for (var i=0;i= 0; i--) { calc = Number(cardNo.charAt(i)) * j; if (calc > 9) { checksum = checksum + 1; calc = calc - 10; } checksum = checksum + calc; if (j ==1) {j = 2} else {j = 1}; } if (checksum % 10 != 0) { ccErrorNo = 3; alert(ccErrors[ccErrorNo]); return false; } } var LengthValid = false; var PrefixValid = false; var undefined; var prefix = new Array (); var lengths = new Array (); prefix = cards[cardType].prefixes.split(","); for (i=0; i255) { alert( errMsg ); return false } } return true } var domainArray=domain.match(domainPat) if (domainArray==null) { alert( errMsg ); return false } var atomPat=new RegExp(atom,"g") var domArr=domain.match(atomPat) var len=domArr.length if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>4) { alert( errMsg ); return false } if (len<2) { alert( errMsg ); return false } return true; } function checkValidAAMembershipNumber(aaNum) { if (aaNum.length != 16) { return false; } else if (aaNum.substr(0,4) != "3083") { return false; } else { var j = 0; var k = 0; for (var i = 0;i <= 14; i++) { k = Number(aaNum.charAt(i)); if (i % 2 == 1) { k = k * 2; if (k >= 10) { k = Number(String(k).charAt(0)) + Number(String(k).charAt(1)); } } j = j + k; } return (aaNum.charAt(15) == ((10 - j % 10) % 10)); } } //================== function load_form() //================== { for (var i=0;i"); } function set_value( fieldname ) { document.write(""); } function showDiv( divID ) { document.getElementById( divID ).style.display = "block"; } function hideDiv( divID) { document.getElementById( divID ).style.display = "none"; } //======================= function getSelectedRadioTag(radioGroup) //======================= { for(var i=0;i