//=================== function confirmDetailsFC() //=================== { if ( validate_Cover() ) { if (document.forms[0].PartnerYN.value == "Yes") { check = checkPartner() } else { check = true } if ( check == true ) { save_form(); location.href = "AACentre_FuneralCover_ConfirmDetails" + location.search; } } } //==================== 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 makeSafeV2(str) //==================== { str = replace(str, " ", "%20"); str = replace(str, "&", "%26"); str = replace(str, "$", ""); str = replace(str, ",", ""); str = replace(str, ".", ""); return str; } //==================== function GotoNextPageV2( ProductType, page , where) //==================== { var DbFilePathRaw = new String(location.pathname); var DbSearchRaw = new String(location.search); Action = page + "?opendocument"; if ( where == 'public' ) { Action = Action + '&aok=' + document.forms[0].AgeOK.value; Action = Action + '&offer=' + document.forms[0].offer.value; Action = Action + '&ca=' + document.forms[0].CalcAge.value; Action = Action + '&aa=' + getSelectedRadioTag(document.forms[0].AAMemberYN); if ( ProductType == "TermLife" || ProductType == "FuneralCover" || ProductType == "MPI" || ProductType == "CriticalCare" || ProductType == "GuaranteedLife") { Action = Action + '&s=' + getSelectedRadioTag(document.forms[0].Smoker); Action = Action + '&g=' + getSelectedRadioTag(document.forms[0].gender); } } else { Action = Action + '&aok=ok'; Action = Action + '&offer=0'; Action = Action + '&ca=' + document.forms[0].CalcAge.value; Action = Action + '&aa=' + document.forms[0].AAMemberYN.value; Action = Action + '&s=' + document.forms[0].Smoker.value; Action = Action + '&g=' + document.forms[0].gender.value; } if ( ProductType == "GuaranteedLife") { Action = Action + '&p=' + makeSafeV2(document.forms[0].premium.value); } if ( ProductType == "TermLife" || ProductType == "FuneralCover" || ProductType == "MPI" || ProductType == "CriticalCare" || ProductType == "AccidentalDeath") { if ( where == 'public' ) { cover = document.forms[0].Cover.value; } else { cover = document.forms[0].Cover.options[document.forms[0].Cover.selectedIndex].text; } Action = Action + '&c=' + makeSafeV2(cover); } if ( ProductType == "FuneralCover") { Action = Action + '&pa=' + getSelectedRadioTag(document.forms[0].PartnerYN); } Action = Action + '&ProductType=' + ProductType; Action = Action + '&where=' + where; location.href = Action; } var calcQuote = 0; //==================== function calculateQuoteV2(ProductType) //==================== { //Reset any Red static text.... colorChangeValueProvided(CoverDOB); colorChangeValueProvided(Covertxt); if ( ProductType == "FuneralCover" || ProductType == "TermLife" || ProductType == "MPI" || ProductType == "CriticalCare") { 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; if ( ProductType == "TermLife" || ProductType == "MPI" || ProductType == "CriticalCare" || ProductType == "AccidentalDeath") { minAge = 16; maxAge = 59; } else if ( ProductType == "AccidentalDeath") { minAge = 16; maxAge = 74; } else if ( ProductType == "FuneralCover") { minAge = 16; maxAge = 75; } else if ( ProductType == "AccidentSuppartPlan") { minAge = 16; maxAge = 79; } else if ( ProductType == "GuaranteedLife") { minAge = 50; maxAge = 79; } else { minAge = 0; maxAge = 0; } 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 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 checkCreditCardExpiryDate(cboExpMonth,cboExpYear) { var nowDate = new Date(); var nowYear = nowDate.getYear(); var nowMonth = nowDate.getMonth() + 1; var expYear = cboExpYear/1; var expMonth = cboExpMonth/1; if (nowYear == 0) { nowYear = 2000; } else if (nowYear < 1900) { nowYear = nowYear + 1900; } if ((expYear < nowYear) || ((expYear == nowYear) && (expMonth < nowMonth))) { alert("According to the date you have entered, your credit card has expired") return false; } return true; } var ccErrorNo = 0; function checkCreditCardNumber (cardnumber, cardname) { var ccErrors = new Array () ccErrors [0] = "Unknown card type"; ccErrors [1] = "No card number provided"; ccErrors [2] = "Please check your card number. It is not a valid number"; ccErrors [3] = "Please check your card number. It is not a valid number"; ccErrors [4] = "Please check your card number. It is not a valid number"; ccErrorNo = 0; var cards = new Array(); cards [0] = {name: "Visa", length: "13,16", prefixes: "4", checkdigit: true}; cards [1] = {name: "MasterCard", length: "16", prefixes: "51,52,53,54,55", checkdigit: true}; cards [2] = {name: "Diners Card", length: "14,", prefixes: "300,301,302,303,304,305,36,38", checkdigit: true}; cards [3] = {name: "American Express", length: "15", prefixes: "34,37", checkdigit: true}; var cardType = -1; 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 colorChangeValueRequired(elem) { elem.style.color='red'; }; function colorChangeValueProvided(elem) { elem.style.color='black'; }; function getSelectedRadioTag(radioGroup) { for(var i=0;i