!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):n(jQuery)}(function(n){var u,t,v,f=function(n){if(a[n])return a[n].apply(this,Array.prototype.slice.call(arguments,1));if("object"!=typeof n&&n)throw"Method "+n+" does not exist on jQuery.cardswipe";return a.init.apply(this,arguments)},w={generic:function(n){var i=new RegExp("^(%[^%;\\?]+\\?)?(;[0-9\\:<>\\=]+\\?)?([+;][0-9\\:<>\\=]+\\?)?"),t=i.exec(n);return t?{type:"generic",line1:t[1]?t[1].slice(1,-1):"",line2:t[2]?t[2].slice(1,-1):"",line3:t[3]?t[3].slice(1,-1):""}:null},visa:function(n){var r=new RegExp("^%B(4[0-9]{12,18})\\^([A-Z ]+)/([A-Z ]+)\\^([0-9]{2})([0-9]{2})"),t=r.exec(n),i;return t?(i=t[1],!o(i))?null:{type:"visa",account:i,lastName:t[2].trim(),firstName:t[3].trim(),expYear:t[4],expMonth:t[5]}:null},mastercard:function(n){var r=new RegExp("^%B(5[1-5][0-9]{14})\\^([A-Z ]+)/([A-Z ]+)\\^([0-9]{2})([0-9]{2})"),t=r.exec(n),i;return t?(i=t[1],!o(i))?null:{type:"mastercard",account:i,lastName:t[2],firstName:t[3],expYear:t[4],expMonth:t[5]}:null},discover:function(n){var r=new RegExp("^%B(6[0-9]{15})\\^([A-Z ]+)/([A-Z ]+)\\^([0-9]{2})([0-9]{2})"),t=r.exec(n),i;return t?(i=t[1],!o(i))?null:{type:"discover",account:i,lastName:t[2],firstName:t[3],expYear:t[4],expMonth:t[5]}:null},amex:function(n){var r=new RegExp("^%B(3[4|7][0-9]{13})\\^([A-Z ]+)/([A-Z ]+)\\^([0-9]{2})([0-9]{2})"),t=r.exec(n),i;return t?(i=t[1],!o(i))?null:{type:"amex",account:i,lastName:t[2],firstName:t[3],expYear:t[4],expMonth:t[5]}:null}},i={IDLE:0,PENDING:1,READING:2,DISCARD:3,PREFIX:4},y={0:"IDLE",1:"PENDING",2:"READING",3:"DISCARD",4:"PREFIX"},s=i.IDLE,r=function(){if(0===arguments.length)return s;var n=arguments[0];n!=r&&(t.debug&&console.log("%s -> %s",y[s],y[n]),n==i.READING&&v.trigger("scanstart.cardswipe"),s==i.READING&&v.trigger("scanend.cardswipe"),s=n)},h=0,b=function(f){switch(t.debug&&console.log(f.which+": "+String.fromCharCode(f.which)),r()){case i.IDLE:37==f.which&&(r(i.PENDING),u=[],c(f.which),f.preventDefault(),f.stopPropagation(),e());g(f.which)&&(r(i.PREFIX),f.preventDefault(),f.stopPropagation(),e());break;case i.PENDING:f.which>=65&&f.which<=90||f.which>=97&&f.which<=122?(r(i.READING),n("input").blur(),c(f.which),f.preventDefault(),f.stopPropagation(),e()):(l(),u=null,r(i.IDLE));break;case i.READING:c(f.which);e();f.preventDefault();f.stopPropagation();13==f.which&&(l(),r(i.IDLE),p());t.firstLineOnly&&63==f.which&&(r(i.DISCARD),p());break;case i.DISCARD:if(f.preventDefault(),f.stopPropagation(),13==f.which)return l(),void r(i.IDLE);e();break;case i.PREFIX:if(g(f.which))return void r(i.IDLE);f.preventDefault();f.stopPropagation();37==f.which&&(r(i.PENDING),u=[],c(f.which));e()}},c=function(n){u.push(String.fromCharCode(n))},e=function(){clearTimeout(h);h=setTimeout(nt,t.interdigitTimeout)},l=function(){clearTimeout(h);h=0},nt=function(){t.debug&&console.log("Timeout!");r()==i.READING&&p();u=null;r(i.IDLE)},p=function(){var i,r;t.debug&&console.log(u);i=u.join("");t.rawDataCallback&&t.rawDataCallback.call(this,i);r=k(i);r?(t.success&&t.success.call(this,r),n(document).trigger("success.cardswipe",r)):(t.failure&&t.failure.call(this,i),n(document).trigger("failure.cardswipe"))},k=function(i){for(var f,r,e,u=0;u<t.parsers.length;u++)if(r=t.parsers[u],n.isFunction(r)?f=r:"string"==typeof r&&(f=w[r]),null!=f){if(e=f.call(this,i),null==e)continue;return e}return null},tt=function(){n(document).on("keypress.cardswipe-listener",b)},d=function(){n(document).off(".cardswipe-listener",b)},it=function(n){var t=["Line 1: ",n.line1,"\nLine 2: ",n.line2,"\nLine 3: ",n.line3].join("");alert(t)},g=function(i){return t.prefixCodes?-1!=n.inArray(i,t.prefixCodes):!1},rt={enabled:!0,interdigitTimeout:250,success:it,failure:null,parsers:["generic"],firstLineOnly:!1,prefixCharacter:null,eventSource:document,debug:!1},o=function(n){for(var r,f=[0,2,4,6,8,1,3,5,7,9],t=0,u=n.length,i=!0;u--;)r=parseInt(n.charAt(u),10),t+=i?r:f[r],i=!i;return t%10==0&&t>0},a={init:function(f){if(t=n.extend({},rt,f),t.prefixCharacter){var e="[object Array]"===Object.prototype.toString.call(t.prefixCharacter);e||(t.prefixCharacter=[t.prefixCharacter]);t.prefixCodes=[];n(t.prefixCharacter).each(function(){if(1!=this.length)throw"prefixCharacter must be a single character";t.prefixCodes.push(this.charCodeAt(0))})}v=n(t.eventSource);l();r(i.IDLE);u=null;d();t.enabled&&a.enable()},disable:function(){d()},enable:function(){tt()}};f.luhnChecksum=o;f._states=function(){return i};f._stateNames=function(){return y};f._state=function(){return r()};f._settings=function(){return t};f._parseData=function(n){return k(n)};f._builtinParsers=function(){return w};n.cardswipe=f});String.format=function(){for(var i,t=arguments[0],n=0;n<arguments.length-1;n++)i=new RegExp("\\{"+n+"\\}","gm"),t=t.replace(i,arguments[n+1]);return t};var UIUtilities=function(n){var t={NullOrEmpty:function(n){return n===undefined||n===null||n===""},GetFormFieldRef:function(t){return n("input[name='"+t+"'],select[name='"+t+"'],textarea[name='"+t+"']")},LogMessage:function(n){console.log(n)}};return{NullOrEmpty:t.NullOrEmpty,Methods:t,GetFormFieldRef:t.GetFormFieldRef,LogErrorMessage:t.LogMessage}}(jQuery),UIFormFields={Registrant:{Email:"Registrant_Email_EmailAddress",ConfirmEmail:"EmailConf",City:"Registrant_Address_City",StateProvince:"Registrant_Address_StateCode",Country:"Registrant_Address_CountryCode",PostalCode:"Registrant_Address_PostalCode",CASL:"Registrant_CASLOptIn"},BillingInfo:{City:"BillingInfo_Address_City",StateProvince:"BillingInfo_Address_StateCode",Country:"BillingInfo_Address_CountryCode",PostalCode:"BillingInfo_Address_PostalCode",CardNumber:"BillingInfo_CreditCard",CardExpMonth:"BillingInfo_ExpMonth",CardExpYear:"BillingInfo_ExpYear",FirstName:"BillingInfo_FirstName",LastName:"BillingInfo_LastName"}},UITemplates={SuccessMessage:'<div class="cart-message text-success lead"><i class="fa fa-check" aria-hidden="true"><\/i> {0}<\/div>',ErrorMessage:'<div class="cart-message text-danger lead"><i class="fa fa-exclamation-triangle" aria-hidden="true"><\/i> {0}<\/div>',Spinner:'<i class="fa fa-spinner fa-spin"><\/i><span class="sr-only">Processing...<\/span>&nbsp;',SuccessMessageTable:'<tr><td colspan="{0}" class="cart-message text-success"><i class="fa fa-check" aria-hidden="true"><\/i> {1}<\/td><\/tr>',ErrorMessageTable:'<tr><td colspan="{0}" class="cart-message text-danger"><i class="fa fa-exclamation-circle" aria-hidden="true"><\/i> {1}<\/td><\/tr>',ToolTipMessage:'<div class="tooltip {0}" role="tooltip"><div class="tooltip-arrow"><\/div><div class="tooltip-inner"><\/div><\/div>',ProgressBar:'<div class="progress update-canvas progress-modal"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"><span class="sr-only">100% Complete<\/span><\/div><\/div>'},UIModals=function(n){var t={BindModalKeyEvent:function(){n("body").on("keyup.sbmt",function(t){var r=n(".modal-footer").find(".btn-primary"),i;n(this).is(":visible")&&(i=t.keyCode||t.which,i==="13"&&r.trigger("click"))})},BindModalCloseEvent:function(t){n(t).on("hidden.bs.modal",function(){var t="#"+n(this).data("returnfocus");n(t).focus()})},ShowProcessingModal:function(i){var r=n.extend({showtitle:!1,title:"",message:content.ProcessInformation,animation:"none",alignvertical:!0,returnFocus:"",showspinner:!1,showprogressbar:!0,"class":""},i),h;r.title!==""&&(r.showtitle=!0);t.HideProcessingModal();var u=n('<div class="modal fade" id="UIModals_Processing" data-backdrop="static" data-keyboard="false" tabindex="-1" data-returnfocus="'+r.returnFocus+'"><\/div>'),s=n('<div class="vertical-alignment-helper"><\/div>'),f=n('<div class="modal-dialog"><\/div>'),e=n('<div class="modal-content"><\/div>'),c=n('<div class="modal-header"><h4 class="modal-title">'+r.title+"<\/h4><\/div>"),o=n('<div class="modal-body processing">'+r.message+"<\/div>");(r.animation==="spinner"||r.showspinner===!0)&&(h=n('<h2 class="text-center"><span class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"><\/span><span class="sr-only">'+content.Loading+"...<\/span><\/h2>"),o.append(h));(r.animation==="progressbar"||r.showprogressbar===!0)&&o.append(n(UITemplates.ProgressBar));r.showtitle===!0&&e.append(c);e.append(o);f.append(e);r.alignvertical===!0?(f.addClass("vertical-align-center"),s.append(f),u.append(s)):u.append(f);r.class!==""&&u.addClass(r.class);u.modal("show");r.returnFocus!==""&&t.BindModalCloseEvent(u)},HideProcessingModal:function(){n("#UIModals_Processing").modal("hide");n("#UIModals_Processing").remove();n("body").removeClass("modal-open");n(".modal-backdrop").remove();n(document.body).css("padding-right",0);n(".navbar-fixed-top").css("padding-right",0)},UpdateProcessingModal:function(t){n("#UIModals_Processing").find(".modal-body").html(t)},ShowFormattedMessageModal:function(i,r){var u=n.extend({showtitle:!1,title:"",message:"This is a generic status message.",alignvertical:!0,returnFocus:"",hideFooter:!1,"class":""},i),h;u.title!==""&&(u.showtitle=!0);t.HideFormattedMessageModal(!1);var f=n('<div class="modal fade" id="UIModals_Status" data-backdrop="static" data-keyboard="false" tabindex="-1" data-returnfocus="'+u.returnFocus+'"><\/div>'),s=n('<div class="vertical-alignment-helper"><\/div>'),e=n('<div class="modal-dialog"><\/div>'),o=n('<div class="modal-content"><\/div>'),c=n('<div class="modal-header"><button type="button" class="close pull-right" data-dismiss="modal">&times;<\/button><h3 class="modal-title">'+u.title+"<\/h3><\/div>"),l=n('<div class="modal-body">'+u.message+"<\/div>");if(u.showtitle===!0&&o.append(c),o.append(l),u.hideFooter||(h=n('<div class="modal-footer"><a href="#" data-dismiss="modal" class="btn btn-primary">'+content.Ok+"<\/a><\/div>"),o.append(h)),e.append(o),u.alignvertical===!0?(e.addClass("vertical-align-center"),s.append(e),f.append(s)):f.append(e),u.class!==""&&f.addClass(u.class),f.modal("show"),r)f.on("hidden.bs.modal",r);u.returnFocus!==""&&t.BindModalCloseEvent(f)},HideFormattedMessageModal:function(t){n("#UIModals_Status").remove();t!==!1&&(n("body").removeClass("modal-open"),n(".modal-backdrop").remove())},ShowStatusModal:function(i,r){var u=n.extend({showtitle:!1,title:"",message:"This is a generic status message.",alignvertical:!0,returnFocus:"",hideFooter:!1,"class":""},i),c;u.title!==""&&(u.showtitle=!0);t.HideStatusModal(!1);var f=n('<div class="modal fade" id="UIModals_Status" data-backdrop="static" data-keyboard="false" tabindex="-1" data-returnfocus="'+u.returnFocus+'"><\/div>'),s=n('<div class="vertical-alignment-helper"><\/div>'),e=n('<div class="modal-dialog"><\/div>'),o=n('<div class="modal-content"><\/div>'),h=n('<div class="modal-header"><button type="button" class="close pull-right" data-dismiss="modal">&times;<\/button><\/div>'),l=n('<div class="modal-body"><h4>'+u.message+"<\/h4>");if(u.showtitle===!0&&h.append(n('<h4 class="modal-title">'+u.title+"<\/h4>")),o.append(h),o.append(l),u.hideFooter||(c=n('<div class="modal-footer"><a href="#" data-dismiss="modal" class="btn btn-primary">'+content.Ok+"<\/a><\/div>"),o.append(c)),e.append(o),u.alignvertical===!0?(e.addClass("vertical-align-center"),s.append(e),f.append(s)):f.append(e),u.class!==""&&f.addClass(u.class),f.modal("show"),r)f.on("hidden.bs.modal",r);u.returnFocus!==""&&t.BindModalCloseEvent(f)},HideStatusModal:function(t){n("#UIModals_Status").remove();t!==!1&&(n("body").removeClass("modal-open"),n(".modal-backdrop").remove())},ShowErrorModal:function(i){var r=n.extend({showtitle:!1,title:"",message:"An unknown error has occurred.",alignvertical:!0,returnFocus:"",hideFooter:!1,"class":""},i),s;r.title!==""&&(r.showtitle=!0);t.HideErrorModal();var u=n('<div class="modal fade" id="UIModals_Error" data-backdrop="static" data-keyboard="false" tabindex="-1" data-returnfocus="'+r.returnFocus+'"><\/div>'),o=n('<div class="vertical-alignment-helper"><\/div>'),f=n('<div class="modal-dialog"><\/div>'),e=n('<div class="modal-content panel-danger"><\/div>'),h=n('<div class="modal-header panel-heading"><h4 class="modal-title"><i class="fa fa-exclamation-circle" aria-hidden="true"><\/i> '+r.title+"<\/h4><\/div>"),c=n('<div class="modal-body panel-body error text-danger">'+r.message+"<\/div>");r.showtitle===!0&&e.append(h);e.append(c);r.hideFooter||(s=n('<div class="modal-footer"><a href="#" data-dismiss="modal" class="btn btn-danger">'+content.Ok+"<\/a><\/div>"),e.append(s));f.append(e);r.alignvertical===!0?(f.addClass("vertical-align-center"),o.append(f),u.append(o)):u.append(f);r.class!==""&&u.addClass(r.class);u.modal("show");r.returnFocus!==""&&t.BindModalCloseEvent(u)},HideErrorModal:function(){n("#UIModals_Error").remove();n("body").removeClass("modal-open");n(".modal-backdrop").remove()},ShowConfirmationModal:function(i,r){var u=n.extend({showtitle:!1,title:"",message:"Generic Confirmation Message",alignvertical:!0,returnFocus:"",hideFooter:!1,"class":""},i),l,s,h;u.title!==""&&(u.showtitle=!0);t.HideConfirmationModal(!1);var f=n('<div class="modal fade" id="UIModals_Confirmation" data-backdrop="static" data-keyboard="false" tabindex="-1"><\/div>'),c=n('<div class="vertical-alignment-helper"><\/div>'),e=n('<div class="modal-dialog"><\/div>'),o=n('<div class="modal-content"><\/div>'),a=n('<div class="modal-header"><button type="button" class="close pull-right" data-dismiss="modal">&times;<\/button><h3 class="modal-title">'+u.title+"<\/h3><\/div>"),v=n('<div class="modal-body"><h4>'+u.message+"<\/h4><\/div>");u.showtitle===!0&&o.append(a);o.append(v);u.hideFooter||(l=n('<div class="modal-footer"><a id=\'Confirmation_Ok\' data-dismiss="modal" href="#" class="btn btn-primary">'+content.Ok+'<\/a><a id=\'Confirmation_Cancel\' href="#" data-dismiss="modal" class="btn">'+content.Cancel+"<\/a><\/div>"),o.append(l));e.append(o);u.alignvertical===!0?(e.addClass("vertical-align-center"),c.append(e),f.append(c)):f.append(e);u.class!==""&&f.addClass(u.class);f.modal("show");s=function(){var t=n("#Confirmation_Ok");if(!t.length||t.length===0){setTimeout(s,250);return}t.on("click",null,function(){r(!0,i)})};h=function(){var t=n("#Confirmation_Cancel");if(!t.length||t.length===0){setTimeout(h,250);return}t.on("click",null,function(){r(!1,i)})};s();h()},HideConfirmationModal:function(t){n("#UIModals_Confirmation").remove();t!==!1&&(n("body").removeClass("modal-open"),n(".modal-backdrop").remove())}};return{ShowProcessing:t.ShowProcessingModal,HideProcessing:t.HideProcessingModal,UpdateProcessing:t.UpdateProcessingModal,ShowFormattedMessage:t.ShowFormattedMessageModal,HideFormattedMessage:t.HideFormattedMessageModal,ShowStatus:t.ShowStatusModal,HideStatus:t.HideStatusModal,ShowError:t.ShowErrorModal,HideError:t.HideErrorModal,ShowConfirmation:t.ShowConfirmationModal,HideConfirmation:t.HideErrorModal}}(jQuery),JSAPI=function(n){var t={GetQueryStringValueByName:function(n,t){t||(t=window.location.href);n=n.replace(/[\[\]]/g,"\\$&");var r=new RegExp("[?&]"+n+"(=([^&#]*)|&|#|$)"),i=r.exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},UpdateValidator:function(t){t.removeData("validator");t.removeData("unobtrusiveValidation");n.validator.unobtrusive.parse(t);t.validate()},SetMatchRule:function(i,r,u){var f=n("#"+i),e=n("#"+r);f.length>0&&e.length>0&&(f.attr("data-val","true"),f.attr("data-rule-equalTo","#"+r),f.attr("data-msg-equalTo",u),t.UpdateValidator(f.closest("form")))},SetValidationRule:function(n,i,r){var u=UIUtilities.GetFormFieldRef(n);!UIUtilities.NullOrEmpty(u)&&u.length>0&&(u.attr("data-val","true"),u.attr("data-val-"+i,r),t.UpdateValidator(u.closest("form")))},RequireItemSelectionOnPage:function(){JSAPI.Settings.RequireItemSelectionOnPage=!0},CheckItemSelectionOnPage:function(){var t=n("#cartitemcounthidden").val();return JSAPI.Settings.RequireItemSelectionOnPage.NullOrEmpty||!JSAPI.Settings.RequireItemSelectionOnPage||UIUtilities.NullOrEmpty(t)||t!="0"?!0:(JSAPI.ShowErrorModal({title:"Nothing Selected",message:"Please select at least one item to continue."}),!1)},RemoveValidationRule:function(n,i){var r=UIUtilities.GetFormFieldRef(n);!UIUtilities.NullOrEmpty(r)&&r.length>0&&(r.removeAttr("data-val-"+i),t.UpdateValidator(r.closest("form")))},SetRequiredField:function(i,r){var u=UIUtilities.GetFormFieldRef(i),f=n("label[for='"+i+"']");UIUtilities.NullOrEmpty(u)||(UIUtilities.NullOrEmpty(r)&&(r=f.text()+" "+content.IsRequired),f.addClass("required"),u.attr("data-val","true"),u.attr("data-val-required",r),t.UpdateValidator(u.closest("form")))},UnsetRequiredField:function(i){var r=UIUtilities.GetFormFieldRef(i),u=n("label[for='"+i+"']");UIUtilities.NullOrEmpty(r)||(r.removeAttr("data-val-required"),u.removeClass("required"),r.removeClass("check-required"),t.UpdateValidator(r.closest("form")))},ToggleFormGroup:function(t,i){var u=n("div.form-group[data-field='"+t+"']"),r;UIUtilities.NullOrEmpty(u)||u.toggle(i);r=n("[data-fieldlink='"+t+"']");UIUtilities.NullOrEmpty(r)||r.toggle(i)},FlagInvalidField:function(i,r){var u=UIUtilities.GetFormFieldRef(i);n(u).addClass("input-validation-error");n.validator.unobtrusive.showErrors(i,r);t.UpdateValidator(u.closest("form"))},RandomizeOptions:function(t){var i=UIUtilities.GetFormFieldRef(t),r,u,f,e;UIUtilities.NullOrEmpty(i)||(r=n(i).val(),u=n(i).children("option"),u.length>0&&(f=n(i).children("option[value='']"),i.html(f),e=u.filter(function(){return n(this).val()!==""}).sort(function(){return Math.round(Math.random())-.5}),e.each(function(){n(this).removeAttr("selected");i.append(this)})),UIUtilities.NullOrEmpty(r)&&(r=""),n(i).val(r))}};return{GetQueryStringValueByName:t.GetQueryStringValueByName,UpdateValidator:t.UpdateValidator,SetMatchRule:t.SetMatchRule,SetValidationRule:t.SetValidationRule,RemoveValidationRule:t.RemoveValidationRule,SetRequiredField:t.SetRequiredField,UnsetRequiredField:t.UnsetRequiredField,ToggleFormGroup:t.ToggleFormGroup,FlagInvalidField:t.FlagInvalidField,RandomizeOptions:t.RandomizeOptions,RequireItemSelectionOnPage:t.RequireItemSelectionOnPage,CheckItemSelectionOnPage:t.CheckItemSelectionOnPage,ShowProcessingModal:UIModals.ShowProcessing,HideProcessingModal:UIModals.HideProcessing,ShowStatusModal:UIModals.ShowStatus,HideStatusModal:UIModals.HideStatus,ShowErrorModal:UIModals.ShowError,HideErrorModal:UIModals.HideError,ShowFormattedMessage:UIModals.ShowFormattedMessage,HideFormattedMessage:UIModals.HideFormattedMessage,ShowConfirmation:UIModals.ShowConfirmation,HideConfirmation:UIModals.HideConfirmation,CallBacks:{FieldDependent:null,AddToCart:null},Settings:{RequireItemSelectionOnPage:!1}}}(jQuery),UIBase=function(n){var t={Init:function(){n("#page-ui").show();t.BindSpecialInputFields();t.BindCustomModalSizes();t.SetStandardValidationRules();t.FixedBootstrapModalShift();t.BindRegistrationPageEvents();UIUtilities.NullOrEmpty(n("#"+UIFormFields.Registrant.CASL))||(n("#"+UIFormFields.Registrant.Country).trigger("change"),n("#"+UIFormFields.Registrant.Email).trigger("change"));t.SetGridSelectorInitState();n("#warning-shown").length>0&&n("form.page-nav").append(n("#warning-shown"))},BindRegistrationPageEvents:function(){n.cardswipe&&n.cardswipe({firstLineOnly:!0,success:t.CardSwipeSuccess,failure:t.CardSwipeFail,parsers:["visa","amex","mastercard","discover","generic"],debug:!1});n("form.page-nav").on("submit",function(){var i=this;return JSAPI.CheckItemSelectionOnPage()?n(i).valid()?(JSAPI.ShowProcessingModal({animation:"progressbar"}),!0):(JSAPI.ShowErrorModal({message:content.ErrorContent}),t.FocusValidationSummary(),!1):!1});n(".btn-cancelreg").on("click",function(t){t.preventDefault();var i=n(this).attr("href");bootbox.confirm({title:content.CancelRegistration,message:'<div class="modal-body error text-danger">'+content.CancelRegistrationMessage+"<\/div>",buttons:{confirm:{label:content.CancelRegistration},cancel:{label:content.ContinueRegistration}},callback:function(n){n&&!UIUtilities.NullOrEmpty(i)&&(location.href=i)}})});n(".btn-cancelupgradereg").on("click",function(t){t.preventDefault();var i=n(this).attr("href");bootbox.confirm({title:content.CancelUpgradeRegistration,message:'<div class="modal-body error text-danger">'+content.CancelUpgradeRegistrationMessage+"<\/div>",buttons:{confirm:{label:content.CancelUpgradeRegistration},cancel:{label:content.ContinueRegistration}},callback:function(n){n&&!UIUtilities.NullOrEmpty(i)&&(location.href=i)}})})},CardSwipeSuccess:function(t){if(t.type==="generic"){JSAPI.ShowErrorModal({message:"The swiped card is either of an unknown type or contains incomplete magnetic strip data. Please try another card or enter your payment information manually."});return}t.firstName&&n("#"+UIFormFields.BillingInfo.FirstName).val(t.firstName.trim());t.lastName&&n("#"+UIFormFields.BillingInfo.LastName).val(t.lastName.trim());n("#"+UIFormFields.BillingInfo.CardNumber).val(t.account);n("#"+UIFormFields.BillingInfo.CardExpMonth).val(t.expMonth);t.expYear&&(t.expYear.length===2&&(t.expYear="20"+t.expYear),n("#"+UIFormFields.BillingInfo.CardExpYear).val(t.expYear))},CardSwipeFail:function(){JSAPI.ShowErrorModal({message:"There was a problem reading your card's magnetic strip. If you continue to have problems you may need to enter your payment information manually."})},InitAfterRefresh:function(){t.Init();UIModals.HideProcessing()},SetGridSelectorInitState:function(){n.each(n("table.item-grid"),function(){n(this).find("tr.item-selector").length===0&&n(this).parent("div.item-widget").hide()});n.bootstrapSortable(!0)},SetStandardValidationRules:function(){JSAPI.SetMatchRule(UIFormFields.Registrant.ConfirmEmail,UIFormFields.Registrant.Email,content.ConfirmEmail)},FocusValidationSummary:function(){var t,i;try{t=n("div.alert.validation-summary-errors:visible").first();UIUtilities.NullOrEmpty(t)||(i=n(t).offset().top-20,n("html, body").animate({scrollTop:i},200))}catch(r){}},BindCustomModalSizes:function(){n(".modal-wide").on("show.bs.modal",function(){var t=n(window).height()-200;n(this).find(".modal-body").css("max-height",t)});n(".modal-medium").on("show.bs.modal",function(){var t=n(window).height()-200;n(this).find(".modal-body").css("max-height",t)})},BindSpecialInputFields:function(){n("form :input").each(function(){var t,i;if(n(this).attr("type")==="datetime"){n(this).datetimepicker();t=n(this).parent("div:first");t.attr("class","input-group date");i=n(".input-group-addon",t);i.on("click",function(){n(this).siblings("input[type='datetime']").focus()})}});n(".datetimepicker").datetimepicker({useCurrent:!1,format:"MM/DD/YYYY hh:mm:ss A",showClose:!0});n(".timepicker").datetimepicker({format:"LT"});n("[data-toggle='popover']").popover({animation:!0,container:"body"});n("[data-toggle='tooltip']").tooltip();n("input[data-val-length-max], textarea[data-val-length-max]").each(function(){var t=n(this),i=t.data();t.attr("maxlength",i.valLengthMax)});n(document).on("change","select.toggle-other",function(){t.HandleOtherOption(n(this))});n(document).on("click","input[type='checkbox'].toggle-other",function(){t.HandleOtherCheckBox(n(this))});n(document).on("change","select.toggle-other",function(){t.HandleOtherOption(n(this))});n(document).on("click","input[type='radio'].toggle-other",function(){t.HandleOtherRadioButton(n(this))});n(document).on("click","input[type='radio'].untoggle-other",function(){t.HandleOtherRadioButton(n(this))});n("#"+UIFormFields.Registrant.Email).on("change",function(){var i="none",r=n("#"+UIFormFields.Registrant.Country),t=n("#"+UIFormFields.Registrant.CASL);t.length===0&&(t=UIUtilities.GetFormFieldRef(UIFormFields.Registrant.CASL.replace("_",".")));r.length?i=r.val().toLowerCase():t.length&&t.val().toLowerCase()==="true"&&n(this).val().toLowerCase()!=="ca"&&(i="ca");n(this).val().toLowerCase().match(/.ca$/)||i.toLowerCase()==="ca"?(JSAPI.ToggleFormGroup(t.attr("name"),!0),JSAPI.SetRequiredField(t.attr("name"),content.OptInCanadian)):(JSAPI.ToggleFormGroup(t.attr("name"),!1),JSAPI.UnsetRequiredField(t.attr("name")))});n("#"+UIFormFields.Registrant.Country).on("change",function(){var i="none",r=n("#"+UIFormFields.Registrant.Email),t=n("#"+UIFormFields.Registrant.CASL);t.length===0&&(t=UIUtilities.GetFormFieldRef(UIFormFields.Registrant.CASL.replace("_",".")));r.length?i=r.val().toLowerCase():t.length&&t.val().toLowerCase()==="true"&&n(this).val().toLowerCase()!=="ca"&&(i="none.ca");n(this).val().toLowerCase()==="ca"||i.match(/.ca$/)?(JSAPI.ToggleFormGroup(t.attr("name"),!0),JSAPI.SetRequiredField(t.attr("name"),content.OptInCanadian)):(JSAPI.ToggleFormGroup(t.attr("name"),!1),JSAPI.UnsetRequiredField(t.attr("name")))});n("select[data-randomize='true']").each(function(){JSAPI.RandomizeOptions(n(this).attr("name"))})},UpdateValidator:function(n){console.log("UIBase.UpdateValidator is deprecated. Use JSAPI.UpdateValidator instead.");JSAPI.UpdateValidator(n)},SetMatchRule:function(n,t,i){console.log("UIBase.SetMatchRule is deprecated. Use JSAPI.SetMatchRule instead.");JSAPI.SetMatchRule(n,t,i)},SetValidationRule:function(n,t,i){console.log("UIBase.SetValidationRule is deprecated. Use JSAPI.SetValidationRule instead.");JSAPI.SetValidationRule(n,t,i)},RemoveValidationRule:function(n,t){console.log("UIBase.RemoveValidationRule is deprecated. Use JSAPI.RemoveValidationRule instead.");JSAPI.RemoveValidationRule(n,t)},SetRequiredField:function(n,t){console.log("UIBase.SetRequiredField is deprecated. Use JSAPI.SetRequiredField instead.");JSAPI.SetRequiredField(n,t)},UnsetRequiredField:function(n){console.log("UIBase.UnsetRequiredField is deprecated. Use JSAPI.UnsetRequiredField instead.");JSAPI.UnsetRequiredField(n)},ToggleFormGroup:function(n,t){console.log("UIBase.ToggleFormGroup is deprecated. Use JSAPI.ToggleFormGroup");JSAPI.ToggleFormGroup(n,t)},FlagInvalidField:function(n,t){console.log("UIBase.FlagInvalidField is deprecated. Use JSAPI.FlagInvalidField");JSAPI.FlagInvalidField(n,t)},HandleOtherOption:function(t){if(!UIUtilities.NullOrEmpty(t)){var i=n(t).attr("name")+"_other",r=n("input[name='"+i+"']");n(t).find("option.toggle-other:selected").length>0?(r.show(),JSAPI.SetRequiredField(i,r.data("valmessage"))):(r.val("").hide(),JSAPI.UnsetRequiredField(i))}},HandleOtherCheckBox:function(t){if(!UIUtilities.NullOrEmpty(t)){var i=n(t).attr("name")+"_other",r=n("input[name='"+i+"']");n(t).is(":checked")?(r.show(),JSAPI.SetRequiredField(i,r.data("valmessage"))):(r.val("").hide(),JSAPI.UnsetRequiredField(i))}},HandleOtherRadioButton:function(t){if(!UIUtilities.NullOrEmpty(t)){var i=n(t).attr("name")+"_other",r=n("input[name='"+i+"']");n(t).hasClass("toggle-other")?(r.show(),JSAPI.SetRequiredField(i,r.data("valmessage"))):n(t).hasClass("untoggle-other")&&(r.val("").hide(),JSAPI.UnsetRequiredField(i))}},ConstructOtherInput:function(t){var i=n('<input type="text"/>');return i.attr("name",t+"_other"),i.addClass("form-control"),i},FixedBootstrapModalShift:function(){n(document.body).on("show.bs.modal",function(){if(!(this.clientHeight<=window.innerHeight)){var i=t.GetScrollBarWidth();i&&(n(document.body).css("padding-right",i),n(".navbar-fixed-top").css("padding-right",i))}}).on("hidden.bs.modal",function(){n(document.body).css("padding-right",0);n(".navbar-fixed-top").css("padding-right",0)})},GetScrollBarWidth:function(){var t=document.createElement("p"),n,r,i;return t.style.width="100%",t.style.height="200px",n=document.createElement("div"),n.style.position="absolute",n.style.top="0px",n.style.left="0px",n.style.visibility="hidden",n.style.width="200px",n.style.height="150px",n.style.overflow="hidden",n.appendChild(t),document.body.appendChild(n),r=t.offsetWidth,n.style.overflow="scroll",i=t.offsetWidth,r===i&&(i=n.clientWidth),document.body.removeChild(n),r-i}};return{Init:t.Init,InitAfterRefresh:t.InitAfterRefresh,SetValidationRule:t.SetValidationRule,RemoveValidationRule:t.RemoveValidationRule,SetRequiredField:t.SetRequiredField,UnsetRequiredField:t.UnsetRequiredField,ToggleFormGroup:t.ToggleFormGroup,FlagInvalidField:t.FlagInvalidField,UpdateValidator:t.UpdateValidator,RandomizeOptions:t.RandomizeOptions,FixBootStrapModalShift:t.FixedBootstrapModalShift}}(jQuery),UIAjaxHandlers=function(n){var r={AjaxPostUrl:"",LogEnabled:!1,IncludeBEOnlyOptions:!1},i={FeaturePluginIds:{MemberLookupFeaturePluginId:"ea993820-6416-4979-bd8c-0d0fe5f1a42b",PayByInvoiceFeaturePluginId:"773E1B9E-722A-40C5-AFE3-D0B68E09EFDD",AlumniLookupFeaturePluginId:"496427da-63ff-480e-8d5f-262f59b08e01"},AjaxHandlerKeys:{BadgePreviewAjaxHandlerKey:"BadgePreviewAjaxHandler",FormStateAjaxHandlerKey:"FormStateAjaxHandler",MemberLookupAjaxHandlerKey:"MemberLookupAjaxHandler",AlumniLookupAjaxHandlerKey:"AlumniLookupAjaxHandler",PayByInvoiceAjaxHandlerKey:"PayByInvoiceAjaxHandler",PostalCodeAjaxHandlerKey:"PostalCodeAjaxHandler",PromoCodeAjaxHandlerKey:"PromoCodeAjaxHandler",SetRegistrationCategoryAjaxHandlerKey:"SetRegClassAjaxHandler",ShoppingCartAjaxHandlerKey:"CartAjaxHandler"}},t={LogMessage:function(n){r.LogEnabled!==!0||UIUtilities.NullOrEmpty(n)||console.log(n)},Init:function(i){n.extend(r,i);globalSettings.AjaxPostUrl=r.AjaxPostUrl;t.BindPageElements();t.LogMessage("UIAjaxHandlers initialized.");n(".field-dependent").trigger("change")},BindPageElements:function(){n(document).ajaxError(function(n,t,i,r){var u=content.ErrorOccurredAccessing+" "+i.url+". "+r;console.error(u);UIModals.HideProcessing();UIModals.ShowError({message:content.ErrorOccurred})});n("body").off("change","input.field-dependent, select.field-dependent, textarea.field-dependent");n("body").on("change","input.field-dependent, select.field-dependent, textarea.field-dependent",function(i){i.preventDefault();t.RequestUpdatedUi(n(this))});t.BindCartElements();t.BindPromoFields();t.BindPostalCodeFields();t.BindMemberLookupElements();t.BindLookupElements();n('[data-toggle="popover"]').popover()},BindMemberLookupElements:function(){n("body").off("click","#btn-membersearch, a.membersearch, button.membersearch").on("click","#btn-membersearch, a.membersearch, button.membersearch",function(n){return n.preventDefault(),UIAjaxHandlers.MemberSearch(),!1});n("body").on("keypress","input.member-lookup",function(n){return n.keyCode===10||n.keyCode===13?(n.preventDefault(),UIAjaxHandlers.MemberSearch(),!1):!0})},BindLookupElements:function(){n(".lookup-form input.required").removeClass("required").addClass("required-lookup");n("body").off("click",".btn-lookup").on("click",".btn-lookup",function(i){i.preventDefault();var r=n(this).closest(".lookup-form");t.Lookup(r)});n("body").on("keypress",".lookup-form :input",function(i){if(i.keyCode===10||i.keyCode===13){i.preventDefault();var r=n(this).closest(".lookup-form");return t.Lookup(r),!1}return!0});n("body").off("click",".btn-lookupselect").on("click",".btn-lookupselect",function(i){i.preventDefault();t.LookupSelect(n(this))})},BindCartElements:function(){n("body").off("click","a.btn-cart-view, button.btn-cart-view");n("body").on("click","a.btn-cart-view, button.btn-cart-view",function(){t.ViewCart()});n("body").off("click",".additem");n("body").on("click",".additem",function(){t.LogMessage("item request started");n(this).hasClass("chk")?(t.LogMessage("checkbox item selector invoked."),n(this).is(":checked")?t.AddCartItem(this):t.RemoveCartItem(this)):(t.LogMessage("standard selector invoked."),t.AddCartItem(this))});n("body").off("click","a.btn-cart-remove, button.btn-cart-remove");n("body").on("click","a.btn-cart-remove, button.btn-cart-remove",function(){t.RemoveCartItem(this)});n("body").off("click","a.btn-cart-checkout, button.btn-cart-checkout");n("body").on("click","a.btn-cart-checkout, button.btn-cart-checkout",function(){n("form.page-nav").submit()});n("body").off("click","a.review-badge, button.review-badge");n("body").on("click","a.review-badge, button.review-badge",function(i){i.preventDefault();t.ViewBadge(n(this).data("regid"))})},BindPromoFields:function(){n("#pagenav-continue").off("click");n("#pagenav-continue").on("click",function(i){n("input.promo-lookup").length<=0||(i.preventDefault(),t.ValidatePromo(n("input.promo-lookup")))});n("body").off("click",".btn-applypromo");n("body").on("click",".btn-applypromo",function(n){n.preventDefault();t.ApplyPromoCode()})},BindPostalCodeFields:function(){n("#"+UIFormFields.Registrant.PostalCode+", #"+UIFormFields.BillingInfo.PostalCode).off("change");n("#"+UIFormFields.Registrant.PostalCode+", #"+UIFormFields.BillingInfo.PostalCode).on("change",function(){t.PostalCodeLookup(n(this))})},ChangeToolTipColor:function(t){n(".tooltip-inner").css("background-color",t);n(".tooltip.top .tooltip-arrow").css("border-top-color",t);n(".tooltip.right .tooltip-arrow").css("border-right-color",t);n(".tooltip.left .tooltip-arrow").css("border-left-color",t);n(".tooltip.bottom .tooltip-arrow").css("border-bottom-color",t)},ShowToolTipMessage:function(t,i,r,u){UIUtilities.NullOrEmpty(u)&&(u=5e3);var f=String.format(UITemplates.ToolTipMessage,"tooltip-"+r);n(t).tooltip({html:!0,template:f,title:i});n(t).tooltip("show")},GetItemUpsell:function(u,f){var e={AjaxHandlerKey:i.AjaxHandlerKeys.ShoppingCartAjaxHandlerKey,Action:"Upsell",ConfigId:n(u).data("configid"),language:JSAPI.GetQueryStringValueByName("language"),confirmed:f};UIModals.ShowProcessing({showtitle:!1,message:"Verifying your selection...",animation:"progressbar"});n.post(r.AjaxPostUrl,e,function(i){var r,f,e;if(UIModals.HideProcessing(),r=JSON.parse(i),r.Success){if(UIUtilities.NullOrEmpty(r.Message)||r.HasUpsellItem===!0){t.AddCartItem(u,!0);return}f=n(".additem[data-itemcode='"+r.SwapItem+"']");e=bootbox.confirm({message:r.Message,callback:function(n){n&&!UIUtilities.NullOrEmpty(f)?t.AddCartItem(f[0],!0):t.AddCartItem(u,!0)}});e.css({top:"50%","margin-top":function(){return-(e.height()/2)}})}else{UIModals.ShowError({message:r.Message});return}})},AddCartItem:function(u,f){var c=n(u).data("upsell"),h;if(c==="True"&&f!==!0){t.GetItemUpsell(u,!1);return}var l=n(u).clone(),e=n(u).is(":checkbox"),o=1,s=n(u).parent().find("select.item-qty-selector");s.length>0&&(o=s.val());f!==!0&&(f=!1);h={ItemId:n(u).data("itemid"),Quantity:o,AjaxHandlerKey:i.AjaxHandlerKeys.ShoppingCartAjaxHandlerKey,Action:"Add",language:JSAPI.GetQueryStringValueByName("language"),confirmed:f};n(u).is(":disabled")||n(u).prop("disabled",!0);UIModals.ShowProcessing({showtitle:!1,message:"Verifying your selection...",animation:"progressbar"});n.post(r.AjaxPostUrl,h,function(i){var o=!0,r=JSON.parse(i),f=null;if(r.Success===!0)n(".cart-count").html(r.CartCount),n("#cartitemcounthidden").val(r.CartCount),f=n(String.format(UITemplates.SuccessMessage,r.Message+". Updating selections..."));else{if(e&&n(u).prop("checked",!1),r.ConfirmationRequired===!0){bootbox.confirm({message:r.Message,callback:function(i){i?t.AddCartItem(u,!0):n(u).replaceWith(l)}});return}f=n(String.format(UITemplates.ErrorMessage,r.Message));o=e}UIUtilities.NullOrEmpty(r.AdditionalMessages)||n.each(r.AdditionalMessages,function(n,t){f.append('<div class="item-message">'+t.trim()+"<\/div>")});f.append(n(UITemplates.ProgressBar));UIModals.UpdateProcessing(f.html());o?UIAjaxHandlers.GetStepBody():UIModals.HideProcessing()})},RemoveCartItem:function(u){var f={AjaxHandlerKey:i.AjaxHandlerKeys.ShoppingCartAjaxHandlerKey,Action:"Remove",ItemInstanceId:n(u).data("id"),language:JSAPI.GetQueryStringValueByName("language")};n(u).prop("disabled",!0);UIModals.ShowProcessing({showtitle:!1,message:"Processing your cart...",animation:"progressbar"});n.post(r.AjaxPostUrl,f,function(i){var f=JSON.parse(i),r=null,e=n(u).data("cartview")===!0;f.Success===!0?(e?(f.Message+=" Recalculating totals...",r=n(String.format(UITemplates.SuccessMessage,"Item removed from cart. Recalculating totals..."))):r=n(String.format(UITemplates.SuccessMessage,"Item removed from cart. Updating selections...")),n(".cart-count").html(f.CartCount),n("#cartitemcounthidden").val(f.CartCount)):r=n(String.format(UITemplates.ErrorMessage,f.Message));r.append(n(UITemplates.ProgressBar));UIModals.UpdateProcessing(r.html());e?(n(u).closest(".cart-row").replaceWith(r),UIAjaxHandlers.GetStepBody(),t.ViewCart(!0)):UIAjaxHandlers.GetStepBody()})},GetStepBody:function(){var i={GetStepBody:window.location.href,language:JSAPI.GetQueryStringValueByName("language")};UIAjaxHandlers.MakeAjaxCall(i,function(i){n("#render-body").html(i);t.BindPageElements();UIBase.InitAfterRefresh()})},ViewCart:function(t){t!==!0&&UIModals.ShowProcessing({showtitle:!1,message:"Retrieving cart items...",animation:"progressbar"});var u={AjaxHandlerKey:i.AjaxHandlerKeys.ShoppingCartAjaxHandlerKey,Action:"View",language:JSAPI.GetQueryStringValueByName("language")};n.post(r.AjaxPostUrl,u,function(n){UIModals.HideProcessing();UIModals.ShowStatus({title:'<span class="text-primary"><i class="fa fa-shopping-cart"><\/i> '+content.YourCart+"<\/span>",message:n,hideFooter:!0,"class":"modal-medium"})})},ViewBadge:function(u){t.LogMessage("ViewBadge() started with id "+u);UIModals.ShowProcessing();var f={AjaxHandlerKey:i.AjaxHandlerKeys.BadgePreviewAjaxHandlerKey,BadgeId:u,language:JSAPI.GetQueryStringValueByName("language")};n.post(r.AjaxPostUrl,f,function(n){UIModals.HideProcessing();UIModals.ShowStatus({title:content.BadgePreviewTitle,message:n})})},MakeAjaxCall:function(t,i){n.post(r.AjaxPostUrl,t,function(n){i(n)})},Lookup:function(u){var s,e,o,h,f;if(UIModals.HideStatus(),s="input.required-lookup",e=n(u).find(s).filter(function(){return this.value.trim()===""}),e.length>0)return o=" The following required fields were not supplied:",n(e).each(function(t,i){var r=n(i).data("displayname");(r===""||r===undefined)&&(r=n(i).attr("name"));o+="<div>"+r+"<\/div>"}),UIModals.ShowError({message:o}),!1;UIModals.ShowProcessing();h=n(u).data("lookuptype");f={FeaturePluginId:i.FeaturePluginIds.MemberLookupFeaturePluginId,AjaxHandlerKey:i.AjaxHandlerKeys.MemberLookupAjaxHandlerKey,Action:"Search",FormData:n(u).find("input").serializeArray(),language:JSAPI.GetQueryStringValueByName("language")};h==="alumni"&&(f.FeaturePluginId=i.FeaturePluginIds.AlumniLookupFeaturePluginId,f.AjaxHandlerKey=i.AjaxHandlerKeys.AlumniLookupAjaxHandlerKey);t.LogMessage("lookup post data: "+JSON.stringify(f));n.post(r.AjaxPostUrl,f,function(t){var i=JSON.parse(t);if(UIModals.HideProcessing(),!i.IsSuccessful){UIModals.ShowError({message:i.ErrorMessage});return}switch(i.DisplayType){case 3:n("form.page-nav").html(i.DisplayMarkup);break;case 2:n("#lookup-results").html(i.DisplayMarkup);break;case 1:default:UIModals.ShowStatus({message:i.DisplayMarkup,hideFooter:!0,"class":"modal-medium"})}})},LookupSelect:function(u){var f,e;UIModals.HideStatus();UIModals.ShowProcessing();f={FeaturePluginId:i.FeaturePluginIds.MemberLookupFeaturePluginId,AjaxHandlerKey:i.AjaxHandlerKeys.MemberLookupAjaxHandlerKey,Action:"Select",SearchId:n(u).data("sessionid"),RecordId:n(u).data("resultid")};n(u).each(function(){n.each(this.attributes,function(){this.name.startsWith("data-")&&this.name!=="data-sessionid"&&this.name!=="data-resultid"&&this.name!=="data-lookuptype"&&(f[this.name.substring(5)]=this.value)})});e=n(u).data("lookuptype");e==="alumni"&&(f.FeaturePluginId=i.FeaturePluginIds.AlumniLookupFeaturePluginId,f.AjaxHandlerKey=i.AjaxHandlerKeys.AlumniLookupAjaxHandlerKey);t.LogMessage("lookup select data: "+JSON.stringify(f));n.post(r.AjaxPostUrl,f,function(t){var i=JSON.parse(t);if(UIModals.HideProcessing(),!i.IsSuccessful){UIModals.ShowError({message:i.ErrorMessage});return}n("form.page-nav").submit()})},MemberSearch:function(u){UIModals.HideStatus();UIModals.ShowProcessing();var f={FeaturePluginId:i.FeaturePluginIds.MemberLookupFeaturePluginId,AjaxHandlerKey:i.AjaxHandlerKeys.MemberLookupAjaxHandlerKey,Action:"Search",RegId:u,FormData:n(".member-lookup").serializeArray(),language:JSAPI.GetQueryStringValueByName("language")};n.post(r.AjaxPostUrl,f,function(i){t.LogMessage(i);var r=JSON.parse(i);if(UIModals.HideProcessing(),!r.IsSuccessful){UIModals.ShowError({message:r.ErrorMessage});return}switch(r.DisplayType){case 3:n("form.page-nav").html(r.DisplayMarkup);break;case 2:n("#memberlookup-results").html(r.DisplayMarkup);break;case 1:default:UIModals.ShowStatus({message:r.DisplayMarkup,hideFooter:!0,"class":"modal-medium"})}})},MemberLookupModal:function(t){UIModals.HideStatus();UIModals.ShowProcessing();var u={FeaturePluginId:i.FeaturePluginIds.MemberLookupFeaturePluginId,AjaxHandlerKey:i.AjaxHandlerKeys.MemberLookupAjaxHandlerKey,Action:"Search",RegId:t,FormData:n(".member-lookup").serializeArray(),language:JSAPI.GetQueryStringValueByName("language")};n.post(r.AjaxPostUrl,u,function(n){if(console.log("Raw Response: "+JSON.stringify(n)),UIModals.HideProcessing(),!result.IsSuccessful){UIModals.ShowError({message:result.ErrorMessage});return}UIModals.ShowStatus({message:result.DisplayMarkup,hideFooter:!0,"class":"modal-medium"})})},MemberLookupFillReg:function(t,u,f){UIModals.HideStatus();UIModals.ShowProcessing();var e={FeaturePluginId:i.FeaturePluginIds.MemberLookupFeaturePluginId,AjaxHandlerKey:i.AjaxHandlerKeys.MemberLookupAjaxHandlerKey,Action:"FillReg",RegId:t,PersonId:f,AssociationId:u};n.post(r.AjaxPostUrl,e,function(){UIModals.HideProcessing();n("form.page-nav").submit()})},MemberSelect:function(t,u,f){UIModals.HideStatus();UIModals.ShowProcessing();var e={FeaturePluginId:i.FeaturePluginIds.MemberLookupFeaturePluginId,AjaxHandlerKey:i.AjaxHandlerKeys.MemberLookupAjaxHandlerKey,Action:"Select",RegId:t,SearchId:u,RecordId:f};n.post(r.AjaxPostUrl,e,function(t){var i=JSON.parse(t);if(UIModals.HideProcessing(),!i.IsSuccessful){UIModals.ShowError({message:i.ErrorMessage});return}n("form.page-nav").submit()})},MemberLookupFillRegAndCategory:function(t){UIModals.HideStatus();UIModals.ShowProcessing();var u={FeaturePluginId:i.FeaturePluginIds.MemberLookupFeaturePluginId,AjaxHandlerKey:i.AjaxHandlerKeys.MemberLookupAjaxHandlerKey,Action:"FillRegAndCategory",CategoryCode:t,FormData:n(".member-lookup").serializeArray()};n.post(r.AjaxPostUrl,u,function(){UIModals.HideProcessing();n("form.page-nav").submit()})},PayByInvoice:function(t,u,f){var e=n("#AgreeToTermsAndConditions"),o;if(e.length&&e.attr("aria-required")==="true"&&!e.prop("checked"))return JSAPI.ShowErrorModal({title:"Terms and Conditions",message:"You must agree to the terms and conditions"}),!1;UIModals.HideStatus();UIModals.ShowProcessing({showtitle:!1,message:"Processing please wait...",animation:"progressbar"});o={FeaturePluginId:i.FeaturePluginIds.PayByInvoiceFeaturePluginId,AjaxHandlerKey:i.AjaxHandlerKeys.PayByInvoiceAjaxHandlerKey,Action:"PayByInvoice",RegCategoryCode:u,RegId:t,PaymentOption:f};n.post(r.AjaxPostUrl,o,function(){n("#PayByInvoice").val(f);n(".form-definition").find("input, select, textarea, checkbox").each(function(){JSAPI.UnsetRequiredField(n(this).attr("name"))});UIModals.HideProcessing();n("form.page-nav").submit()})},SetRegCategory:function(t,u){UIModals.HideStatus();UIModals.ShowProcessing({showtitle:!1,message:"Processing please wait...",animation:"progressbar"});var f={AjaxHandlerKey:i.AjaxHandlerKeys.SetRegistrationCategoryAjaxHandlerKey,Action:"SetClass",RegCategoryCode:u,RegId:t};n.post(r.AjaxPostUrl,f,function(){})},RequestUpdatedUi:function(u){t.LogMessage("RequestUpdatedUi triggered.");var f={AjaxHandlerKey:i.AjaxHandlerKeys.FormStateAjaxHandlerKey,CallingField:n(u).attr("name"),FormId:n(u).closest("div.form-definition").data("id"),IncludeBEOnlyOptions:r.IncludeBEOnlyOptions,FormData:n(u).closest("form").serializeArray(),language:JSAPI.GetQueryStringValueByName("language")};n.post(r.AjaxPostUrl,f,function(i){t.LogMessage("RequestUpdatedUi post response:"+JSON.stringify(i));n.each(JSON.parse(i),function(t,i){var r,u;JSAPI.ToggleFormGroup(i.FieldName,i.IsApplicable);UIUtilities.NullOrEmpty(i.RenderedHtml)||n("div.form-group[data-field='"+i.FieldName+"']").replaceWith(i.RenderedHtml);r=UIUtilities.GetFormFieldRef(i.FieldName);!UIUtilities.NullOrEmpty(r)&&n(r).length>0&&(u=n(r)[0].tagName,i.IsApplicable||(r.is("[type='checkbox'],[type='radio']")?r.attr("checked",!1):r.val("")),i.IsRequired?JSAPI.SetRequiredField(i.FieldName,i.DisplayName+" "+content.IsRequired):JSAPI.UnsetRequiredField(i.FieldName),u==="SELECT"&&(n(r).children("option").remove(),n(r).is("[multiple]")||n(r).append('<option value="">'+content.PleaseSelect+"<\/option>"),n.each(i.Options,function(t,i){var u=n('<option value="'+i.Value+'">'+i.Display+"<\/option>");i.IsSelected&&n(u).attr("selected","selected");i.AllowOther&&n(u).addClass("toggle-other");n(r).append(u)})))});JSAPI.CallBacks.FieldDependent!=null&&JSAPI.CallBacks.FieldDependent()})},ApplyPromoCode:function(){var u,f,e;if(r.LogEnabled=!0,t.LogMessage("ApplyPromoCode fired"),u=n("input.applypromo"),!UIUtilities.NullOrEmpty(u)){if(f=n(u).val(),t.LogMessage("ApplyPromoCode: promo value = "+f),UIUtilities.NullOrEmpty(f)){UIModals.ShowError({message:content.NoPromoCodeSuppliedMessage});return}UIModals.ShowProcessing({message:content.CheckingPromoCodeMessage,animation:"progressbar"});e={AjaxHandlerKey:i.AjaxHandlerKeys.PromoCodeAjaxHandlerKey,Action:"Validate",PromoCode:f,SaveIfValid:!0,language:JSAPI.GetQueryStringValueByName("language")};n.post(r.AjaxPostUrl,e,function(i){UIModals.HideProcessing();var r=JSON.parse(i);if(t.LogMessage("ApplyPromoCode validate response: "+r),r.Valid){UIModals.ShowProcessing({message:content.UpdatingItemsMessage,animation:"progressbar"});t.LogMessage("ApplyPromoCode: ready to reload page...");location.reload(!0);return}n(u).val("");UIModals.ShowError({message:r.Message});return})}},ValidatePromo:function(t){var f=n(t).val(),u,e;if(f===""){n("form.page-nav").submit();return}UIModals.ShowProcessing({showtitle:!1,message:content.CheckingPromoCodeMessage,animation:"progressbar"});u=n(t).data("saveifvalid");e={AjaxHandlerKey:i.AjaxHandlerKeys.PromoCodeAjaxHandlerKey,Action:"Validate",PromoCode:f,SaveIfValid:u,language:JSAPI.GetQueryStringValueByName("language")};n.post(r.AjaxPostUrl,e,function(i){UIModals.HideProcessing();var r=JSON.parse(i);r.Valid||(n(t).val(""),UIModals.ShowError({message:r.Message}),JSAPI.ToggleFormGroup("Promo2",!0));r.Valid&&u&&(UIModals.ShowProcessing({showtitle:!1,message:content.UpdatingItemsMessage,animation:"progressbar"}),location.reload(!0));r.Valid&&n("form.page-nav").submit()})},PostalCodeLookup:function(u){var f,e,o;if(!UIUtilities.NullOrEmpty(u.val())){e=n(u).attr("id");switch(e){case UIFormFields.BillingInfo.PostalCode:f=n("#"+UIFormFields.BillingInfo.Country);break;default:f=n("#"+UIFormFields.Registrant.Country)}o={AjaxHandlerKey:i.AjaxHandlerKeys.PostalCodeAjaxHandlerKey,CountryCode:f.val(),PostalCode:u.val(),language:JSAPI.GetQueryStringValueByName("language")};n.post(r.AjaxPostUrl,o,function(n){t.LogMessage("PostalCodeLookup post response:"+JSON.stringify(n));var i=JSON.parse(n);i.length>0&&t.SetPostalCodeLookupFields(e,i[0])})}},SetPostalCodeLookupFields:function(t,i){var f,u,r;switch(t){case UIFormFields.BillingInfo.PostalCode:f=n("#"+UIFormFields.BillingInfo.City);u=n("#"+UIFormFields.BillingInfo.StateProvince);r=n("#"+UIFormFields.BillingInfo.Country);break;default:f=n("#"+UIFormFields.Registrant.City);u=n("#"+UIFormFields.Registrant.StateProvince);r=n("#"+UIFormFields.Registrant.Country)}f.val(i.City);r.val()===""?(r.val(i.CountryCode),r.trigger("change"),setTimeout(function(){u.val(i.StateCode)},500)):u.val(i.StateCode)}};return{Init:t.Init,LogEnabled:r.LogEnabled,MakeAjaxCall:t.MakeAjaxCall,GetStepBody:t.GetStepBody,SetRegCategory:t.SetRegCategory,PayByInvoice:t.PayByInvoice,MemberSearch:t.MemberSearch,MemberLookup:t.MemberSearch,MemberSelect:t.MemberSelect,MemberLookupModal:t.MemberLookupModal,MemberLookupFillReg:t.MemberLookupFillReg,MemberLookupFillRegAndCategory:t.MemberLookupFillRegAndCategory,AddCartItem:t.AddCartItem,Settings:r}}(jQuery);$(document).ready(function(){UIBase.Init()})