function resizeIframes(){$(".RTE iframe, #videoModal iframe").each(function(){var n=$(this),t=n.attr("width"),i=n.attr("height"),r=i/t,u=n.width(),f=u*r;n.css("height",f)})}function getVideoEmbedHtml(n){var i="",t=null,r;return(n.indexOf("youtube.com")>-1?(r=/v=([a-zA-Z_0-9\-]+)/gi,t=r.exec(n)):n.indexOf("youtu.be")>-1&&(r=/youtu.be\/([a-zA-Z_0-9\-]+)/gi,t=r.exec(n)),t!==null&&t.length>0&&(i=t[1]),i!=="")?'<iframe width="640" height="360" src="//www.youtube.com/embed/'+i+'" frameborder="0" allowfullscreen><\/iframe>':(n.indexOf("vimeo.com")>-1&&(r=/\/([0-9]+)/gi,t=r.exec(n)),t!==null&&t.length>0&&(i=t[1]),i!==""?'<iframe src="https://player.vimeo.com/video/'+i+'?color=ffffff" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen><\/iframe>':void 0)}var swf;$(window).bind("load resize",function(){resizeIframes()});swf=swf||{};swf.geolocator={$pc:null,$loc:null,$frm:null,position:{latitude:0,longitude:0},init:function(){function t(t){n.$frm=t.parents("form");n.$pc=$(".geoPostcode",n.$frm);n.$loc=$(".geoLatLong",n.$frm)}var n=this;$(".geoLink").click(function(i){i.preventDefault();t($(this));n.setLocation();n.$pc.val("");$(".geoMessage",n.$frm).removeClass("hidden");$(this).addClass("hidden")});$(".geoPostcode").change(function(){t($(this));$(".geoMessage").addClass("hidden");$(".geoLink").removeClass("hidden");n.$loc.val("")});$(".geoSearchButton2").click(function(i){i.preventDefault();t($(this));n.$frm.submit()});$(".geoSearchButton").click(function(i){i.preventDefault();t($(this));n.$pc.val().length>0?n.getLocFromPostcode(function(){swf.eventIndex.getResultsForPage(1)}):swf.eventIndex.getResultsForPage(1)})},getLocation:function(n,t){navigator.geolocation.getCurrentPosition(function(t){return t.latitude=t.coords.latitude,t.longitude=t.coords.longitude,n(t)},function(){if(t)return t()})},getLocFromPostcode:function(n){var i=this,t=this.$pc.val(),r=t.match(/^[A-Z]{1,2}[0-9][0-9A-Z]?\s?[0-9][A-Z]{2}$/gi),f=r!==null&&r.length>0,u=t.match(/^[A-Z]{1,2}[0-9][0-9A-Z]?$/gi),e=u!==null&&u.length>0;t.length>=5&&f?($(".geoError",i.$frm).addClass("hidden"),$.getJSON("https://api.postcodes.io/postcodes/"+t.trim(),function(t){i.$loc.val(t.result.latitude+","+t.result.longitude);n!==undefined&&n()})):t.length>=2&&t.length<=4&&e?($(".geoError",i.$frm).addClass("hidden"),$.getJSON("https://api.postcodes.io/outcodes/"+t.trim(),function(t){i.$loc.val(t.result.latitude+","+t.result.longitude);n!==undefined&&n()})):i.$loc.val("")},setLocation:function(){var n=this,t=swf.geolocator;t.getLocation(function(t){$(".geoError",n.$frm).addClass("hidden");n.$loc.val(t.latitude+","+t.longitude)},function(){$(".geoError",n.$frm).removeClass("hidden");$(".geoMessage",n.$frm).addClass("hidden")})}};$(function(){function u(t,i){i.preventDefault();var r=$("#mainNav section:not(#headerSearch)").not(t),u=t.parent("li");t.css("z-index",1001);r.css("z-index",1e3);$("#auxNavLinks li").removeClass("selected");r.slideUp(n);t.is(":visible")?u.removeClass("selected"):u.addClass("selected");t.slideToggle(n)}function l(){$("#mainNav section:not(#headerSearch)").slideUp(n)}function d(){var n=swf.geolocator;n.getLocation(function(n){$("#headerContactBranchFinderError").addClass("hidden");$("#headerContactBranchLatLong").val(n.latitude+","+n.longitude);$("#frmHeaderBranchFinder").submit()},function(){$("#headerContactBranchFinderError").removeClass("hidden")})}function g(n,t){t?n.addClass("selected"):n.removeClass("selected")}function nt(){o.removeClass("selected");$("ul",o).removeAttr("style")}function tt(){$("#auxNavLinks li").removeClass("selected");$("#auxNavLinks li section").hide()}const n=100;var f=null,e=$("#mainNav > div > ul"),o=$("#mainNav > div > ul > li"),i=$("#mainNavBurger"),r=$("#mainNav li .expander, #auxNavLinks li .expander"),s=r.prev("a"),a=$("#headerFollowLink"),v=$("#headerContactLink"),y=$("#headerSearchLink"),p=$("#headerFollow"),w=$("#headerContactUs"),h=$("#headerSearch"),b=$("#headerContactBranchFinderGeoLink"),t=$("#search"),c=t.next("span"),k=navigator.userAgent.toLowerCase().indexOf("android")>-1;if(s.addClass("expanderAnchor"),i.click(function(){e.is(":visible")?(l(),i.removeClass("open")):i.addClass("open");e.slideToggle(n)}),s.click(function(n,t){if(t)return!1;if(console.log("this.next ul: "),$(this).parent("li").hasClass("selected")&&!$(this).hasClass("aux-nav-header")||$(this).parent("li").is(":hover"))location.href=$(this).attr("href");else return $(this).next(".expander").trigger("click",!0),!1}),r.click(function(t,i){var f=$(this).prev("a"),e=f.hasClass("aux-nav-header");if(e){if(!i)return f.trigger("click",!0),!1}else tt();var r=$(this).parent("li"),u=r.children("ul"),o=$("#mainNav > div > ul ul").not(u),s=$("#mainNav > div > ul:first-of-type li").not(r);g(r,!u.is(":visible"));o.slideUp(n);s.removeClass("selected");u.slideToggle(n)}),a.click(function(n){u(p,n)}),v.click(function(n){u(w,n)}),y.click(function(n){n.preventDefault();h.is(":visible")||u(h,n);$("#search").focus()}),b.click(function(n){n.preventDefault();d()}),k)$(window).on("orientationchange",function(){clearTimeout(f);f=setTimeout(function(){nt();l()},100)});$("#btnSearch").click(function(n){t.val().length<2&&(n.preventDefault(),c.removeClass("hidden"),t.focus())});t.keyup(function(){$(this).val().length>1&&c.addClass("hidden")});$(window).scroll(function(){var n=$(document).scrollTop();n>98?$("body").addClass("nav-pinned"):$("body").removeClass("nav-pinned");n>540?$("body").addClass("nav-pinned2"):$("body").removeClass("nav-pinned2")})});!function(n){"object"==typeof module&&"object"==typeof module.exports?n(require("jquery"),window,document):n(jQuery,window,document)}(function(n,t,i){var r=[],u=function(){return r.length?r[r.length-1]:null},f=function(){for(var t=!1,n=r.length-1;n>=0;n--)r[n].$blocker&&(r[n].$blocker.toggleClass("current",!t).toggleClass("behind",t),t=!0)};n.modal=function(t,i){var e,f;if(this.$body=n("body"),this.options=n.extend({},n.modal.defaults,i),this.options.doFade=!isNaN(parseInt(this.options.fadeDuration,10)),this.$blocker=null,this.options.closeExisting)for(;n.modal.isActive();)n.modal.close();if(r.push(this),t.is("a"))if(f=t.attr("href"),this.anchor=t,/^#/.test(f)){if(this.$elm=n(f),1!==this.$elm.length)return null;this.$body.append(this.$elm);this.open()}else this.$elm=n("<div>"),this.$body.append(this.$elm),e=function(n,t){t.elm.remove()},this.showSpinner(),t.trigger(n.modal.AJAX_SEND),n.get(f).done(function(i){if(n.modal.isActive()){t.trigger(n.modal.AJAX_SUCCESS);var r=u();r.$elm.empty().append(i).on(n.modal.CLOSE,e);r.hideSpinner();r.open();t.trigger(n.modal.AJAX_COMPLETE)}}).fail(function(){t.trigger(n.modal.AJAX_FAIL);var i=u();i.hideSpinner();r.pop();t.trigger(n.modal.AJAX_COMPLETE)});else this.$elm=t,this.anchor=t,this.$body.append(this.$elm),this.open()};n.modal.prototype={constructor:n.modal,open:function(){var t=this;this.block();this.anchor.blur();this.options.doFade?setTimeout(function(){t.show()},this.options.fadeDuration*this.options.fadeDelay):this.show();n(i).off("keydown.modal").on("keydown.modal",function(n){var t=u();27===n.which&&t.options.escapeClose&&t.close()});this.options.clickClose&&this.$blocker.click(function(t){t.target===this&&n.modal.close()})},close:function(){r.pop();this.unblock();this.hide();n.modal.isActive()||n(i).off("keydown.modal")},block:function(){this.$elm.trigger(n.modal.BEFORE_BLOCK,[this._ctx()]);this.$body.css("overflow","hidden");this.$blocker=n('<div class="'+this.options.blockerClass+' blocker current"><\/div>').appendTo(this.$body);f();this.options.doFade&&this.$blocker.css("opacity",0).animate({opacity:1},this.options.fadeDuration);this.$elm.trigger(n.modal.BLOCK,[this._ctx()])},unblock:function(t){!t&&this.options.doFade?this.$blocker.fadeOut(this.options.fadeDuration,this.unblock.bind(this,!0)):(this.$blocker.children().appendTo(this.$body),this.$blocker.remove(),this.$blocker=null,f(),n.modal.isActive()||this.$body.css("overflow",""))},show:function(){this.$elm.trigger(n.modal.BEFORE_OPEN,[this._ctx()]);this.options.showClose&&(this.closeButton=n('<a href="#close-modal" rel="modal:close" class="close-modal '+this.options.closeClass+'">'+this.options.closeText+"<\/a>"),this.$elm.append(this.closeButton));this.$elm.addClass(this.options.modalClass).appendTo(this.$blocker);this.options.doFade?this.$elm.css({opacity:0,display:"inline-block"}).animate({opacity:1},this.options.fadeDuration):this.$elm.css("display","inline-block");this.$elm.trigger(n.modal.OPEN,[this._ctx()])},hide:function(){this.$elm.trigger(n.modal.BEFORE_CLOSE,[this._ctx()]);this.closeButton&&this.closeButton.remove();var t=this;this.options.doFade?this.$elm.fadeOut(this.options.fadeDuration,function(){t.$elm.trigger(n.modal.AFTER_CLOSE,[t._ctx()])}):this.$elm.hide(0,function(){t.$elm.trigger(n.modal.AFTER_CLOSE,[t._ctx()])});this.$elm.trigger(n.modal.CLOSE,[this._ctx()])},showSpinner:function(){this.options.showSpinner&&(this.spinner=this.spinner||n('<div class="'+this.options.modalClass+'-spinner"><\/div>').append(this.options.spinnerHtml),this.$body.append(this.spinner),this.spinner.show())},hideSpinner:function(){this.spinner&&this.spinner.remove()},_ctx:function(){return{elm:this.$elm,$elm:this.$elm,$blocker:this.$blocker,options:this.options,$anchor:this.anchor}}};n.modal.close=function(t){if(n.modal.isActive()){t&&t.preventDefault();var i=u();return i.close(),i.$elm}};n.modal.isActive=function(){return r.length>0};n.modal.getCurrent=u;n.modal.defaults={closeExisting:!0,escapeClose:!0,clickClose:!0,closeText:"Close",closeClass:"",modalClass:"modal",blockerClass:"jquery-modal",spinnerHtml:'<div class="rect1"><\/div><div class="rect2"><\/div><div class="rect3"><\/div><div class="rect4"><\/div>',showSpinner:!0,showClose:!0,fadeDuration:null,fadeDelay:1};n.modal.BEFORE_BLOCK="modal:before-block";n.modal.BLOCK="modal:block";n.modal.BEFORE_OPEN="modal:before-open";n.modal.OPEN="modal:open";n.modal.BEFORE_CLOSE="modal:before-close";n.modal.CLOSE="modal:close";n.modal.AFTER_CLOSE="modal:after-close";n.modal.AJAX_SEND="modal:ajax:send";n.modal.AJAX_SUCCESS="modal:ajax:success";n.modal.AJAX_FAIL="modal:ajax:fail";n.modal.AJAX_COMPLETE="modal:ajax:complete";n.fn.modal=function(t){return 1===this.length&&new n.modal(this,t),this};n(i).on("click.modal",'a[rel~="modal:close"]',n.modal.close);n(i).on("click.modal",'a[rel~="modal:open"]',function(t){t.preventDefault();n(this).modal()})});swf=swf||{};swf.forms={init:function(){function t(n){n.val()===""?n.addClass("default-option"):n.removeClass("default-option")}var i=this,n=$(".custom-select");n.each(function(n,i){t($(i))});n.on("change",function(){t($(this))});$("input[type=text], input[type=search], input[type=number], input[type=email], input[type=tel], input[type=date], textarea, select").focus(function(){$(this).parent("div").addClass("active")}).keydown(function(){$(this).parent("div").addClass("active")}).blur(function(){var n=$(this);setTimeout(function(){var t=n.parent("div");n.is("select")?$("option:selected",n).text().length===0&&t.removeClass("active"):n.val().length===0&&t.removeClass("active")},200)});$("input[type=email],input[type=tel]").keyup(function(){$(this).next("span").text().length>0&&$(this).valid()});$("#Title").change(function(){$(this).val()==="Other"?$("#OtherTitle").parent().removeClass("hidden"):$("#OtherTitle").parent().addClass("hidden")});$("#FundingRecipient").change(function(){$(this).val()==="Branch"?$("#fundingRecipientNameField").removeClass("hidden"):$("#fundingRecipientNameField").addClass("hidden")});$(".radioReveal input[type=radio]").change(function(){var n=$(this).parents("div").first().next();$(this).val()==="true"?n.removeClass("hidden"):n.addClass("hidden")});$("#HowMuchDoYouPlanToRaise").on("input",function(){$(this).val($(this).val().replace(/[^\d]/,""))});this.autosizeTextareas()},autosizeTextareas:function(){var n=$(document.createElement("div")),t=null;n.addClass("hiddendiv");$("body").append(n);$("form textarea").each(function(){var i=$(this);i.css({overflow:"hidden",resize:"none"});i.on("keyup",function(){i.val().length===0?i.css("height","auto"):(t=i.val(),n.css("width",i.width()),t=t.replace(/\n/g,"<br>"),n.html(t+'<br class="lbr">'),i.css("height",n.outerHeight()))})})},positionDirtyFieldLabels:function(){$("input[type=text], input[type=search], input[type=number], input[type=email], input[type=tel], input[type=date], textarea, select").each(function(){$(this).val().length>0&&$(this).parent("div").addClass("active")})}};$(function(){swf.forms.init()});window.addEventListener("DOMContentLoaded",function(){if(window.wpnc){var n=$("input[type='radio'], input[type='checkbox']");new wpnc.SelectionButtons(n)}swf.forms.positionDirtyFieldLabels()});$(function(){$('a[href*=vimeo],a[href*=youtube],a[href*="youtu.be"]',"main").click(function(n){n.preventDefault();var t=$("#videoModal");t.html(getVideoEmbedHtml($(this).attr("href")));t.modal()});$("body").on($.modal.OPEN,function(){resizeIframes()});$("body").append('<div id="videoModal" class="modal"><\/div>')}),function(n){"use strict";var i=n.jQuery,r=n.wpnc||{},t=function(n,t){this.selectedClass="selected";this.focusedClass="focused";this.radioClass="selection-button-radio";this.checkboxClass="prefCentreCheckbox";t!==undefined&&i.each(t,function(n,t){this[n]=t}.bind(this));typeof n=="string"?(this.selector=n,this.setInitialState(i(this.selector))):n!==undefined&&(this.$elms=n,this.setInitialState(this.$elms));this.addEvents()};t.prototype.addEvents=function(){typeof this.$elms!="undefined"?this.addElementLevelEvents():this.addDocumentLevelEvents()};t.prototype.setInitialState=function(n){n.each(function(n,t){var r=i(t),u=r.attr("type")==="radio"?this.radioClass:this.checkboxClass;r.parent("label").addClass(u);r.is(":checked")&&this.markSelected(r)}.bind(this))};t.prototype.markFocused=function(n,t){t==="focused"?n.parent("label").addClass(this.focusedClass):n.parent("label").removeClass(this.focusedClass)};t.prototype.markSelected=function(n){var t;n.attr("type")==="radio"?(t=n.attr("name"),i(n[0].form).find('input[name="'+t+'"]').parent("label").removeClass(this.selectedClass),n.parent("label").addClass(this.selectedClass)):n.is(":checked")?n.parent("label").addClass(this.selectedClass):n.parent("label").removeClass(this.selectedClass)};t.prototype.addElementLevelEvents=function(){this.clickHandler=this.getClickHandler();this.focusHandler=this.getFocusHandler({level:"element"});this.$elms.on("click",this.clickHandler).on("focus blur",this.focusHandler)};t.prototype.addDocumentLevelEvents=function(){this.clickHandler=this.getClickHandler();this.focusHandler=this.getFocusHandler({level:"document"});i(document).on("click",this.selector,this.clickHandler).on("focus blur",this.selector,this.focusHandler)};t.prototype.getClickHandler=function(){return function(n){this.markSelected(i(n.target))}.bind(this)};t.prototype.getFocusHandler=function(n){var t=n.level==="document"?"focusin":"focus";return function(n){var r=n.type===t?"focused":"blurred";this.markFocused(i(n.target),r)}.bind(this)};t.prototype.destroy=function(){typeof this.selector!="undefined"?i(document).off("click",this.selector,this.clickHandler).off("focus blur",this.selector,this.focusHandler):this.$elms.off("click",this.clickHandler).off("focus blur",this.focusHandler)};r.SelectionButtons=t;n.wpnc=r}(window)