bbox.blackbaudhosting.com Open in urlscan Pro
216.235.207.153  Public Scan

URL: https://bbox.blackbaudhosting.com/webforms/custom/mongo/scripts/bbox-donation-min.js
Submission Tags: falconsandbox
Submission: On November 20 via api from US — Scanned from US

Form analysis 0 forms found in the DOM

Text Content

var BBOXFormAddressBlock;if(!BBOXFormAddressBlock){BBOXFormAddressBlock={initialize:function(e){var a=bb$;function c(g,h,f){g.find('[data-country-field="'+h+'"]').val(f)}function d(h){var f=h.find(".BBFormCountryDropDown option:selected").attr("data-country-format"),g=h.find("[data-country-format-for]");if(f){g.filter("[data-country-format-for="+f+"]").show();g.filter("[data-country-format-for!="+f+"]").hide()}}e.find(".BBFormCountryDropDown").change(function(){var f=a(this).closest(".BBFormAddressBlock");d(f)});e.find(".BBFormSection [data-country-sync]").change(function(){var g=a(this),f=g.closest(".BBFormAddressBlock");c(f,g.attr("data-country-field"),g.val())});e.find(".BBFormAddressBlock").each(function(){d(a(this))});e.find(".BBFormTextArea").on("keydown",function(j){var g=j.which;if((!j.ctrlKey&&g!=8&&g!=46&&g!=37&&g!=38&&g!=39&&g!=40)&&(g>=33||g==13||g==32)){var f=a(j.target);var l=f.val();var k=l.match(/(\r\n|\n|\r)/g);var h=parseInt(f.attr("maxlength"));var i=0;if(k!=null){i=l.length+k.length+1;if(i>h){j.preventDefault();return false}}}});function b(j){var f=a(j.target);var g=f.val();var k=g.match(/(\r\n|\n|\r)/g);var h=parseInt(f.attr("maxlength"));var i=0;if(k!=null){i=g.length+k.length;if(i>h){j.preventDefault();f.val(g.slice(0,h-k.length))}}}e.find(".BBFormTextArea").on("keyup",b)}}}var BBOXSectionScripts=BBOXSectionScripts||{};BBOXSectionScripts.address=BBOXFormAddressBlock;
var BBOXBillingSection={initialize:function(c){var b=bb$;function a(d){var e=c.find("#bboxdonation_billing_chkOrgGift");if(e.is(":checked")){BBOXDonationForm.elementShow(".BBFormOrgFields",d);c.find("[data-billing-field=orgname]:visible").focus()}else{if(e.length){BBOXDonationForm.elementHide(".BBFormOrgFields",d)}}}c.find("#bboxdonation_billing_chkOrgGift").on("change",function(){a()});a(true)}};var BBOXSectionScripts=BBOXSectionScripts||{};BBOXSectionScripts.billing=BBOXBillingSection;
var BBOXPaymentSection={togglePaymentMethodSelection:null,showDirectDebitConfirmationBox:null,initialize:function(c){var g=bb$,f={sticky:true,dropShadow:false,activation:"click",cluetipClass:"BBForm",closePosition:"title",ajaxSettings:{dataType:"json",jsonpCallback:"bboxCallback"},ajaxProcess:function(k){return k.content},onShow:function(k,l){g("#cluetip-title").focus();g("#cluetip-close a").attr("tabindex","103")},onHide:function(k,l){g(this).focus()}};if(g.cluetip){c.find("#cscWhatsThis:not(.hasTooltip)").cluetip(g.extend({width:"350"},f)).addClass("hasTooltip");c.find("#DDGuaranteeWhatsThis:not(.hasTooltip)").cluetip(g.extend({width:"350",local:true},f)).addClass("hasTooltip");c.find("#bboxsecure:not(.hasTooltip)").cluetip(g.extend({width:"420"},f)).addClass("hasTooltip");c.find("#routingUSWhatsThis:not(.hasTooltip), #routingUKWhatsThis:not(.hasTooltip), #routingCAWhatsThis:not(.hasTooltip), #routingAUSWhatsThis:not(.hasTooltip), #accountNumNZWhatsThis:not(.hasTooltip)").cluetip(g.extend({width:"400"},f)).addClass("hasTooltip");g("#cluetip-title").attr("tabindex","101");g("#cluetip-inner").attr("tabindex","102")}c.find(".BBDFormSectionPaymentInfo input[data-pmtchoice]").change(function(){a(false)});function a(o){c.find(".BBFormPaymentRadioOptions input").each(function(){var C=g(this).is(":checked");g(this).next("label").toggleClass("BBFormRadioPaymentSelected",C);g(this).next("label").toggleClass("BBFormRadioPaymentNotSelected",!C)});var x=c.find(".BBDFormSectionPaymentInfo input[data-pmtchoice][value='0']"),n=c.find(".BBDFormSectionPaymentInfo input[data-pmtchoice][value='2']"),y=c.find(".BBDFormSectionPaymentInfo input[data-pmtchoice][value='1']"),v=x.is(":checked"),t=n.is(":checked"),m=y.is(":checked"),p=c.find(".BBFormCreditCardDetails"),B=c.find(".BBFormDirectDebitDetails");var l=c.find("input[id$='btnSecurePayment']");var A=c.find("input[id$='btnSubmit']");var z=c.find("input[id$='btnContinue']");var w=false;var r=c.find(".hdnBBShowDirectDebitConfirmationBox");var k=n.length===0&&B.length>0;if(r.length>0){w=r.val()==="1"}function s(){A.prop("type","button");l.prop("type","submit");z.prop("type","button");A.hide();l.show();z.hide()}function u(){A.prop("type","submit");l.prop("type","button");z.prop("type","button");A.show();l.hide();z.hide()}function q(){A.prop("type","button");l.prop("type","button");z.prop("type","submit");A.hide();l.hide();z.show()}if(x.length){p.toggle(v);if(v&&!o){if(typeof bbCheckout2_0!=="undefined"&&!g.isEmptyObject(bbCheckout2_0)){s()}else{u()}}}if(n.length||k){B.toggle(t||k);if(t||k){if(w){q()}else{u()}}}if(y.length&&m){u()}}function h(q){var p=/^4/,m=/(^5[1-5])|^(222[1-8][0-9]{2}|2229[0-8][0-9]|22299[0-9]|22[3-9][0-9]{3}|2[3-6][0-9]{4}|27[01][0-9]{3}|2720[0-8][0-9]|27209[0-9])/,r=/^3[47]/,o=/^6(?:011|5|4[4-9]|22(?:1(?:2[6-9]|[3-9])|[2-8]|9(?:[01]|2[0-5])))/,k=/^(?:5[0678]|6304|6390|67)/,n=/^3(?:0[0-5]|[68][0-9])[0-9]/,l=/^35(?:2[89]|[3-8])/;if(p.test(q)){return"visa"}else{if(m.test(q)){return"mastercard"}else{if(r.test(q)){return"amex"}else{if(o.test(q)){return"discover"}else{if(k.test(q)){return"maestro"}else{if(n.test(q)){return"diners"}else{if(l.test(q)){return"jcb"}else{return"unknown"}}}}}}}}function b(k){c.find(".BBFormCreditCardDetails select[id$=cboCardType]").val(c.find("[data-card-type="+k+"]").data("card-type-id"));c.find(".BBCardImage").each(function(m,l){if(k==="unknown"){g(l).attr("src",g(l).attr("src").replace("_disabled","_normal"))}else{if(g(l).data("card-type")===k){g(l).attr("src",g(l).attr("src").replace("_disabled","_normal"))}else{g(l).attr("src",g(l).attr("src").replace("_normal","_disabled"))}}})}function d(){var k=c.find(".BBCardNumber").val().replace(/ /g,"").replace(/-/g,"");b(h(k))}c.find(".BBFormCreditCardDetails input[id$=txtCardNumber]").on("keyup change blur",function(){d()});this.togglePaymentMethodSelection=function(k){a(k)};a(true);if(c.find(".BBFormCreditCardDetails").length){d()}function e(){var l=c.find("#bboxdonation_payment_BBFormPaymentChoiceDirectDebit");var m=c.find("#bboxdonation_payment_BBFormDDDetails");var k=l.length===0&&m.length>0;return(l.length>0&&l.is(":checked"))||k}this.isPaymentModeDirectDebit=function(){return e()};function i(){var x=c.find('[id$="BBFormDDConfirmationBox"]');var l=c.find('[id$="BBFormConfirmationBoxWrapper"]');var p=c.find('[id$="BBFormDDDetails"]');var m=x.find('[id$="btnDonateNow"]');var z=c.find(".BBDFormSectionGiftInfo input[data-giftchoice][value='0']");var y=x.find("#lblDDDateOfFirstGift").closest(".BBFormFieldContainer");var q=c.find(".hdnGiftButtonsStyle").val()==="2";var k=p.find('[id$="txtAccountHolder"]').val();var t=[p.find('[id$="txtSortCode1"]').val(),p.find('[id$="txtSortCode2"]').val(),p.find('[id$="txtSortCode3"]').val()].join(" ");var o=p.find('[id$="txtAccountNumber"]').val();var v=null;var s="One time";var n=null;y.show();if((z.length&&z.is(":checked"))||q){var w=c.find("#ddPledgeFrequency");var A="";var u="";switch(w.val()){case"2":A=c.find("#bboxdonation_gift_lblPledgeInfoMonthly").text();u=c.find("#bboxdonation_gift_lblPledgeDateMonthly").text();break;case"3":A=c.find("#bboxdonation_gift_lblPledgeInfoQuarterly").text();u=c.find("#bboxdonation_gift_lblPledgeDateQuarterly").text();break;case"4":A=c.find("#bboxdonation_gift_lblPledgeInfoAnnual").text();u=c.find("#bboxdonation_gift_lblPledgeDateAnnual").text();break;default:break}s=A.slice(A.indexOf("on")+3,-1);n=u.slice(u.indexOf("on")+3,-1);v=c.find("#lblPaymentAmount").text()}else{var r=c.find(".BBFormRadioGivingLevelItem .BBFormRadioLabelGivingLevelSelected");if(BBOXSectionScripts.recurrence.isRecurringGift()){n=BBOXSectionScripts.recurrence.nextPaymentDate();s=BBOXSectionScripts.recurrence.frequency()}else{y.hide()}if(r.hasClass("BBFormRadioLabelGivingLevelOther")){v=r.find(".BBFormGiftOtherAmount").val()}else{v=r.find(".BBFormRadioAmount").text()}}s=s[0].toUpperCase()+s.slice(1);if(v.indexOf(".")===-1){v=(v.trim()+".00")}x.find('span[id$="DDAccountHolder"]').text(k);x.find('span[id$="DDSortCode"]').text(t);x.find('span[id$="DDAccountNumber"]').text(o);x.find('span[id$="DDDebitAmount"]').text(v);x.find('span[id$="DDFrequency"]').text(s);x.find('span[id$="DDDateOfFirstGift"]').text(n);bb$("body").addClass("BBFormStopBackgroundScroll");x.find('[id$="btnBackToForm"]').off();x.on("click",'[id$="btnBackToForm"]',function(B){B.preventDefault();l.hide();bb$("body").removeClass("BBFormStopBackgroundScroll");bbox.BlockPage();var C=function(){g("#bbox-root").unblock();c.find("input[id$='btnContinue']").prop("disabled",false)};if(typeof BBOXReCAPTCHAv2!=="undefined"&&BBOXReCAPTCHAv2.isEnabled&&!!BBOXReCAPTCHAv2.widgetID&&!BBOXReCAPTCHAv2.isAlwaysVisible){BBOXReCAPTCHAv2.reset(C)}else{C()}});m.prop("type","submit");m.show();l.show()}function j(){var k=c.find('[id$="BBFormConfirmationBoxWrapper"]');k.hide();bb$("body").removeClass("BBFormStopBackgroundScroll");c.find("input[id$='btnContinue']").prop("disabled",false)}this.showDirectDebitConfirmationBox=function(){return i()};this.hideDirectDebitConfirmationBox=function(){return j()}},presubmit:function(){var k=bb$,j="\x54\x45\x35\x31\x2D\x48\x46\x34\x34\x2D\x48\x54\x36\x39\x2D\x50\x4D\x36\x32",f=k(".BBFormAccountNumber").val(),c=[],h="",l="https://services.postcodeanywhere.co.uk/BankAccountValidation/Interactive/Validate/v2.00/json3.ws",g={},i=k(".BBFormDirectDebitDetails").is(":visible")&&(k(".BBDFormSectionPaymentInfo input[data-pmtchoice][value='2']").length===0||k(".BBDFormSectionPaymentInfo input[data-pmtchoice][value='2']").length===1),e=k("#hdnDirectDebitShouldLookup").val()==="1",m={},b=false,d={},a=[];if(i&&e){k(".BBFormSortCodeTextbox").each(function(){c.push(k(this).val())});h=c.join("-");g={Key:j,AccountNumber:f,SortCode:h};d=k.ajax({url:l,data:g,async:false,cache:false,dataType:"json"});m=JSON.parse(d.responseText);if(m&&m.Items&&m.Items.length>0){k("#hdnDirectDebitLookupCount").val(parseInt(k("#hdnDirectDebitLookupCount").val(),10)+1);b=m.Items[0]}else{b=false}}if(b){if(/None|OK|CautiousOK/.test(b.StatusInformation)){k("#hdnDirectDebitShouldLookup").val("0");return true}else{if(b.StatusInformation==="DetailsChanged"){k("#hdnDirectDebitShouldLookup").val("0");return true}else{BBOXValidation.showErrorMessage(null,"Please enter valid bank account information.",false);BBOXValidation.showErrorBlock();return false}}}else{return true}}};var BBOXSectionScripts=BBOXSectionScripts||{};BBOXSectionScripts.payment=BBOXPaymentSection;
var BBOX=BBOX||{};BBOX.Constants=BBOX.Constants||{};(function(){var a=bb$;BBOX.Constants.EmailQueryStringParams={emailId:"bbemailid",linkId:"bblinkid",jobRecipientId:"bbejrid"};BBOX.addMetaViewportTag=function(){if(a("meta[name=viewport]").length>0){return}a("head").append('<meta name="viewport" content="width=device-width">')};BBOX.adjustFontSize=function(b){if(!b){return}var c=2,d=parseInt(a(b).css("font-size"),10);if(a(b).height()>a(b).parent().height()||a(b).width()>a(b).parent().width()){a(b).css("font-size",(d-c)+"px").css("line-height",(d-c)+"px");BBOX.adjustFontSize(b)}};BBOX.setupDropdowns=function(c){function b(f){var d=a(this);if(d.children('[default="default"]:selected').length>0){d.addClass("GhostText")}else{d.removeClass("GhostText")}}c.find("select").on("change",b).change()};BBOX.addOptionalFieldPlaceholders=function(e){var c=e.find(".BBFormCurrency").data("culture"),d;if(c){d=a.formatCurrency.regions[c].symbol}function b(){var f=a(this).attr("placeholder");if(!f){a(this).attr("placeholder","optional")}else{if(f==="optional"){}else{if(d&&f===d){}else{a(this).attr("placeholder",a(this).attr("placeholder")+" (optional)")}}}}e.find("select:not([required])").children('option[default="default"]').each(function(){var f=a(this).text();if(f&&f.length>0){if(f!=="title"){a(this).text(f+" (optional)")}}else{a(this).text("optional")}});e.find("textarea:not([required])").each(b);e.find("input:not([required])").filter('[type="text"], [type="tel"], [type="email"]').each(b)};BBOX.populateEmailInfo=function(h,f){f=f||".hdnEmailInfo";if(h.find(f).val()&&h.find(f).val()!=="{}"){return}var g={},c=window.location.href,e=c.slice(c.indexOf("?")+1).split("&"),b,d;for(b=0;b<e.length;b++){d=e[b].split("=");if(d[0]===BBOX.Constants.EmailQueryStringParams.linkId){g.linkId=d[1]}else{if(d[0]===BBOX.Constants.EmailQueryStringParams.emailId){g.emailId=d[1]}else{if(d[0]===BBOX.Constants.EmailQueryStringParams.jobRecipientId){g.jobRecipientId=d[1]}}}}h.find(f).val(JSON.stringify(g));BBOX.removeQueryStringParams()};BBOX.buildQuerystringObject=function(d,f){var c,e,b,g={};if(d){for(c=0;c<d.length;c++){e=d[c].split("=")[0].toLowerCase();b=d[c].split("=")[1];g[e]=b}}if(f){for(c=0;c<f.length;c++){e=f[c].split("=")[0];b=f[c].split("=")[1];g[e]=b}}return g};BBOX.removeQueryStringParams=function(){if(window.history&&window.history.pushState){var f=BBOX.Constants.EmailQueryStringParams,c=window.location.href,e=false,d,b;for(d in f){if(f.hasOwnProperty(d)&&c.indexOf(f[d])>=0){b=new RegExp(f[d]+"=.*?(&|$)");c=c.replace(b,"").replace(/&$/,"").replace(/[?]$/,"");e=true}}if(e){window.history.pushState("","",c)}}};BBOX.setHdnDateTimeOffset=function(e,c){if(!c){var d,b;d=new Date();b=e.find("input[id*='_hdnDateTimeOffset']")[0];b.value=-d.getTimezoneOffset()}}})();function recaptchaWaveResolve(){var a=document.getElementById("g-recaptcha-response-100000");if(a){a.setAttribute("aria-hidden","true");a.setAttribute("aria-label","do not use");a.setAttribute("aria-readonly","true")}}var time=setTimeout(recaptchaWaveResolve,1000,"","");
var BBOXValidation=BBOXValidation||{};(function(){var b=bb$,a;BBOXValidation.initialize=function(c){a=b('.BBFormContainer[data-bbox-part-id="'+c+'"]')};BBOXValidation.showErrorMessage=function(h,f,l,e){function k(m,o){var n=parseInt(m.data("datatypeid"),10),p=o?" for field: "+o:"";switch(n){case 1:return"Please enter a value"+p;case 2:return"Please enter a valid number"+p;case 3:return"Please enter a valid date"+p;case 4:return"Please enter a valid currency value"+p;case 5:return"Please select yes or no"+p;case 6:return"Please select a value"+p;default:return"Please enter a value"+p}}function d(r,p,o){var s,n,u,m,q,t;t=o?"BBFormErrorItem BBFormInlineErrorItem":"BBFormErrorItem BBFormClientErrorItem";if(r){s=r.attr("id");n=a.find("[for="+s+"]").last().text();u=r.closest(".BBFormAttribItem");if(!p){if(u.length){p=k(u,n)}else{if(r.is("select")){p="Please select "+n.toLowerCase().replace(":","")}else{p="Please enter "+n.toLowerCase().replace(":","")}}}else{p=p}}else{if(p){p=p}else{}}m=o?"<div/>":"<li/>";q=b(m,{"class":t,text:p,"aria-label":p});return q}var j,g,c,i=a.find("#divClientError");if(h){j=h.closest(".BBFormFieldContainer");if(!j.length){return}if(e===true||a.find("#divError").length){j.addClass("BBFormErrorBlock BBFormInlineError");j.append(d(h,f,true))}}if(!l){if(i.children().length<1){g="We've run into a slight problem. Correct the following to continue:";c=b("<div/>",{tabindex:1,"class":"BBFormErrorItem",text:g,"aria-label":g});i.append(c);c=b("<ul/>",{tabindex:2});i.append(c)}i.find("ul").append(d(h,f,false))}};BBOXValidation.showErrorBlock=function(){var c=a.find("#divClientError");c.show();b("#divClientError").find("div").focus(function(d){b(d).click()});b("html, body").scrollTop(Math.max(a.find(".BBFormErrorBlock:visible").first().offset().top-40,0))};BBOXValidation.clearErrorBlock=function(){a.find(".BBFormErrorBlock.BBFormInlineError").each(function(){b(this).removeClass("BBFormErrorBlock BBFormInlineError")});a.find(".BBFormServerErrorItem, .BBFormClientErrorItem, .BBFormInlineErrorItem").remove();a.find("#divClientError, #divError").hide()};BBOXValidation.showInlineErrors=function(){a.find("[data-error]").each(function(){var c=b(this),d=c.data("error");BBOXValidation.showErrorMessage(c,d,true)})};BBOXValidation.clientValidate=function(){var c=true;BBOXValidation.clearErrorBlock();a.find("input[required]:visible, textarea[required]:visible, select[required]:visible, .BBFormChecklist[required]:visible").each(function(){var e=b(this),f=e.attr("id"),d;if(e.is("input")||e.is("textarea")){if(b.trim(e.val())===""){BBOXValidation.showErrorMessage(e);c=false}}else{if(e.is("select")){d=e.find("option:selected");if(d.length<1||d.attr("default")||d.attr("value")===""){BBOXValidation.showErrorMessage(e);c=false}}else{if(e.hasClass("BBFormChecklist")){if(e.find("input:checked").length<1){BBOXValidation.showErrorMessage(e);c=false}}else{}}}});if(c){BBOXValidation.clearErrorBlock()}else{BBOXValidation.showErrorBlock()}return c}})();
var BBOXDesignationSection={initialize:function(c){var b=bb$;function a(){var d=c.find("#bboxdonation_designation_ddDesignations").val()==="0";BBOXDonationForm.elementToggle("#bboxdonation_designation_txtOtherDesignation",true,d);if(d){c.find("#bboxdonation_designation_txtOtherDesignation").focus()}}c.find("#bboxdonation_designation_ddDesignations").change(function(){a()});a()}};var BBOXSectionScripts=BBOXSectionScripts||{};BBOXSectionScripts.designation=BBOXDesignationSection;
var BBOXDonationForm,BBOXForm={};BBOXForm.display=function(d,b,c,e){var f=bb$,a=f('.BBFormContainer[data-bbox-part-id="'+e+'"]').closest("#bbox-root");f("head").append("<title>Donation page</title>");if(!BBOXDonationForm){BBOXDonationForm={initialize:function(h){function k(){var l=a.find("#bboxdonation_recurrence_lblRecurrenceDate"),n;if(l.length){try{n=a.find(".BBFormRadioGivingLevelItem .BBFormRadioLabelGivingLevelSelected .BBFormRadioAmount").html();if(n===null){n=a.find(".BBFormRadioGivingLevelItem .BBFormTextbox.BBFormCurrency").val();n=f("<input>").val(n||0).formatCurrency({region:a.find(".BBFormCurrency").data("culture")}).val()}if(n.indexOf("$")===0){n="$"+n}l.html(l.attr("data-label").replace(/\{AMT\}/,n))}catch(m){}}}a.find("input[title='Other gift amount']").on("focus",function(){f(this).prop("checked",true).change()});a.find("input[title='Other pledge amount']").on("focus",function(){f(this).prop("checked",true).change()});a.find("#bboxdonation_gift_txtAmountOther").on("click",function(){a.find("#bboxdonation_gift_rdGivingLevel5").prop("checked",true).change()});a.find(".BBFormCurrency").focus(function(){f(this).val("")});a.find(".BBFormCurrency").blur(function(){var m=f(this),l={region:m.data("culture")};if(m.attr("id").indexOf("txtOtherAmountButtons")>=0){l.groupDigits=false;l.roundToDecimalPlace=2;l.symbol=""}m.val(m.asNumber({region:m.data("culture")}));m.formatCurrency(l);k();BBOXDonationForm.updateGoalProgress()});a.find(".BBFormCurrency").on("keyup",function(){BBOXDonationForm.updateGoalProgress()});a.find(".BBFormRadioGivingLevel").change(function(){var p=f(this).closest(".BBFormRadioList").find(".BBFormGiftOtherAmount:visible"),n=f(this).hasClass("BBFormRadioGivingLevelOther");bbFormToggleGivingLevels(a);if(f(this).hasClass("BBFormRadioGivingLevelSelected")){if(!n){var m=a.find("#bboxdonation_gift_txtAmountOtherPledge");var l=a.find("#bboxdonation_gift_txtAmountOther");var o=a.find(".BBFormCurrency");if(m.val()!=""||l.val()!=""){m.val("");l.val("");o.val("")}}k();BBOXDonationForm.updateGoalProgress();if(n){p.attr("required","required")}else{p.removeAttr("required")}}});a.find(".BBFormRadioItem").on("keydown",function(l){if(l.which===32){a.find(".BBFormRadioGivingLevel").prop("checked",false).change();f(this).find(".BBFormRadioGivingLevel").prop("checked",true).change()}});if(typeof(bbFormToggleGivingLevels)!=="undefined"){bbFormToggleGivingLevels(a);k();BBOXDonationForm.updateGoalProgress()}f.each(BBOXSectionScripts,function(){if(typeof this.initialize==="function"){this.initialize(a)}});if(typeof BBOXReCAPTCHAv2!=="undefined"&&!f.isEmptyObject(BBOXReCAPTCHAv2)){BBOXReCAPTCHAv2.initialize(a)}function j(){var l=window,m="inner";if(!("innerWidth" in window)){m="client";l=document.documentElement||document.body}return l[m+"Width"]}function g(){var l=a.find(".BBFormContainer"),n=j(),m=l.width();l.removeClass("BBFormWidthNarrow-Less600").removeClass("BBFormWidthNarrow-Less500").removeClass("BBFormWidthNarrow-Less400");if(n>600){if(m<600){l.addClass("BBFormWidthNarrow-Less600")}if(m<500){l.addClass("BBFormWidthNarrow-Less500")}if(m<400){l.addClass("BBFormWidthNarrow-Less400")}}}function i(t){var p=location.search.replace("?","").split("&"),m=BBOX.buildQuerystringObject(p),s,q,u=false,o=false,l=m.hasOwnProperty("bbhideothergifts")&&m.bbhideothergifts==="1",v=m.hasOwnProperty("bbhideotherfunds")&&m.bbhideotherfunds==="1",n=!t||l,r=!t||v;if(n&&m.hasOwnProperty("bbgiftamount")){q=parseFloat(m.bbgiftamount);f.each(a.find(".BBFormRadioGivingLevelItem .BBFormRadioGivingLevel"),function(){if(parseFloat(f(this).val())===q){a.find(".BBDFormSectionGiftInfo input[data-giftchoice][value='1']").prop("checked",true).change();f(this).prop("checked",true).change();u=true;return false}})}if(n&&m.hasOwnProperty("bbpledgeamount")){q=parseFloat(m.bbpledgeamount);f.each(a.find(".BBFormRadioPledgeAmountItem .BBFormRadioGivingLevel"),function(){if(parseFloat(f(this).val())===q){a.find(".BBDFormSectionGiftInfo input[data-giftchoice][value='0']").prop("checked",true).change();f(this).prop("checked",true).change();o=true;return false}})}if(l){if(u&&o){a.find(".BBFormRadioGivingLevelItem .BBFormRadioLabelGivingLevelNotSelected").parent().remove();a.find(".BBFormRadioPledgeAmountItem .BBFormRadioLabelGivingLevelNotSelected").parent().remove()}else{if(u){a.find(".BBFormGiftChoice").remove();a.find(".BBFormRadioGivingLevelItem .BBFormRadioLabelGivingLevelNotSelected").parent().remove()}else{if(o){a.find(".BBFormGiftChoice").remove();a.find(".BBFormRadioPledgeAmountItem .BBFormRadioLabelGivingLevelNotSelected").parent().remove()}}}}if(r&&m.hasOwnProperty("bbfund")){s=a.find('.BBDFormSectionDesignationInfo select[id*="ddDesignations"]');if(s.find('option[value="'+m.bbfund+'"]').length>0){s.val(m.bbfund);if(v){s.find('option[value!="'+m.bbfund+'"]').remove()}}}}i(h);g();if(a.find(".hdnMetaTag").val()){BBOX.addMetaViewportTag()}BBOX.setHdnDateTimeOffset(a,h);BBOX.populateEmailInfo(a);BBOX.setupDropdowns(a);BBOX.addOptionalFieldPlaceholders(a);BBOXValidation.initialize(e);BBOXValidation.showInlineErrors()},updateGoalProgress:function(){function j(o){var p=parseFloat(a.find(".BBFormProgress-Amount.BBFormProgress-Goal").attr("value")),n=parseFloat(a.find(".BBFormProgress-Bar.BBFormProgress-Bar-Raised").attr("value")),q=(100*o)/p;return(q+n)>100?(100-n):q}var g=a.find(".BBFormProgressContainer"),h=a.find(".BBFormProgress-Bar.BBFormProgress-Bar-New"),i=f(".labelEditor").is("[data-label-edit='1']"),l,k,m;if(!i){if(g.length){k=parseFloat(a.find(".BBFormRadioItem:visible .BBFormRadioGivingLevelSelected").val());if(isNaN(k)){l=a.find(".BBFormRadioItem:visible .BBFormTextbox.BBFormCurrency");if(l.length<1){l=a.find(".BBFormNoLevels:visible .BBFormTextbox.BBFormCurrency")}k=l.asNumber({region:l.data("culture")});if(isNaN(k)){k=0}}m=j(k)}}else{m=10}h.css("width",m+"%");h.attr("value",m)},clientValidate:function(){var i=true;function j(){var o=true;var p=a.find('[id$="chkUKConfirmation"]');var n=a.find('[id$="lblUKConfirmationForChk"]');var m=BBOXPaymentSection.isPaymentModeDirectDebit();if(m){o=(p.length<1||p.is(":checked"));if(!o){BBOXValidation.showErrorMessage(null,"Please confirm you are the account holder and the only person required to authorise debits from this account",false);BBOXValidation.showErrorMessage(n,"Please confirm the above statement",true,true);BBOXValidation.showErrorBlock()}}return o}function g(){var m=bb$("#bboxdonation_gift_lblChoicePledge");var n=a.find(".BBFormPledgeSection.BBFormPledgeFields");return !!(m.hasClass("BBFormRadioGiftSelected")||(n.length>0&&n.css("display")!=="none"))}function l(){var n=a.find(".BBFormRadioPledgeAmountItem .BBFormRadioGivingLevelSelected[data-min-payment]"),p=a.find(".hdnPledgePayment"),m,q,o;if(!g()){return true}if(n.length>0){q=parseFloat(n.attr("data-min-payment"))}else{m=a.find(".BBFormNoLevels.BBFormPledgeFields:visible .BBFormCurrency");if(m.length>0){q=parseFloat(m.attr("data-min-payment"))}else{return true}}var r=parseFloat(p.val());if(isNaN(r)||r<=0){BBOXValidation.showErrorMessage(a.find(".BBFormFieldContainerGivingLevels"),"Please specify a pledge amount",false);BBOXValidation.showErrorBlock();return false}else{if(r<q){o=f("<input>").val(q).formatCurrency({region:a.find(".BBFormCurrency").data("culture")}).val();BBOXValidation.showErrorMessage(a.find(".BBFormFieldContainerGivingLevels"),"Pledge amount must be at least "+o,false);BBOXValidation.showErrorBlock();return false}}return true}function h(){var o=true;if(!g()){var r="";var q=a.find(".BBFormRadioGivingLevelItem .BBFormRadioLabelGivingLevelSelected");if(q&&q.length>0&&q.hasClass("BBFormRadioLabelGivingLevelOther")){var p=q.find(".BBFormGiftOtherAmount").val();p=parseFloat(p.replace(/[^0-9.-]+/g,""));if(isNaN(p)||p<=0){o=false;r="Please specify a gift amount"}else{var s=a.find(".BBFormRadioGivingLevelItem .BBFormRadioGivingLevelSelected[data-min-payment]");if(s&&s.length>0){var m=parseFloat(s.attr("data-min-payment"));if(!isNaN(m)&&p<m){var n=f("<input>").val(m).formatCurrency({region:a.find(".BBFormCurrency").data("culture")}).val();r="Gift amount must be at least "+n;o=false}}}}if(!o){BBOXValidation.showErrorMessage(a.find(".BBFormFieldContainerGivingLevels"),r,false);BBOXValidation.showErrorBlock()}}return o}function k(){var n=false;var m=a.find(".hdnBBShowDirectDebitConfirmationBox");if(m.length>0){n=m.val()==="1"}return n}i&=l();i&=h();if(k()){i&=j()}return i},elementShow:function(g,h){if(h){f(g).show()}else{f(g).slideDown()}},elementHide:function(g,h){if(h){f(g).hide()}else{f(g).slideUp()}},elementToggle:function(g,h,i){if(i){BBOXDonationForm.elementShow(g,h)}else{BBOXDonationForm.elementHide(g,h)}}}}BBOXDonationForm.initialize(d)};BBOXForm.presubmit=function(){var b=bb$,a=true;if(BBOXValidation){a&=BBOXValidation.clientValidate();a&=BBOXDonationForm.clientValidate()}if(!a){b("#divClientError").find("div").focus()}b.each(BBOXSectionScripts,function(){if(typeof this.presubmit==="function"){if(a){a=this.presubmit()}}});return a};
var BBOXGiftAttributesSection={initialize:function(a){},createAttribute:function(){return{typeid:0,datatypeid:0,oneperrecord:true,value:""}},presubmit:function(){var e=bb$,d=this,b=[],a;function c(){var f=d.createAttribute();f.typeid=e(this).attr("data-attribtypeid");f.oneperrecord=(e(this).attr("data-oneperrecord")==="true");f.datatypeid=e(this).attr("data-datatypeid");f.value="";switch(f.datatypeid){case"1":case"2":case"3":case"4":f.value=e(this).find(".BBFormAttrText").val();break;case"5":f.value=e(this).find(".BBFormAttrYesNo").val();break;case"6":if(f.oneperrecord){f.value=e(this).find(".BBFormAttrSelect").val()}else{f.value="";e(this).find(".BBFormChecklistCheck:checked").each(function(g,h){f.value=f.value+e(this).val()+";"});f.value=f.value.slice(0,-1)}break}b.push(f)}e("#bbox-root .BBFormSubSectionGiftAttributes .BBFormAttribItem").each(c);a=JSON.stringify(b);e("#bbox-root .hdnJsonGiftAttributes").val(a);return true}};var BBOXSectionScripts=BBOXSectionScripts||{};BBOXSectionScripts.giftattributes=BBOXGiftAttributesSection;
function bbFormToggleGivingLevels(b){var a=bb$(".hdnGivingLevelButtonsEnabled").val()==="true";b.find(".BBFormRadioGivingLevel").each(function(){var i=bb$,h=i(this).is(":checked"),e=b.find(".BBFormGiftOtherAmount").attr("placeholder"),d;var g=/MSIE/.test(navigator.userAgent);function f(){var l=navigator.userAgent,j,k=l.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(k[1])){j=/\brv[ :]+(\d+)/g.exec(l)||[];return{name:"IE",version:(j[1]||"")}}if(k[1]==="Chrome"){j=l.match(/\bOPR|Edge\/(\d+)/);if(j!=null){return{name:"Opera",version:j[1]}}}k=k[2]?[k[1],k[2]]:[navigator.appName,navigator.appVersion,"-?"];if((j=l.match(/version\/(\d+)/i))!=null){k.splice(1,1,j[1])}return{name:k[0],version:k[1]}}var c=f();i(this).toggleClass("BBFormRadioGivingLevelSelected",h);i(this).next("label").toggleClass("BBFormRadioLabelGivingLevelSelected",h);i(this).next("label").toggleClass("BBFormRadioLabelGivingLevelNotSelected",!h);if(!a&&!(i(".hdnSecurePaymentClicked").val()=="true")){if(i(this).hasClass("BBFormRadioGivingLevelOther")){d=i(this).siblings(".BBFormRadioLabelGivingLevelOther").find(".BBFormGiftOtherAmount");if(h){if(!g||parseInt(c.version,10)>7){if(d.is(":focus")===false){d.focus()}}}else{d.val("")}}}})}var BBOXGiftSection={initialize:function(b){var c=bb$;function a(k){setTimeout(function(){k.focus()},0)}function h(k){var l=0;if(k.length>0){l=k.asNumber({region:k.data("culture")})}return l}function i(){var l=b.find(".BBFormRadioPledgeAmountItem .BBFormRadioGivingLevelSelected"),k,m=0;if(l.length<1){m=h(b.find(".BBFormNoLevels.BBFormPledgeFields:visible .BBFormCurrency"))}else{if(l.hasClass("BBFormRadioGivingLevelOther")){m=h(l.siblings(".BBFormRadioLabelGivingLevel").find(".BBFormTextbox.BBFormCurrency"))}else{m=parseFloat(l.val())}}return m}function f(){var s=b.find(".BBFormRadioPledgeAmountItem .BBFormRadioGivingLevelSelected"),n=b.find("#ddPledgeTerm"),r,k,l,p,m,o,q;if(s.length>0){m=parseFloat(s.attr("data-min-payment"))}else{r=b.find(".BBFormNoLevels.BBFormPledgeFields:visible .BBFormCurrency");if(r.length>0){m=parseFloat(r.attr("data-min-payment"))}else{return}}p=i();o=m<=0?p:parseInt((p/m),10);k=n.val();n.empty();for(q=1;q<=Math.max(Math.min(o,100),1);q++){l=c("<option></option>").attr("value",q).text(q);if(q===parseInt(k,10)){l.prop("selected",true)}n.append(l)}b.find(".hdnPledgeDuration").val(n.val())}function d(){var k=b.find("#ddPledgeFrequency"),o=k.val(),m=b.find("#ddPledgeTerm").val(),l=b.find("#lblPledgeTermPeriod"),n=b.find("#lblPaymentTerm");switch(o){case"2":l.text(m==="1"?"month":"months");n.text("Monthly");break;case"3":l.text(m==="1"?"quarter":"quarters");n.text("Quarterly");break;case"4":l.text(m==="1"?"year":"years");n.text("Annual");break;default:break}b.find(".BBFormPledgeMonthly").toggle(o==="2");b.find(".BBFormPledgeQuarterly").toggle(o==="3");b.find(".BBFormPledgeAnnual").toggle(o==="4")}function e(){var p=b.find(".BBFormRadioPledgeAmountItem .BBFormRadioGivingLevelSelected"),q=b.find(".BBFormPledgeDate:visible"),n,k,l,o;try{k=i();l=parseInt(b.find("#ddPledgeTerm").val(),10);if(!l){return}o=(k/l).toFixed(2)||0;b.find(".hdnPledgePayment").val(o);o=c("<input>").val(o).formatCurrency({region:b.find(".BBFormCurrency").data("culture")}).val();b.find("#lblPaymentAmount").text(o);if(o.indexOf("$")===0){o="$"+o}q.html(q.attr("data-label").replace(/\{AMT\}/,o))}catch(m){}}function g(){d();e()}function j(){b.find(".BBFormGiftRadioOptions input").each(function(){var o=c(this).is(":checked");c(this).next("label").toggleClass("BBFormRadioGiftSelected",o);c(this).next("label").toggleClass("BBFormRadioGiftNotSelected",!o)});var l=b.find(".BBDFormSectionGiftInfo input[data-giftchoice][value='0']"),m=c(".labelEditor").is("[data-label-edit='1']"),n=b.find(".hdnGiftButtonsStyle").val()==="2",k;if(l.length||n){b.find(".BBFormRadioPledgeAmountItem").toggle(l.is(":checked")||n);b.find(".BBFormPledgeFields").toggle(l.is(":checked")||n);b.find(".BBFormSectionRecurrenceInfo").toggle(m||!l.is(":checked")&&!n);b.find(".BBFormSingleGiftFields").toggle(!l.is(":checked")&&!n);b.find(".BBFormRadioGivingLevelItem").toggle(!l.is(":checked")&&!n)}else{b.find(".BBFormPledgeFields").toggle(false)}k=b.find(".BBDFormSectionGiftInfo .BBFormNoLevels:visible").length<1;b.find(".BBFormFieldContainerGivingLevels").toggle(k)}b.find(".BBDFormSectionGiftInfo input[data-giftchoice]").on("change",function(){j();BBOXDonationForm.updateGoalProgress()});b.find(".BBDFormSectionGiftInfo input[name*='PledgeAmount']").on("change",function(){if(!c(this).hasClass("BBFormRadioGivingLevelOther")){f()}g()});b.find("#ddPledgeTerm").on("change",function(){g();b.find(".hdnPledgeDuration").val(c(this).val())});b.find("#ddPledgeFrequency").on("change",function(){g()});b.find(".BBFormPledgeFields .BBFormCurrency, .BBFormRadioPledgeAmountItem .BBFormCurrency").on("blur",function(){f();g()});if(b.find(".hdnGivingLevelButtonsEnabled").val()==="true"){b.find(".BBFormRadioLabelGivingLevelOther").on("click",function(){a(c(this).find(".BBFormGiftOtherAmount"))});b.find(".BBFormGiftOtherAmount").keyup(function(k){if((k.which>=48&&k.which<=90)||(k.which>=96&&k.which<=105)||(k.which===110)||(k.which===190)){b.find(".BBFormRadioGivingLevel").prop("checked",false).change();b.find(".BBFormRadioGivingLevelOther").prop("checked",true).change()}})}else{b.find(".BBFormGiftOtherAmount").on("click",function(){a(c(this))})}j();f();g();BBOXDonationForm.updateGoalProgress()}};var BBOXSectionScripts=BBOXSectionScripts||{};BBOXSectionScripts.gift=BBOXGiftSection;
var BBOXRecurrenceSection={nextPaymentDate:null,isRecurringGift:null,initialize:function(G){var u=bb$,B={WEEKLY:0,BIWEEKLY:1,MONTHLY:2,QUARTERLY:3,SEMIANNUALLY:4,ANNUALLY:5},A=G.find("#bboxdonation_hdnHideDirectDebitForOneTimeGift"),s=(A&&A.val()==="1"),j=G.find("#bboxdonation_payment_lblChoiceDirectDebit"),k=G.find("#bboxdonation_recurrence_hdnDateOptions").val(),i,n=G.find("#bboxdonation_recurrence_ddFrequency"),q=G.find("#bboxdonation_recurrence_ddFrequencyDate"),d=G.find("#bboxdonation_recurrence_hdnRecurringOptionValue"),p=G.find("#lblRecurrenceNextGiftDate"),l;function D(Q,L){var M=L?"inline-block":"none",S=L?"show":"hide";var R=G.find("#bboxdonation_payment_BBFormPaymentChoiceDirectDebit").is(":checked");if(!L&&R){var O=G.find("#bboxdonation_payment_BBFormPaymentChoiceDirectDebit");var N=G.find("#bboxdonation_payment_BBFormPaymentChoiceCredit");var P=G.find("#bboxdonation_payment_BBFormPaymentChoiceBillMeLater");O.prop("checked",false);if(N.length>0){N.prop("checked",true)}else{if(P.length>0){P.prop("checked",true)}}}BBOXPaymentSection.togglePaymentMethodSelection(Q);if(Q){G.find("#bboxdonation_payment_divPaymentChoiceDirectDebit").css("display",M)}else{G.find("#bboxdonation_payment_divPaymentChoiceDirectDebit").animate({width:S})}}function h(M){var L=G.find("#bboxdonation_recurrence_chkMonthlyGift").is(":checked"),N=G.find("#bboxdonation_recurrence_hdnRecurringOnly").val()==="1";if(!L&&N){L=true}BBOXDonationForm.elementToggle(".BBFormFieldRecurrenceInfo",M,L);if(!M){w()}if(s){D(M,L)}}function x(Q){var L=G.find(".hdnGiftButtonsStyle").val()==="2";var O=G.find(".BBDFormSectionGiftInfo input[data-giftchoice][value='0']").is(":checked");var M;try{var P=G.find(".BBFormRadioGivingLevelItem .BBFormRadioLabelGivingLevelSelected .BBFormRadioAmount").html();if(P===null||P===undefined){M=G.find(".BBFormTextbox.BBFormCurrency").not("input[id*='Pledge']").val();M=u("<input>").val(M||0).formatCurrency({region:G.find(".BBFormCurrency").data("culture")}).val()}else{M=P}}catch(T){}var N=G.find(".BBDFormSectionPaymentInfo input[data-pmtchoice][value='0']");var U=G.find(".BBFormCreditCardDetails");var R=N.length===0&&U.length>0;var W=N.is(":checked")||R;var V=G.find(".divMasterCardWarningInfo");var S=G.find("#bboxdonation_recurrence_divRecurrenceCheckbox").children(":first").is(":checked")||G.find("#bboxdonation_recurrence_hdnRecurringOnly").val()==="1";if(!Q&&W&&V.css("display")=="none"&&S&&!O&&!L){V.text("By completing this step, you authorize the storing of this card account for a payment of "+M+" per chosen recurring schedule and future, agreed upon payments.");V.css("display","block");V.css("margin-bottom","3%");V.css("margin-left","6%");V.css("margin-right","20%")}else{if(!Q){V.css("display","none")}else{V.text("By completing this step, you authorize the storing of this card account for a payment of "+M+" per chosen recurring schedule and future, agreed upon payments.")}}}G.find(".BBFormRadioGivingLevel").change(function(){x(true)});G.find(".BBDFormSectionPaymentInfo input[data-pmtchoice]").change(function(){x(false)});G.find(".BBDFormSectionGiftInfo input[data-giftchoice]").change(function(){x(false)});G.find(".BBFormFieldRecurrenceInfo").ready(function(){x(false)});G.find("#bboxdonation_gift_txtAmountOther").change(function(){x(true)});G.find("#bboxdonation_gift_txtAmountOther").blur(function(){x(true)});G.find(".BBFormGiftOtherAmount").blur(function(){x(true)});G.find("#bboxdonation_gift_txtAmountGift").blur(function(){x(true)});G.find("BBFormTextbox BBFormGiftOtherAmount BBFormCurrency").ready(function(){u(this).attr("inputmode","numeric");u(this).attr("pattern","[0-9]*")});j.on("event",function(){j.addClass("BBFormRadioPaymentSelected").trigger("setUKDDDate")});function w(){var T=q.find("option:selected"),R=T.data("nextpayment"),Q=navigator.language;if(Q==="en-GB"||Q==="en-AU"||Q==="en-DE"||Q==="en-NZ"){var S=R;var M=S.split("/");var O=M[1]-1;R=new Date(M[2],O,M[0])}else{R=new Date(R)}var L=G.find("#bboxdonation_recurrence_chkMonthlyGift").is(":checked")||G.find("#bboxdonation_recurrence_hdnRecurringOnly").val()==="1";if(L&&G.find("#bboxdonation_gift_fldUKGiftAid").length>0&&j.hasClass("BBFormRadioPaymentSelected")){var P=0;var U=new Date();l=R;var N=parseInt(n.find("option:selected").val(),10);while(P===0){if(H(U,new Date(l))<parseInt(G.find("#bboxdonation_payment_lblAdvNoticeDays").text(),10)){l=new Date(g(N,l))}else{P=1}}if(l!=R){G.find("#bboxdonation_payment_lblReccGiftDate").text(l.toLocaleDateString(Q)+".");p.text("Your first gift will occur on "+l.toLocaleDateString(Q));G.find("#divDDUKDateChangeMessage").css("display","block")}else{p.text("Your first gift will occur on "+R.toLocaleDateString(Q));G.find("#divDDUKDateChangeMessage").css("display","none")}}else{p.text("Your first gift will occur on "+R.toLocaleDateString(Q));G.find("#divDDUKDateChangeMessage").css("display","none")}}function H(N,L){var M=(L-N)/(1000*60*60*24);return Math.round(M+1)}function g(M,P){var O=new Date();var N=F(M),Q=N?N.values:null;P=new Date(P);switch(M){case B.WEEKLY:if(!isNaN(P)){P.setDate(P.getDate()+7);O=f(P)}break;case B.BIWEEKLY:break;case B.MONTHLY:if(!isNaN(P)){var L=P.getDate();P.setMonth(P.getMonth()+1);if(P.getDate()!=L){P.setDate(0)}}if(Q.indexOf("|")>=0){O=b(Q,P);O=f(O)}else{O=f(P)}break;case B.QUARTERLY:if(!isNaN(P)){var L=P.getDate();P.setMonth(P.getMonth()+1);if(P.getDate()!=L){P.setDate(0)}}if(Q.indexOf("|")>=0){O=b(Q,P);O=f(O)}else{O=f(P)}break;case B.SEMIANNUALLY:if(!isNaN(P)){var L=P.getDate();P.setMonth(P.getMonth()+1);if(P.getDate()!=L){P.setDate(0)}}if(Q.indexOf("|")>=0){O=b(Q,P);O=f(O)}else{O=f(P)}break;case B.ANNUALLY:if(!isNaN(P)){P.setFullYear(P.getFullYear()+1);O=f(P)}break;default:break}return O}function f(N){var L=N.getMonth()+1;var M=N.getDate();return(L<10?"0":"")+L+"/"+(M<10?"0":"")+M+"/"+N.getFullYear()}G.find("#imgClose").click(function(){G.find("#divDDUKDateChangeMessage").css("display","none")});function c(M,L){var N=0;while(N<7){if(M.getDay()==L){return M}M.setDate(M.getDate()+1);N=N+1}}function b(P,Q){var M=P.split("|"),L=parseInt(M[0],10),N=parseInt(M[1],10);var O=new Date(Q),R=Q;O.setDate(O.getDate()+parseInt(G.find("#bboxdonation_payment_lblAdvNoticeDays").text(),10));if(m(L)!=m(4)){O.setDate(O.getDate()+(-O.getDate()+1));O.setDate(O.getDate()+(7*(L)))}else{O.setMonth(O.getMonth()+1);O.setDate(O.getDate()+(-O.getDate()+1));O.setDate(O.getDate()+-7)}R=c(O,N);if(R>=O){return R}else{if(m(L)!=m(4)){O.setMonth(O.getMonth()+1);O.setDate(O.getDate()+(-O.getDate()+1));O.setDate(O.getDate()+(7*(L)))}else{O.setMonth(O.getMonth()+2);O.setMonth(O.getMonth()+2);O.setMonth(O.getMonth()+2);O.setDate(O.getDate()+(-O.getDate()+1));O.setDate(O.getDate()+-7)}R=c(O,N);if(R>=O){return R}}return R}function F(M){for(var L=0;L<i.length;L++){if(i[L].frequency===M){return i[L]}}return null}function E(L){switch(L){case 0:return"Sunday";case 1:return"Monday";case 2:return"Tuesday";case 3:return"Wednesday";case 4:return"Thursday";case 5:return"Friday";case 6:return"Saturday";default:return""}}function m(L){switch(L){case 0:return"first";case 1:return"second";case 2:return"third";case 3:return"fourth";case 4:return"last";default:return""}}function o(L){switch(L){case 1:return"January";case 2:return"February";case 3:return"March";case 4:return"April";case 5:return"May";case 6:return"June";case 7:return"July";case 8:return"August";case 9:return"September";case 10:return"October";case 11:return"November";case 12:return"December";default:return""}}function t(M,L){u(M).each(function(P,N){var O=parseInt(N,10);q.append('<option value="'+N+'" data-nextpayment="'+L[P]+'">'+E(O)+"</option>")})}function I(N,L,O){var M="";if(O===B.MONTHLY){M="each"}else{if(O===B.QUARTERLY){M="every third"}else{if(O===B.SEMIANNUALLY){M="every sixth"}}}if(N.length>0&&N[0].indexOf("|")>=0){u(N).each(function(T,P){var R=P.split("|"),S=parseInt(R[0],10),Q=parseInt(R[1],10);if(R.length>1){q.append('<option value="'+P+'" data-nextpayment="'+L[T]+'">the '+m(S)+" "+E(Q)+" of "+M+" month</option>")}})}else{u(N).each(function(Q,P){q.append('<option value="'+P+'" data-nextpayment="'+L[Q]+'">day '+P+" of "+M+" month</option>")})}}function y(M,L){u(M).each(function(R,N){var P=N.split("|"),O=parseInt(P[0],10),Q=P[1];if(P.length>1){q.append('<option value="'+N+'" data-nextpayment="'+L[R]+'">'+o(O)+" "+Q+"</option>")}})}function e(){var L=q.find("option:selected"),M=L.data("nextpayment");d.val(L.val());p.text("Your first gift will occur on "+M)}var v=false;var J=false;var z;G.find("#bboxdonation_btnSecurePayment").on("click",function(){J=false});function K(){var M=parseInt(n.val(),10),P=F(M),Q=P?P.values:null,N=P?P.paymentDates:null,L,O;q.empty();if(Q&&N){L=Q.split(";");O=N.split(";");switch(M){case B.WEEKLY:case B.BIWEEKLY:t(L,O);break;case B.MONTHLY:case B.QUARTERLY:case B.SEMIANNUALLY:I(L,O,M);break;case B.ANNUALLY:y(L,O);break;default:break}}if(!J&&q.val()!=null){z=q.val();J=true}if(v||(q.val()!=z&&q.val()!=null)){e()}v=true;if(d.val()!==""){q.val(d.val())}}function C(){var L=G.find("#bboxdonation_recurrence_chkMonthlyGift").is(":checked")||G.find("#bboxdonation_recurrence_hdnRecurringOnly").val()==="1";if(L&&G.find("#bboxdonation_gift_fldUKGiftAid").length>0&&j.hasClass("BBFormRadioPaymentSelected")){return l}var M=q.find("option:selected"),N=M.data("nextpayment");return N}this.nextPaymentDate=function(){return C()};function r(){var L=n.find("option:selected").text();L=L[0].toUpperCase()+L.slice(1);return[L,"on",q.find("option:selected").text()].join(" ")}this.frequency=function(){return r()};function a(){var L=G.find("#bboxdonation_recurrence_chkMonthlyGift").is(":checked"),M=G.find("#bboxdonation_recurrence_hdnRecurringOnly").val()==="1";if(!L&&M){L=true}return L}this.isRecurringGift=function(){return a()};G.find("#bboxdonation_recurrence_chkMonthlyGift").change(function(){h()});G.find("#bboxdonation_recurrence_divRecurrenceCheckbox").children(":first").change(function(){x(false)});G.find(".BBDFormSectionPaymentInfo input[data-pmtchoice]").change(function(){w()});if(s){j.html(j.html().replace(" ","&nbsp;"))}u('input[type=radio][name="bboxdonation$gift$BBFormGiftChoice"]').change(function(){if(u(this).val()=="0"){if(s){D(false,false)}}if(u(this).val()=="1"){h(false)}});if(k){i=JSON.parse(k);n.on("change",K);n.on("change",w);q.on("change",e);q.on("change",w)}h(true)}};var BBOXSectionScripts=BBOXSectionScripts||{};BBOXSectionScripts.recurrence=BBOXRecurrenceSection;
var BBOXTributeSection={initialize:function(e){var b=bb$,a=e.find("#bboxdonation_tribute_hdnAllowTributeNotification").val()==="1";function d(f){var g=e.find("#bboxdonation_tribute_chkTributeGift");if(g.is(":checked")){BBOXDonationForm.elementShow("#divGeneralTributeInfo",f);if(a){BBOXDonationForm.elementShow("#divTributeAcknowledge",f)}e.find("#bboxdonation_tribute_ddTributeTypes").focus()}else{if(g.length){BBOXDonationForm.elementHide("#divGeneralTributeInfo, #divTributeAcknowledge",f)}}}function c(g){var f=e.find("#bboxdonation_tribute_chkTributeAcknowledgee").is(":checked");BBOXDonationForm.elementToggle("#divTributeAcknowledgeeInfo",g,f);if(f){e.find("#bboxdonation_tribute_txtFirstName").focus()}}e.find("#bboxdonation_tribute_chkTributeGift").change(function(){d()});e.find("#bboxdonation_tribute_chkTributeAcknowledgee").change(function(){c()});d(true);if(a){c(true)}else{b("#divTributeAcknowledge").hide()}}};var BBOXSectionScripts=BBOXSectionScripts||{};BBOXSectionScripts.tribute=BBOXTributeSection;