var AVL=AVL||{};AVL.RESPONSIVEFORM=AVL.RESPONSIVEFORM||{};AVL.RESPONSIVEFORM.CORE={NewFormContent:!0,BypassPhoneCountryCode:typeof phoneOptional!="undefined"?phoneOptional:!1,UseSisyphus:typeof bypassLocalStorage=="undefined"||typeof bypassLocalStorage!="undefined"&&!bypassLocalStorage,INIT:{Init:function(){var n=$(".responsive-form");AVL.RESPONSIVEFORM.CORE.INIT.InitResponsiveForms(n);AVL.RESPONSIVEFORM.CORE.INIT.InitAutoFillCatches(n)},InitAutoFillCatches:function(n){setTimeout(function(){AVL.RESPONSIVEFORM.CORE.INIT.InitFormLabels(n)},100)},InitResponsiveForms:function(n){n!=="#address-container"&&AVL.RESPONSIVEFORM.CORE.INIT.InitSisyphus(n);AVL.RESPONSIVEFORM.CORE.INIT.InitFormWarningContainers(n);AVL.RESPONSIVEFORM.CORE.INIT.InitFormMasks(n);AVL.RESPONSIVEFORM.CORE.INIT.InitFormStatusIcons(n);AVL.RESPONSIVEFORM.CORE.INIT.InitFormInputs(n);AVL.RESPONSIVEFORM.CORE.INIT.InitFormInstantValidation(n);AVL.RESPONSIVEFORM.CORE.INIT.InitUSPhoneInputs(n);AVL.RESPONSIVEFORM.CORE.INIT.InitAddressInputs(n);AVL.RESPONSIVEFORM.CORE.INIT.InitAddressModal();AVL.RESPONSIVEFORM.CORE.INIT.InitFormLabels(n);AVL.RESPONSIVEFORM.CORE.INIT.InitFormButtons(n);AVL.RESPONSIVEFORM.CORE.INIT.InitAlertBoxIcons();$(".txt-state").find(".textbox").attr("maxlength","30")},InitSisyphus:function(n){AVL.RESPONSIVEFORM.CORE.UseSisyphus&&(n.is("fieldset")?n.sisyphus({excludeFields:$(".no-sisy, input[type='hidden'], .no-sisy input[type='radio'], .no-sisy input[type='checkbox']"),includeFields:$("input.has-sisy"),customKeySuffix:document.domain+window.location.pathname.replace(/\//g,"_")+"_"}):(n.find("fieldset").each(function(){$(this).sisyphus({excludeFields:$(".no-sisy, input[type='hidden'], .no-sisy input[type='radio'], .no-sisy input[type='checkbox']"),includeFields:$("input.has-sisy"),customKeySuffix:document.domain+window.location.pathname.replace(/\//g,"_")+"_"})}),AVL.RESPONSIVEFORM.CORE.UTILITIES.RemoveInputScriptTags(n)))},InitAddressInputs:function(n){var t=n.find(".dd-country .dropdown").length>0&&typeof n.find(".dd-country .dropdown option[selected='selected']").val()!="undefined"?n.find(".dd-country .dropdown option[selected='selected']").val().toLowerCase():"";AVL.RESPONSIVEFORM.CORE.UTILITIES.PrefixPhoneWithCountryCode(n,t,AVL.RESPONSIVEFORM.CORE.NewFormContent,AVL.RESPONSIVEFORM.CORE.BypassPhoneCountryCode);n.find(".dd-country .dropdown").on("change",function(){var n=$(".responsive-form .txt-phone input");n.length&&(n.val(n.val().replace(/["'()-]/g,"")),AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.ValidateInput(n));$("#update-action").text("country-updated")});n.find(".dd-opt-states .dropdown, .txt-opt-state .textbox").on("change",function(){$("#update-action").text("states-updated")});n.find(".txt-addressline1 .textbox").each(function(){var n=$(this).closest(".responsive-form");$(this).on("keydown",function(n){n.keyCode===$.ui.keyCode.TAB&&$(this).data("ui-autocomplete").menu.active&&n.preventDefault()}).autocomplete({position:{my:"left top",at:"left bottom-1","of":n.find(".txt-addressline1")},delay:0,source:function(t,i){var f=n.find(".txt-addressline1 .textbox"),r=$.trim(f.val()),e=n.find(".dd-country .dropdown").val(),u;r!==""&&r.length>1&&e==="US"&&(u={testing:!1,companyname:n.find(".txt-company .textbox").val(),addressline1:n.find(".txt-addressline1 .textbox").val(),addressline2:n.find(".txt-addressline2 .textbox").val(),city:n.find(".txt-city .textbox").val(),state:n.find(".dd-states .dropdown").val(),zipCode:n.find(".txt-zipcode .textbox").val(),country:n.find(".dd-country .dropdown").val()},$.ajax({url:"/MyAccount/CommonControls/ResponsiveForms/Handlers/UPSAddressValidationStreetLevel.ashx",type:"POST",data:JSON.stringify(u),contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){var t=n.AddressKeyFormats;if(t.length>0){var r=[],u=[],f=[];AVL.RESPONSIVEFORM.VALIDATION.ShowJSONAddressData&&console.log(t);$.each(t,function(n){r.push(AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[n].AddressLine1)+", "+AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[n].PoliticalDivision2)+" "+t[n].PoliticalDivision1+" "+AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[n].PostcodePrimaryLow))});$.each(r,function(n,i){$.inArray(i,u)===-1&&(u.push(i),f.push(t[n]))});i($.map(f,function(n){return{data:{addressline1:AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(n.AddressLine1),city:AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(n.PoliticalDivision2),state:n.PoliticalDivision1,zip:n.PostcodePrimaryLow},value:AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(n.AddressLine1),label:AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(n.AddressLine1)+", "+AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(n.PoliticalDivision2)+" "+n.PoliticalDivision1+" "+n.PostcodePrimaryLow}}))}}}))},minLength:2,select:function(t,i){var s,r;AVL.RESPONSIVEFORM.CORE.UTILITIES.ProcessInputChange(n.find(".txt-addressline1"),n.find(".txt-addressline1 .textbox"),i.item.data.addressline1,!0);AVL.RESPONSIVEFORM.CORE.UTILITIES.ProcessInputChange(n.find(".txt-zipcode"),n.find(".txt-zipcode .textbox"),i.item.data.zip,!0);AVL.RESPONSIVEFORM.CORE.UTILITIES.ProcessInputChange(n.find(".txt-city"),n.find(".txt-city .textbox"),i.item.data.city,!0);AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(n.find(".txt-addressline1"),n.find(".txt-addressline1 .textbox"),!1,!1);n.find(".dd-states .dropdown").trigger("focus").val(i.item.data.state).trigger("blur").trigger("update");var u=n.find(".txt-addressline1 .textbox").val(),h=n.find(".txt-addressline2 .textbox").val(),f=n.find(".txt-city .textbox").val(),e=n.find(".dd-states .dropdown").val(),o=n.find(".txt-zipcode .textbox").val();u!==""&&f!==""&&e!==""&&o!==""&&(s="<address><addressline1>"+u+"<\/addressline1><addressline2>"+h+"<\/addressline2><city>"+f+"<\/city><state>"+e+"<\/state><zip>"+o+"<\/zip><\/address>",r=!1,$.ajax({type:"POST",url:"/SiteUtilities/AddressVerification.aspx",contentType:"text/xml",dataType:"text",data:s,success:function(t){var u=$.parseXML(t),f=$(u),i=f.find("ismissingaptnumber");i!=null&&i!==""?(r=i.text().toLowerCase()==="true",r?(n.find(".txt-addressline2").attr("title","Please enter your Apt, Suite, Bldg. (required)."),n.find(".txt-addressline2 .textbox").trigger("focus"),n.find(".txt-addressline2 label em").text("(required)"),n.find(".txt-addressline2 input[type='text']").attr("data-validation","req-field")):(n.find(".txt-addressline2").attr("title","Please enter your Apt, Suite, Bldg. (if applicable)."),n.find(".txt-addressline2 label em").text("(if applicable)"),n.find(".txt-addressline2").removeClass("failed-validation"),n.find(".txt-addressline2 input[type='text']").attr("data-validation","opt-addressline2"),AVL.RESPONSIVEFORM.CORE.UTILITIES.FocusNextFocusableEmptyInput(n,n.find(".dd-states .dropdown")))):(n.find(".txt-addressline2 label em").text("(if applicable)"),AVL.RESPONSIVEFORM.CORE.UTILITIES.FocusNextFocusableEmptyInput(n,n.find(".dd-states .dropdown")))},fail:function(){n.find(".txt-addressline2 label em").text("(if applicable)");n.find(".txt-addressline2 .textbox").trigger("focus")}}))},open:function(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top")},close:function(){$(this).removeClass("ui-corner-top").addClass("ui-corner-all");n.find(".txt-addressline1 .textbox").trigger("change")}})})},InitUSPhoneInputs:function(){if($("input[data-validation='req-phone-us']").length>0){AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.FormatUSPhoneNumber($("input[data-validation='req-phone-us']"),$("input[data-validation='req-phone-us']").val(),!0);$("input[data-validation='req-phone-us']").on("change",function(){var n=$(this);AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.FormatUSPhoneNumber(n,n.val(),!0)})}if($("input[data-validation='opt-phone-us']").length>0){AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.FormatUSPhoneNumber($("input[data-validation='opt-phone-us']"),$("input[data-validation='opt-phone-us']").val(),!0);$("input[data-validation='opt-phone-us']").on("change",function(){var n=$(this);AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.FormatUSPhoneNumber(n,n.val(),!0)})}},InitAddressModal:function(){$("body").on("click","#ar-change",function(){var n="#"+$(this).attr("data-addressline1"),t=$(n).closest(".responsive-form");t.find(".txt-addressline1 .textbox").trigger("focus");$(this).attr("data-showDeliveryModal")==="true";MODAL.DOM.CloseModal("#address-results")});$("body").on("click","#ar-certify",function(){var n="#"+$(this).attr("data-addressline1"),t=$(n).closest(".responsive-form");$("#address-results").find("#addressCertified").val("true");AVL.RESPONSIVEFORM.VALIDATION.AddressCertified=!0;t.find(".txt-addressline1 .textbox").trigger("change");MODAL.DOM.CloseModal("#address-results")});$("body").on("click",".ar-choice",function(){var r="#"+$(this).attr("data-addressline1"),n=$(r).closest(".responsive-form"),t=$("#address-results").data("addresses"),i=$(this).prop("rel");t!=null&&t.length>0&&(AVL.RESPONSIVEFORM.CORE.UTILITIES.ProcessInputChange(n.find(".txt-addressline1"),n.find(".txt-addressline1 .textbox"),AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[i].AddressLine1),!0),AVL.RESPONSIVEFORM.CORE.UTILITIES.ProcessInputChange(n.find(".txt-addressline2"),n.find(".txt-addressline2 .textbox"),AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[i].AddressLine2),!0),AVL.RESPONSIVEFORM.CORE.UTILITIES.ProcessInputChange(n.find(".txt-city"),n.find(".txt-city .textbox"),AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[i].PoliticalDivision2),!0),AVL.RESPONSIVEFORM.CORE.UTILITIES.ProcessInputChange(n.find(".dd-states"),n.find(".dd-states .dropdown"),t[i].PoliticalDivision1,!0),AVL.RESPONSIVEFORM.CORE.UTILITIES.ProcessInputChange(n.find(".txt-zipcode"),n.find(".txt-zipcode .textbox"),t[i].PostcodePrimaryLow,!0),AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(n.find(".txt-addressline1"),n.find(".txt-addressline1 .textbox"),!1,!1));MODAL.DOM.CloseModal("#address-results")})},InitAlertBoxIcons:function(){$(".success-message").each(function(){AVL.RESPONSIVEFORM.CORE.DOM.AddAlertBoxIcon($(this),"icon-ok")})},InitFormWarningContainers:function(n){var t=n.is("fieldset")?n:n.find("fieldset");t.each(function(){var n=$(this),t="<div class='warning-messages'><\/div>";n.find("div.warning-messages").length||(n.find("legend").length===0?n.find("ul:first").before(t):n.find("legend").after(t))});$(".responsive-form").on("click",".bypass-field-link",function(){var t="bypassed-"+$(this).attr("data-element-id"),n=$("#"+$(this).attr("data-element-id"));return n.parent().attr("id")==="pAddressLine2"&&n.attr("data-validation","opt-addressline2"),$("#"+t).length===0&&$("body").append("<div id='"+t+"'><\/div>"),AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.ValidateInput(n),!1})},InitFormMasks:function(n){var t=n.find("ul li p, ul li div");t.on("click",function(){$(this).hasClass("focused")||$(this).find(".textbox, .textarea, .dropdown").trigger("focus")})},InitFormInputs:function(n){var t=n.find("ul li p"),i=t.find("select");i.customSelect();t.find(".textbox, .dropdown, .textarea").not(":disabled").on("focus",function(){if(!$(this).closest("p").hasClass("focused")){var n=$(this),i=n.closest("p"),t=i.find("label");$(".focused").removeClass("focused");i.addClass("focused");n.val()!=null&&n.val().length>0&&(t.hasClass("inputted")?t.addClass("inputting-notrans"):t.addClass("inputting"));localStorage.focus=n.not(".no-focus").attr("id")}}).on("blur",function(){var t=$(this),i=t.closest("p"),r=i.find("label");i.hasClass("focused")&&(i.removeClass("focused"),AVL.RESPONSIVEFORM.CORE.INIT.InitFormLabels(n));t.val()!=null&&t.val().length===0||t.val()==null?r.removeClass("inputting inputted inputting-notrans"):r.removeClass("inputting inputting-notrans").addClass("inputted")});t.find(".textarea").not(":disabled").on("focus",function(){$(this).closest("li").find("label.outter-label").addClass("focused")}).on("blur",function(){$(this).closest("li").find("label.outter-label").removeClass("focused")});t.find(".textbox, .textarea").on("keydown",function(){var n=$(this).parent().find("label");n.hasClass("inputting-notrans")||n.addClass("inputting")}).on("keyup",function(){var i=$(this),t=$(this).parent().find("label");i.val().length===0?t.removeClass("inputted inputting inputting-notrans"):t.hasClass("inputting-notrans")||t.addClass("inputting");AVL.RESPONSIVEFORM.CORE.INIT.InitFormLabels(n)});t.find("select").not(".no-reset").each(function(){var n=$(this),t=n.parent().find("label"),i=n.parent().find(".dropdown option:selected").index();(i===-1||n.val()==="")&&t.removeClass("inputted")}).on("change",function(){var n=$(this),t=$(this).parent().find("label");n.val()!=null&&n.val().length===0?t.removeClass("inputted inputting inputting-notrans"):t.addClass("inputted")});t.find("select.dropdown").on("keypress",function(n){n.which===13&&n.stopPropagation()});n.hasClass("skip-focus")||AVL.UTILITIES.FUNCTIONS.IsMobile()&&n.hasClass("skip-focus-mobile")||AVL.RESPONSIVEFORM.CORE.UTILITIES.SetFocusToCorrectInput(n)},InitFormStatusIcons:function(n){var t=n.find("ul li");t.find(".textbox, .textarea, .dropdown").each(function(){var n=$(this).closest("p"),t=n.prop("title");n.find("i.input-warning").length||n.append("<i class='input-status input-warning icon-attention' title='"+t+"' onclick='return AVL.RESPONSIVEFORM.CORE.DOM.ShowValidationMessage(event, $(this));'><\/i>")});t.find(".radiobutton, .checkbox").each(function(){var n=$(this).closest(".radio-mask, .checkbox-mask"),t=n.prop("title");!n.find("i.input-warning").length&&n.find("label").length&&n.append("<i class='input-status input-warning icon-attention' title='"+t+"' onclick='return AVL.RESPONSIVEFORM.CORE.DOM.ShowValidationMessage(event, $(this));'><\/i>")});t.find("[data-loader='true']").each(function(){var n=$(this).closest("p");n.append("<img class='input-loading' src='/CommonControls/ResponsiveForms/IMG/async-loader-1.gif' alt='Loading' />")})},InitFormLabels:function(n){var t=n.find("ul li p, ul li div");t.find(".textbox, .textarea").each(function(){var n=$(this),t=n.parent().find("label");n.val().length===0?t.removeClass("inputting inputted"):t.addClass("inputted")});t.find("select").each(function(){var n=$(this),t=n.parent().find("label"),i=n.prop("selectedIndex");i===-1||n.val()===""?t.removeClass("inputting inputted"):t.addClass("inputted")})},InitFormInstantValidation:function(n){var t=n.find("ul li p, ul li div");t.find("input.textbox, textarea.textarea, select.dropdown, input.checkbox, input.radiobutton, .radiobutton input, .checkbox input").on("change",function(){var n=$(this);AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.ValidateInput(n)});n.find("input.radiobutton, .radiobutton input").on("click",function(){var n=$(this).closest(".radiobutton");AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.ValidateInput(n)})},InitFormButtons:function(n){n.find(".button-container .clear-button").on("click",function(){return AVL.RESPONSIVEFORM.CORE.UTILITIES.ClearLocalStorage(n),$(":input",n).each(function(){if(!($(this).hasClass("no-reset")||$(this).parent().hasClass("no-reset"))){var n=this.type,t=this.tagName.toLowerCase();n==="text"||n==="password"||t==="textarea"?this.value="":n==="checkbox"||n==="radio"?this.checked=!1:t==="select"&&(this.selectedIndex=0,$(this).trigger("update"))}}),AVL.RESPONSIVEFORM.CORE.INIT.InitFormLabels(n),!1})}},DOM:{AddAlertBoxIcon:function(n,t){var i=n.find("i."+t).length>0,r="<i class='"+t+"'><\/i>";i||n.prepend(r)},ShowValidationMessage:function(n,t){if(n.preventDefault?n.preventDefault():n.returnValue=!1,n.stopPropagation?n.stopPropagation():null,$("#responsive-form-message").length===0){var i="<div id='responsive-form-message' class='modal-container'><div class='modal-wrapper'><div class='modal-content'><p class='warning-message'><\/p><\/div><\/div><\/div>";$("form").length===1?$("form").append(i):$("body").append(i)}return $(".error-override").is(":visible")?$("#responsive-form-message").find(".modal-content p.warning-message").text($(".error-override").text()):$("#responsive-form-message").find(".modal-content p.warning-message").text(t.attr("title")),MODAL.DOM.OpenModal({modalElementId:"#responsive-form-message",width:300}),setTimeout(function(){$(":focus").trigger("blur")}),!1},SetCountryRelatedInputStates:function(n,t,i){i?n.find(".dropdown").trigger("change"):(n.find(".phone-format").text(""),t.toLowerCase()==="us"&&(n.find(".txt-phone").find("[data-validation^='req-phone']").each(function(){var n=$(this);n.attr("title","Please enter your phone number with area code.");n.val()!==""&&AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.FormatUSPhoneNumber(n,n.val(),!0)}),n.find(".phone-format").text("(xxx) xxx-xxxx")))}},UTILITIES:{RemoveInputScriptTags:function(n){$(n.find("fieldset input[type='text']")).each(function(){$(this).val($(this).val().replace(/<|>/g,""))})},CapitalizeFirstLetter:function(n){for(var r=n.toLowerCase(),t=r.split(" "),i=0,u=t.length;i<u;i++)t[i]=t[i].charAt(0).toUpperCase()+t[i].slice(1);return t.join(" ")},FocusNextFocusableEmptyInput:function(n,t){var i=n.find(":focusable"),u=i.filter(function(){return $(this).val()===""}),r=!1;u.each(function(){!r&&i.index($(this))>i.index(t)&&($(this).trigger("focus"),r=!0)})},SetFocusToCorrectInput:function(n){var t,i=!1;localStorage.focus!=null&&localStorage.focus.length>0?(t=$("#"+localStorage.focus),i&&console.log("focus to: localStorage")):n.find(".focus").length>0?(t=n.find(".focus"),i&&console.log("focus to: .focus")):$(".modal-container").is(":visible")?(t=$(".modal-container:visible").find("fieldset ul li p:first").find(".textbox, .textarea, .dropdown"),i&&console.log("focus to: visible modal")):(t=n.find(".responsive-form fieldset ul li p").first().find(".textbox, .textarea, .dropdown").not(".no-focus"),i&&console.log("focus to: first input"));setTimeout(function(){t.trigger("focus").val(t.val())},10)},ProcessInputChange:function(n,t,i,r){var f=t.val(),u=i;t.val(u);r&&f!==u&&t.trigger("change");u===""?n.find("label").removeClass("inputted"):n.find("label").addClass("inputted")},VerifyAddress:function(n,t,i,r,u){var e="<address><addressline1>"+$("[id$='"+n+"']").val()+"<\/addressline1><addressline2>"+$("[id$='"+t+"']").val()+"<\/addressline2><city>"+$("[id$='"+i+"']").val()+"<\/city><state>"+$("[id$='"+r+"']").val()+"<\/state><zip>"+$("[id$='"+u+"']").val()+"<\/zip><\/address>",f=$("[id$='"+n+"']").closest(".responsive-form");$.ajax({type:"POST",url:"/SiteUtilities/AddressVerification.aspx",contentType:"text/xml",dataType:"text",data:e,success:function(n){var i=$.parseXML(n),r=$(i),t=r.find("ismissingaptnumber");t!=null&&t!==""&&t.text().toLowerCase()==="true"&&(f.find(".txt-addressline2 label em").text("(required)"),f.find(".txt-addressline2 input[type='text']").attr("data-validation","req-field"))}})},PrefixPhoneWithCountryCode:function(n,t,i,r){if(t!==""&&!r){var u="";$.ajax({type:"GET",url:"/MyAccount/CommonControls/ResponsiveForms/XML/country-codes.xml",dataType:"xml",success:function(r){$(r).find("country").each(function(){var e=$(this).attr("code"),f,r;return u=$(this).attr("phoneCode"),t.toUpperCase()===e?(r=n.find(".txt-phone .textbox").val(),f=u==="1"||r!==""?r:"+"+u,i||AVL.RESPONSIVEFORM.CORE.UTILITIES.ProcessInputChange(n.find(".txt-phone"),n.find(".txt-phone .textbox"),f,!1),!1):void 0})}})}AVL.RESPONSIVEFORM.CORE.NewFormContent=!1;AVL.RESPONSIVEFORM.CORE.BypassPhoneCountryCode=typeof phoneOptional!="undefined"?phoneOptional:!1},ReleaseLocalStorage:function(n){AVL.RESPONSIVEFORM.CORE.UseSisyphus&&(n.is("fieldset")?n.sisyphus().manuallyReleaseData():n.find("fieldset").each(function(){$(this).sisyphus().manuallyReleaseData()}))},ClearLocalStorage:function(n){AVL.RESPONSIVEFORM.CORE.UseSisyphus&&n.find("fieldset").each(function(){$(this).sisyphus().manuallyReleaseData()});localStorage.removeItem("focus");AVL.RESPONSIVEFORM.CORE.UTILITIES.SetFocusToCorrectInput(n);AVL.RESPONSIVEFORM.VALIDATION.DOM.HideAllValidationResults(n)}}};$(document).ready(function(){AVL.RESPONSIVEFORM.CORE.INIT.Init()}),function(n){n.fn.sisyphus=function(t){var r=n.map(this,function(t){return n(t).attr("id")+n(t).attr("name")}).join(),i=Sisyphus.getInstance(r);return t!==undefined&&i.protect(this,t),i};var t={};t.isAvailable=function(){if(typeof n.jStorage=="object")return!0;try{return localStorage.getItem}catch(t){return!1}};t.set=function(t,i){if(typeof n.jStorage=="object")n.jStorage.set(t,i+"");else try{localStorage.setItem(t,i+"")}catch(r){}};t.get=function(t){if(typeof n.jStorage=="object"){var i=n.jStorage.get(t);return i?i.toString():i}return localStorage.getItem(t)};t.remove=function(t){typeof n.jStorage=="object"?n.jStorage.deleteKey(t):localStorage.removeItem(t)};Sisyphus=function(){function r(){return{setInstanceIdentifier:function(n){this.identifier=n},getInstanceIdentifier:function(){return this.identifier},setInitialOptions:function(i){var r={excludeFields:[],includeFields:[],customKeySuffix:"",locationBased:!1,timeout:0,autoRelease:!0,onSave:function(){},onBeforeRestore:function(){},onRestore:function(){},onRelease:function(){}};this.options=this.options||n.extend(r,i);this.browserStorage=t},setOptions:function(t){this.options=this.options||this.setInitialOptions(t);this.options=n.extend(this.options,t)},protect:function(t,r){var u,f,e;if(this.setOptions(r),t=t||{},u=this,this.targets=this.targets||[],this.href=location.hostname+location.pathname+location.search+location.hash,this.targets=n.merge(this.targets,t),this.targets=n.unique(this.targets),this.targets=n(this.targets),!this.browserStorage.isAvailable())return!1;f=u.options.onBeforeRestore.call(u);(f===undefined||f)&&u.restoreAllData();this.options.autoRelease&&u.bindReleaseData();i.started[this.getInstanceIdentifier()]||(u.isCKEditorPresent()?e=setInterval(function(){CKEDITOR.isLoaded&&(clearInterval(e),u.bindSaveData(),i.started[u.getInstanceIdentifier()]=!0)},100):(u.bindSaveData(),i.started[u.getInstanceIdentifier()]=!0))},isCKEditorPresent:function(){if(this.isCKEditorExists()){CKEDITOR.isLoaded=!1;CKEDITOR.on("instanceReady",function(){CKEDITOR.isLoaded=!0});return!0}return!1},isCKEditorExists:function(){return typeof CKEDITOR!="undefined"},findFieldsToProtect:function(n){return n.find(":input").not(":submit").not(":reset").not(":button").not(":file").not(":password").not(":disabled").not("[readonly]")},bindSaveData:function(){var t=this;t.options.timeout&&t.saveDataByTimeout();t.targets.each(function(){var i=n(this).attr("id")+n(this).attr("name");t.findFieldsToProtect(n(this)).each(function(){if(n.inArray(this,t.options.excludeFields)!==-1&&n.inArray(this,t.options.includeFields)===-1)return!0;var i=n(this),r=t.options.customKeySuffix+i.attr("name");(i.is(":text")||i.is("textarea"))&&(t.options.timeout||t.bindSaveDataImmediately(i,r));t.bindSaveDataOnChange(i)})})},saveAllData:function(){var t=this;t.targets.each(function(){var r=n(this).attr("id")+n(this).attr("name"),i={};t.findFieldsToProtect(n(this)).each(function(){var r=n(this),f,u,e;if(n.inArray(this,t.options.excludeFields)!==-1&&n.inArray(this,t.options.includeFields)===-1||r.attr("name")===undefined)return!0;if(f=t.options.customKeySuffix+r.attr("name"),u=r.val(),r.is(":checkbox")){if(r.attr("name").indexOf("[")!==-1){if(i[r.attr("name")]===!0)return;u=[];n("[name='"+r.attr("name")+"']:checked").each(function(){u.push(n(this).val())});i[r.attr("name")]=!0}else u=r.is(":checked");t.saveToBrowserStorage(f,u,!1)}else r.is(":radio")?r.is(":checked")&&(u=r.val(),t.saveToBrowserStorage(f,u,!1)):t.isCKEditorExists()?(e=CKEDITOR.instances[r.attr("name")]||CKEDITOR.instances[r.attr("id")])?(e.updateElement(),t.saveToBrowserStorage(f,r.val(),!1)):t.saveToBrowserStorage(f,u,!1):t.saveToBrowserStorage(f,u,!1)})});t.options.onSave.call(t)},restoreAllData:function(){var t=this,i=!1;t.targets.each(function(){var r=n(this),u=n(this).attr("id")+n(this).attr("name");t.findFieldsToProtect(r).each(function(){if(n.inArray(this,t.options.excludeFields)!==-1&&n.inArray(this,t.options.includeFields)===-1)return!0;var r=n(this),f=t.options.customKeySuffix+r.attr("name"),u=t.browserStorage.get(f);u!==null&&(t.restoreFieldsData(r,u),i=!0)})});i&&t.options.onRestore.call(t)},restoreFieldsData:function(n,t){if(n.attr("name")===undefined)return!1;n.is(":checkbox")&&t!=="false"&&n.attr("name").indexOf("[")===-1?n.prop("checked",!0):n.is(":checkbox")&&t==="false"&&n.attr("name").indexOf("[")===-1?n.prop("checked",!1):n.is(":radio")?n.val()===t&&n.prop("checked",!0):n.attr("name").indexOf("[")===-1?(n.val()===""||n.attr("data-override-server")==="true")&&n.val(t):(t=t.split(","),n.val(t))},bindSaveDataImmediately:function(n,t){var i=this,r;if("onpropertychange"in n?n.get(0).onpropertychange=function(){i.saveToBrowserStorage(t,n.val())}:n.get(0).oninput=function(){i.saveToBrowserStorage(t,n.val())},this.isCKEditorExists()&&(r=CKEDITOR.instances[n.attr("name")]||CKEDITOR.instances[n.attr("id")]))r.document.on("keyup",function(){r.updateElement();i.saveToBrowserStorage(t,n.val())})},saveToBrowserStorage:function(n,t,i){i=i===undefined?!0:i;this.browserStorage.set(n,t);i&&t!==""&&this.options.onSave.call(this)},bindSaveDataOnChange:function(n){var t=this;n.on("change",function(){})},saveDataByTimeout:function(){var n=this,t=n.targets;setTimeout(function(){function t(){n.saveAllData();setTimeout(t,n.options.timeout*1e3)}return t}(t),n.options.timeout*1e3)},bindReleaseData:function(){var t=this;t.targets.each(function(){var i=n(this),r=i.attr("id")+i.attr("name");n(this).on("submit reset",function(){t.releaseData(r,t.findFieldsToProtect(i))})})},manuallyReleaseData:function(){var t=this;!t.targets||t.targets.each(function(){var i=n(this),r=i.attr("id")+i.attr("name");t.releaseData(r,t.findFieldsToProtect(i))})},releaseData:function(t,r){var f=!1,u=this;i.started[u.getInstanceIdentifier()]=!1;r.each(function(){if(n.inArray(this,u.options.excludeFields)!==-1&&n.inArray(this,u.options.includeFields)===-1)return!0;var t=n(this),i=u.options.customKeySuffix+t.attr("name");u.browserStorage.remove(i);f=!0});f&&u.options.onRelease.call(u)}}}var i={instantiated:[],started:[]};return{getInstance:function(n){return i.instantiated[n]||(i.instantiated[n]=r(),i.instantiated[n].setInstanceIdentifier(n),i.instantiated[n].setInitialOptions()),n,i.instantiated[n]},free:function(){return i={instantiated:[],started:[]},null},version:"1.1.107"}}()}(jQuery);;window.console||(console={log:function(){}});var AVL=AVL||{};AVL.RESPONSIVEFORM=AVL.RESPONSIVEFORM||{};AVL.RESPONSIVEFORM.VALIDATION={InstantValidationDebug:!1,SubmitValidationDebug:!1,ShowJSONAddressData:!1,AddressCertified:!1,HasInvalidTextWarning:!1,IsZipCodeValid:!0,IsZipCodeError:!1,JsonCertifiedAddress:{addressline1:"",city:"",state:"",zipCode:"",country:""},DOM:{BuildAddressResultsModal:function(n,t,i,r){var f,u;$("#address-results").remove();$("form").append("<div id='address-results' class='modal-container'><div class='modal-wrapper'><div class='modal-header'><\/div><div class='modal-content'><\/div><\/div><input type='hidden' name='addressCertified' id='addressCertified' value='false'/><\/div>");switch(t){case"none":u="We were unable to verify your address. Please choose one of the following options below to proceed:";$("#address-results").find(".modal-header").text("Address Not Found");$("#address-results").find(".modal-content").html("<h6>"+u+"<\/h6><p><a id='ar-change' data-addressline1='"+n+"' href='javascript:void(0)' title='Change the address'>Change the address<\/a><\/p><p><a id='ar-certify' data-addressline1='"+n+"' href='javascript:void(0)' title='Certify that the address you entered is the correct address'>Certify that the address is correct ( <em> "+i+" <\/em> )<\/a><\/p>");break;case"multiple":f="";u="We were unable to verify your address. Please choose one of the following options below to proceed:";$.each(r,function(t){f+="<p><a class='ar-choice' data-addressline1='"+n+"' href='javascript:void(0)' rel='"+t+"' title='Use this address'>"+r[t].fullAddress+"<\/a><\/p>"});$("#address-results").find(".modal-header").text("Choose Correct Address");$("#address-results").find(".modal-content").html("<h6>"+u+"<\/h6>"+f+"<p><a id='ar-change' data-addressline1='"+n+"' href='javascript:void(0)' title='Change the address'>Change the address<\/a><\/p><p><a id='ar-certify' data-addressline1='"+n+"' href='javascript:void(0)' title='Certify that the address you entered is the correct address'>Certify the address is correct - <em> "+i+" <\/em><\/a><\/p>");$("#address-results").data("addresses",r)}MODAL.DOM.OpenModal({modalElementId:"#address-results",width:650})},ShowLoadingImage:function(n,t,i){i.show();n.removeClass("failed-validation")},MoveToFirstFailedInput:function(){$(".failed-validation").length>0&&$(".failed-validation:first").closest("fieldset").length>0&&($("#slideout-content").animate({scrollTop:$("#slideout-content").scrollTop()+$(".failed-validation:first").closest("fieldset").offset().top-10},500)||$("html, body").animate({scrollTop:$(".failed-validation:first").closest("fieldset").offset().top-10},500),$(".failed-validation:first input:not(.hasDatepicker), .failed-validation:first textarea, .failed-validation:first select").trigger("focus"))},HideAllValidationResults:function(n){var t=n.find("ul li p, ul li div");t.each(function(){var n=$(this);AVL.RESPONSIVEFORM.VALIDATION.DOM.SetValidationClass(n,!1);AVL.RESPONSIVEFORM.VALIDATION.DOM.SetValidationMessage(n,n.find("input.textbox:visible, textarea.textarea:visible, select.dropdown:visible, input.checkbox:visible, input.radiobutton:visible"),!1,!1)})},DisplayValidationResult:function(n,t,i,r){t.val()===""?n.find("label").removeClass("inputted"):n.find("label").addClass("inputted");AVL.RESPONSIVEFORM.VALIDATION.DOM.SetValidationClass(n,i);AVL.RESPONSIVEFORM.VALIDATION.DOM.SetValidationMessage(n,t,i,r)},SetValidationClass:function(n,t){t?n.addClass("failed-validation"):n.removeClass("failed-validation")},SetValidationMessage:function(n,t,i,r){var o,e,h;typeof t.attr("id")!=typeof undefined?(e=t.attr("id").split("_"),o=e[e.length-2]+"_"+e[e.length-1]+"_warning"):o=t.attr("id")+"_warning";var u=n.attr("data-warning-override"),f="",s=$('[id$="'+o+'"]');f=t.attr("data-validation")==="opt-addressline2"?AVL.RESPONSIVEFORM.VALIDATION.HasInvalidTextWarning?"Please provide valid apartment,suite or building number":typeof u!="undefined"&&u!==!1?u:n.attr("title")||!1:typeof u!="undefined"&&u!==!1?u:n.attr("title")||!1;n.find(".input-warning").attr("title",f);i&&f?(h="",t.attr("data-validation")!=="opt-addressline2"&&t.parent().attr("id")!=="pAddressLine2"||AVL.RESPONSIVEFORM.VALIDATION.HasInvalidTextWarning||(h=" <a href='#bypass-field' class='bypass-field-link' data-element-id='"+t.attr("id")+"'>Click here if the value is correct.<\/a>"),f+=h,s.length===0&&(r||AVL.RESPONSIVEFORM.VALIDATION.HasInvalidTextWarning&&t.attr("data-validation")==="opt-addressline2")?n.closest("fieldset").find(".warning-messages:first").append("<div id='"+o+"'>"+f+"<\/div>"):s.length>0&&s.html(f)):s.slideUp(200,function(){$(this).remove()})},SetIconWarningMessage:function(n){var t=n.prop("title");n.find("i.input-warning").length?$(n.find("i.input-warning")).attr("title",t):$parent.append("<i class='input-status input-warning icon-attention' title='"+t+"' onclick='return ShowValidationMessage(event, $(this));'><\/i>")}},FUNCTIONS:{CheckInputValue:function(n,t,i,r,u,f){var e=t.closest(".responsive-form"),gt,k,ht,ti,ct,ii,d,h,at,g,oi,si,w,p,nt,pt,hi,ci,i,li,ai,wt,rt,bt,vi,yi,n,ut,o,wi,ft,et;switch(r){case"req-field":t.is(":password")||(i=i.replace(/<|>/g,""),t.val(i));u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"req-selection":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNoSelection(i));break;case"req-checked":u.resolve(!t.is(":checked"));break;case"req-checked-list":u.resolve(!t.find("input:checked").length);break;case"req-price":t.hasClass("format-price")&&(i=i.replace(/[^.0-9]/g,""),t.val("$"+parseFloat(i).toFixed(2)));u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsPrice(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotZero(i));break;case"req-price-min":var bi=i.replace(/[^.0-9]/g,""),v=parseFloat(bi),ki=t.attr("data-minprice");AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNumber(v)&&t.val("$"+v);u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(v)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNumber(v)||v<ki);break;case"req-price-range":gt="$";t.hasClass("format-price")&&(i=i.replace(/[^.0-9]/g,""),t.val("$"+parseFloat(i).toFixed(2)));case"req-number-range":var di=AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNumber(i),gi=t.closest(":has(.req-price-top)").find(".req-price-top").text().replace(/[^.0-9]/g,""),ot=parseFloat(gi),nr=t.closest(":has(.req-price-bottom)").find(".req-price-bottom").text().replace(/[^.0-9]/g,""),st=parseFloat(nr),v=parseFloat(i),ni=gt||"",l=!1;i!=="N/A"&&(!di||i<=0)?(l=!0,n.attr("data-warning-override","Please enter a valid amount.")):!isNaN(ot)&&ot<v?(l=!0,n.attr("data-warning-override","Please enter an amount less than or equal to "+ni+ot+".")):!isNaN(st)&&st>v&&(l=!0,n.attr("data-warning-override","Please enter an amount more than "+ni+st+"."));u.resolve(l);break;case"req-customwidth-range":u.resolve(AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.ValidateRange(n,i,0,299,2,"custom trim width"));break;case"req-customheight-range":u.resolve(AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.ValidateRange(n,i,0,299,2,"custom trim height"));break;case"req-spinewidth-range":u.resolve(AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.ValidateRange(n,i,.25,2,3,"spine width"));break;case"req-minmax-range":var tr=t.attr("data-range")==="min",ir=t.attr("data-range")==="max",rr=$("select[data-range='min']").val(),ur=$("select[data-range='max']").val();i===""?(l=!0,n.attr("data-warning-override","Please select a value.")):tr&&parseInt(i)>parseInt(ur)?(l=!0,n.attr("data-warning-override",t.attr("data-warning-override"))):ir&&parseInt(i)<parseInt(rr)&&(l=!0,n.attr("data-warning-override",t.attr("data-warning-override")));u.resolve(l);break;case"req-number":AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)?n.attr("data-warning-override",n.attr("title")+" (Must be a valid number)"):n.removeAttr("data-warning-override");k=t.attr("minLength");k!==null&&t.val().length<k&&(n.attr("data-warning-override",n.attr("title")+" (Must be a "+k+"-digit number)"),u.resolve(!0));t.hasClass("req-route")&&(ht=i,ht!==""&&$.ajax({type:"POST",url:"/MyAccount/PaymentInformation.aspx/ValidateBankRoutingNumber","async":!1,data:"{'routingNumber':'"+ht+"'}",contentType:"application/json; charset=utf-8",dataType:"json",beforeSend:function(n){n.setRequestHeader("content-type","application/json; charset=utf-8")},success:function(t){var i=t.d;i==="Not Found"&&(n.attr("data-warning-override","Invalid routing number."),u.resolve(!0))}}));u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsWholeNumber(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNumber(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotZero(i));break;case"req-three":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsWholeNumber(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNumber(i)||parseInt(i)<0||parseInt(i)>3);break;case"opt-number":u.resolve(AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)&&(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsWholeNumber(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNumber(i)));break;case"req-upc":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsWholeNumber(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNumber(i)||i.length!==11&&i.length!==12);break;case"opt-isbn":i===""&&u.resolve(!1);case"req-isbn":case"req-isbn-design":i=i.replace("-","");u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsWholeNumber(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNumber(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsISBN(i));r==="req-isbn-design"&&n.attr("data-warning-override","Please enter a valid 13 digit ISBN code.");break;case"opt-phone":AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.FormatUSPhoneNumber(t,i,!1);u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsPhoneNumber(i)&&!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsInternationalPhoneNumber(i)&&AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"req-phone-us":AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.FormatUSPhoneNumber(t,i,!0);u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsUSPhoneNumber(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"opt-phone-us":AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.FormatUSPhoneNumber(t,i,!1);u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsUSPhoneNumber(i)&&AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"req-phone-bycountry":AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.FormatUSPhoneNumber(t,i,!1);u.resolve(AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsPhoneNumberByCountry(i,AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.GetCountryCode(t))||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"opt-phone-bycountry":AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.FormatUSPhoneNumber(t,i,!1);u.resolve(AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsPhoneNumberByCountry(i,AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.GetCountryCode(t))&&AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"req-addressline1":case"opt-addressline1":ti={addressline1:e.find(".txt-addressline1 .textbox").val(),city:e.find(".txt-city .textbox").val(),state:e.find(".dd-states .dropdown").val(),zipCode:e.find(".txt-zipcode .textbox").val(),country:e.find(".dd-country .dropdown").val()};r!=="opt-addressline1"||AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)?AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)?AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.CheckCertifiedAddressMatch(ti)?u.resolve(!1):(d=e.find(".dd-country .dropdown").val(),d==="US"&&AVL.RESPONSIVEFORM.VALIDATION.IsZipCodeValid&&f?(h={testing:!1,companyname:e.find(".txt-company .textbox").val(),addressline1:e.find(".txt-addressline1 .textbox").val(),addressline2:e.find(".txt-addressline2 .textbox").val(),city:e.find(".txt-city .textbox").val(),state:e.find(".dd-states .dropdown").val(),zipCode:e.find(".txt-zipcode .textbox").val(),country:e.find(".dd-country .dropdown").val()},ct=e.find(".txt-addressline1 .textbox").val()+" "+e.find(".txt-addressline2 .textbox").val()+" "+e.find(".txt-city .textbox").val()+" "+e.find(".dd-states .dropdown").val()+" "+e.find(".txt-zipcode .textbox").val(),AVL.RESPONSIVEFORM.VALIDATION.ShowJSONAddressData&&console.log(h),$.ajax({url:"/MyAccount/CommonControls/ResponsiveForms/Handlers/UPSAddressValidationStreetLevel.ashx",type:"POST",data:JSON.stringify(h),contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){var s,t,i,r,f;if(n!=undefined&&n.Response!=undefined)if(s=n.Response,t=n.AddressKeyFormats,AVL.RESPONSIVEFORM.VALIDATION.ShowJSONAddressData&&console.log(n),s.ResponseStatusDescription==="Failure")u.resolve(!1);else if(i=typeof APPLICATION!="undefined"&&typeof APPLICATION.CHECKOUTPROCESS!="undefined"&&typeof APPLICATION.CHECKOUTPROCESS.CORE.BypassModal!="undefined"&&APPLICATION.CHECKOUTPROCESS.CORE.BypassModal,t.length===0)i||$.trim(h.addressline1)===""||$.trim(h.city)===""||$.trim(h.state)===""||$.trim(h.zipCode)===""||AVL.RESPONSIVEFORM.VALIDATION.DOM.BuildAddressResultsModal(e.find(".txt-addressline1 .textbox").attr("id"),"none",ct),u.resolve(!0);else if(t.length!==1||/\d-\d/.test(t[0].AddressLine1)){var o=[],c=[],l=[];$.each(t,function(n){o.push(AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[n].AddressLine1)+", "+AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[n].PoliticalDivision2)+" "+t[n].PoliticalDivision1+" "+AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[n].PostcodePrimaryLow))});$.each(o,function(n,i){$.inArray(i,c)===-1&&(c.push(i),t[n].fullAddress=o[n],l.push(t[n]))});i||AVL.RESPONSIVEFORM.VALIDATION.DOM.BuildAddressResultsModal(e.find(".txt-addressline1 .textbox").attr("id"),"multiple",ct,l);u.resolve(!0)}else e.find(".txt-addressline1 .textbox").val(AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[0].AddressLine1)).trigger("change"),t[0].AddressLine2!==""&&e.find(".txt-addressline2 .textbox").val(AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[0].AddressLine2)).trigger("change"),e.find(".txt-city .textbox").val(AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[0].PoliticalDivision2)).trigger("change"),r=e.find(".dd-states .dropdown"),f=t[0].PoliticalDivision1,r.val()!==f&&r.val(f).trigger("change"),AVL.RESPONSIVEFORM.VALIDATION.IsZipCodeError||e.find(".txt-zipcode .textbox").val(t[0].PostcodePrimaryLow),e.find(".txt-zipcode label").addClass("inputted"),e.find(".txt-city label").addClass("inputted"),u.resolve(!1)},fail:function(){e.find(".txt-city, .txt-state, .dd-states").find(".input-loading").hide();u.resolve(!1)}})):u.resolve(!1)):u.resolve(!0):u.resolve(!1);break;case"opt-addressline2":if(ii=$.trim(e.find(".txt-addressline2 .textbox").val()),/^[a-zA-Z0-9-#&. ]*$/.test(ii)===!1)AVL.RESPONSIVEFORM.VALIDATION.HasInvalidTextWarning=!0,u.resolve(!0);else{if(AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNonUSCountry(t)||$("#bypassed-"+t.attr("id")).length!==0)u.resolve(!1);else{var ri=$.trim(e.find(".txt-addressline1 .textbox").val()),fr=$.trim(e.find(".txt-addressline2 .textbox").val()),ui=$.trim(e.find(".txt-city .textbox").val()),er=e.find(".dd-states").css("display")!=="none",fi=er?e.find(".dd-states .dropdown").val():$.trim(e.find(".txt-state .textbox").val()),ei=$.trim(e.find(".txt-zipcode .textbox").val());if(ri!==""&&ui!==""&&fi!==""&&ei!==""){var or="<address><addressline1>"+ri+"<\/addressline1><addressline2>"+fr+"<\/addressline2><city>"+ui+"<\/city><state>"+fi+"<\/state><zip>"+ei+"<\/zip><\/address>",lt=t.parent().find(".input-loading"),y=!1;AVL.RESPONSIVEFORM.VALIDATION.DOM.ShowLoadingImage(n,t,lt);$.ajax({type:"POST",url:"/SiteUtilities/AddressVerification.aspx",contentType:"text/xml",dataType:"text",data:or,success:function(n){lt.fadeOut(100,function(){var i=$.parseXML(n),r=$(i),t=r.find("ismissingaptnumber");t!=null&&t!==""?(y=t.text().toLowerCase()==="true",e.find(".txt-addressline2 label em").text(y?"(required)":"(if applicable)"),y&&e.find(".txt-addressline2 input[type='text']").attr("data-validation","req-field"),y&&(address2Flagged=!0),u.resolve(y)):u.resolve(!1)})},error:function(){lt.hide();u.resolve(!1)}})}else u.resolve(!1)}AVL.RESPONSIVEFORM.VALIDATION.HasInvalidTextWarning=!1}break;case"req-zipcode":case"opt-zipcode":r!=="opt-zipcode"||AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)?!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)||/[\/\\\"?&.*:<>|@#%,]/g.test(i)?u.resolve(!0):(d=e.find(".dd-country .dropdown").val(),d==="US"?(f||e.find(".txt-city, .txt-state, .dd-states").find(".input-loading").show(),h={testing:!1,country:e.find(".dd-country .dropdown").val(),zipCode:i},AVL.RESPONSIVEFORM.VALIDATION.ShowJSONAddressData&&console.log(h),$.ajax({url:"/MyAccount/CommonControls/ResponsiveForms/Handlers/UPSAddressValidationCityStateZIP.ashx",type:"POST",data:JSON.stringify(h),contentType:"application/json; charset=utf-8",dataType:"json",success:function(n){if(n!=undefined&&n.Response!=undefined){var i=n.Response,t=n.AddressValidationResults;AVL.RESPONSIVEFORM.VALIDATION.ShowJSONAddressData&&console.log(i);i.ResponseStatusDescription==="Failure"?(f||e.find(".txt-city, .txt-state, .dd-states").find(".input-loading").hide(),i.ErrorCode==="101112"||i.ErrorCode==="20008"?(AVL.RESPONSIVEFORM.VALIDATION.IsZipCodeValid=!1,AVL.RESPONSIVEFORM.VALIDATION.IsZipCodeError=!0,u.resolve(!0)):u.resolve(!1)):(AVL.RESPONSIVEFORM.VALIDATION.ShowJSONAddressData&&$.each(t,function(n){console.log(t[n])}),f?u.resolve(!1):(e.find(".txt-state .input-loading, .dd-states .input-loading").fadeOut(100),e.find(".txt-city .input-loading").fadeOut(100,function(){var n,i,r;if(t.length>0){if(n=t[0].StateProvinceCode,AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(e.find(".dd-states"),e.find(".dd-states .dropdown"),!1,f),t[0].City!=="")if(t.length===1)e.find(".txt-city .textbox").val(AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[0].City)),AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(e.find(".txt-city"),e.find(".txt-city .textbox"),!1,f),e.find(".txt-city .textbox").autocomplete({source:[]});else{i=[];r=!1;$.each(t,function(n){i[n]=AVL.RESPONSIVEFORM.CORE.UTILITIES.CapitalizeFirstLetter(t[n].City);t[n].City.toLowerCase()===$.trim(e.find(".txt-city .textbox").val()).toLowerCase()&&(r=!0)});r||(e.find(".txt-city .textbox").val(""),e.find(".txt-city").find("label").removeClass("inputted"));e.find(".txt-city .textbox").autocomplete({position:{my:"left top",at:"left bottom-1","of":e.find(".txt-city")},delay:0,source:i,minLength:0,select:function(){var n=e.find(".txt-city .textbox");n.parent().find("label").addClass("inputted");AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(e.find(".txt-city"),e.find(".txt-city .textbox"),!1,f)},close:function(){e.find(".txt-city .textbox").trigger("change")}}).on("focus",function(){$(this).hasClass("ui-autocomplete-input")&&$(this).autocomplete("search","")})}e.find(".txt-state").length>0&&e.find(".txt-state").css("display")!=="none"?(e.find(".txt-state .textbox").val(n),AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(e.find(".txt-state"),e.find(".txt-state .textbox"),!1,f)):(e.find(".dd-states select").val(n).trigger("change"),AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(e.find(".dd-states"),e.find(".dd-states .dropdown"),!1,f));AVL.RESPONSIVEFORM.CORE.INIT.InitFormLabels($("#address-container"));u.resolve(!1)}else u.resolve(!0)})))}else AVL.RESPONSIVEFORM.VALIDATION.ShowJSONAddressData&&console.log(n),f||e.find(".txt-city, .txt-state, .dd-states").find(".input-loading").hide(),u.resolve(!1)},fail:function(){e.find(".txt-city, .txt-state, .dd-states").find(".input-loading").hide();u.resolve(!1)}})):u.resolve(!1)):u.resolve(!1);break;case"req-email":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsEmailAddress(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"opt-multi-email":if(i===""){u.resolve(!1);break}if(at=!1,g=i.split(","),AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(g))for(oi in g){si=AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsEmailAddress(g[oi]);si||(at=!0);break}u.resolve(at);break;case"req-email-newaccount":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsEmailAddress(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"req-ssn":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsSSN(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"req-url":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsURL(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"opt-date-mm-dd-yy":AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)&&!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsValidDate(i)?(n.attr("title","Please enter the Publish Date in this format (MM/DD/YYYY)."),u.resolve(!0)):(new Date).setHours(0,0,0,0)>Date.parse(i)?(n.attr("title","Publish date must be today's date or a date in the future."),u.resolve(!0)):u.resolve(!1);break;case"req-date":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsDate(i)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"req-date-mm-dd-yy":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsValidDate(i));break;case"req-pod-availabledate-mm-dd-yy":AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsValidDate(i)?new Date((new Date).setDate((new Date).getDate()+56)).setHours(0,0,0,0)>Date.parse(i)?(n.attr("title","We require that you make your book release date at least 8 weeks after you upload your book file to BookBaby.com."),u.resolve(!0)):u.resolve(!1):(n.attr("title","Please enter the Available Date in this format (MM/DD/YYYY)."),u.resolve(!0));break;case"req-available-date-mm-dd-yy":AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsValidDate(i)?(new Date).setHours(0,0,0,0)>Date.parse(i)?(n.attr("title","Available date must be today's date or a date in the future."),u.resolve(!0)):u.resolve(!1):(n.attr("title","Please enter the Available Date in this format (MM/DD/YYYY)."),u.resolve(!0));break;case"req-CouponEndDate-mm-dd-yy":p=$("#coupon-modal [id$='txtStartDate'] ").val();w=i;AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsValidDate(i)?(new Date).setHours(0,0,0,0)>Date.parse(w)||Date.parse(p)>Date.parse(w)?(n.attr("title","Expiration date must be after the Start Date."),u.resolve(!0)):u.resolve(!1):(n.attr("title","Please enter the Expiration Date in this format (MM/DD/YYYY)."),u.resolve(!0));break;case"req-CouponStartDate-mm-dd-yy":w=$("#coupon-modal [id$='txtEndDate'] ").val();p=i;AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsValidDate(i)?(new Date).setHours(0,0,0,0)>Date.parse(p)?(n.attr("title","Start date should be today's date or a date in the future."),u.resolve(!0)):Date.parse(p)>Date.parse(w)?(n.attr("title","Expiration date must be after the Start Date."),u.resolve(!0)):u.resolve(!1):(n.attr("title","Please enter the Start Date in this format (MM/DD/YYYY)."),u.resolve(!0));break;case"req-StartDateAddMinimum-mm-dd-yy":AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsValidDate(i,minimumDays=4)?(nt=new Date,nt.setDate((new Date).getDate()+minimumDays),nt.setHours(0,0,0),Date.parse(nt)>Date.parse(i)?(n.attr("title","Start date must be at least "+minimumDays+" days from today’s date."),u.resolve(!0)):u.resolve(!1)):(n.attr("title","Please enter the Start Date in this format (MM/DD/YYYY)."),u.resolve(!0));break;case"req-dateddl-gt":var tt=new Date,vt=i.split("/"),it=new Date,yt=e.find("select[data-validation=req-dateddl-lt]").val().split("/");tt.setDate(parseInt(vt[0]));tt.setMonth(parseInt(vt[1])-1);tt.setYear(parseInt(vt[2]));it.setDate(parseInt(yt[0]));it.setMonth(parseInt(yt[1])-1);it.setYear(parseInt(yt[2]));u.resolve(tt.getTime()<it.getTime());break;case"req-password":case"req-password1":i.length===0?n.attr("title","Please enter a password."):i.length<8?n.attr("title","Your password must be at least 8 characters."):i.length>20&&n.attr("title","Your password must be 20 characters or less.");pt=e.find("input[data-validation=req-password2]");hi=pt.val();hi!==""&&AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.ValidateInput(pt);u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)||i.length<8||i.length>20);break;case"req-password2":ci=e.find("input[data-validation=req-password1]").val();AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)?i!==ci?(n.attr("title","The password and confirmation don't match."),u.resolve(!0)):i.length<8?(n.attr("title","Your confirming password must be at least 8 characters."),u.resolve(!0)):i.length>20?(n.attr("title","Your confirming password must be 20 characters or less."),u.resolve(!0)):u.resolve(!1):u.resolve(!0);break;case"req-coupon":i=t.val();li=$("#coupon-modal [id$='rbCouponType'] input:checked").val();li==="1"?u.resolve(!1):AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsAlphNumeric(i)&&AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)?(ai=/The coupon code you entered has already been used. Please enter a different code/i,$("[id$='btnValidateCoupon']").show(),wt=t.attr("id")+"_warning",ai.test($("#"+wt).html())?(n.attr("title","The coupon code you entered has already been used. Please enter a different code."),/./i.test($("#"+wt).html())?u.resolve(!1):u.resolve(!0)):u.resolve(!1)):(i!==""?n.attr("title","Special characters are not allowed."):n.attr("title","Please enter coupon code."),$("[id$='lblCouponCodeAvailable']").hide(),u.resolve(!0));break;case"req-coupon-discount":rt=$("#coupon-modal [id$='rbDiscountType'] input:checked").val();bt=rt==="1"?t.val().replace(/[$]/g,""):t.val().replace(/[%]/g,"");isValid=!0;$.isNumeric(bt)?(vi=parseFloat($("#coupon-modal [id$='hfModalBookPrice']").val()),yi=$("#coupon-modal [id$='hfModalBookType']").val(),u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.ValidateCoupondiscount(rt,yi,bt,vi,n))):(n.attr("title",rt===undefined?"Please select the discount type first.":"Please enter a valid discount amount."),u.resolve(!0));break;case"req-budget":var c=i.replace(/[^.0-9]/g,""),s=$('[id$="txtNumWeeks"]').val().replace(/[^.0-9]/g,""),pi=$('[id$="spEnteredBudget"]'),sr=!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(c)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsWholeNumber(c)||c<100,a=AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.GetRoundDownBudget(c),b=a/100;sr?(n.attr("title",a===0?"The budget you have entered does not meet the minimum of $100 per week.":"Please enter an integer that meets the minimum budget."),pi.text(c!==""?"The budget you have entered does not meet the minimum of $100 per week.":""),u.resolve(!0)):($('[id$="txtBudget"]').val("$"+c),n=$('[id$="txtNumWeeks"]').parent("p"),ut=$('[id$="txtNumWeeks_warning"]'),s!==""&&(s>b||s==="0")?(o=b===1?"Please enter 1 week":"Please enter number of weeks between 1 – "+b,o+=" or increase your budget.",n.attr("title",o),n.find("i.input-warning").length?n.find("i.input-warning").attr("title",o):n.append("<i class='input-status input-warning icon-attention' title='"+o+"' onclick='ShowValidationMessage(event, $(this));'><\/i>"),n.addClass("failed-validation"),ut.text(o)):s!==""&&(n.attr("title",""),n.removeClass("failed-validation"),ut.length>0&&ut.text("")),AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.ShowBudgetLabel(a,b,b,pi),u.resolve(!1));break;case"req-budget-per-week":var s=i.replace(/[^.0-9]/g,""),c=$('[id$="txtBudget"]').val().replace(/[^.0-9]/g,""),kt=!1,o="",a=AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.GetRoundDownBudget(c),dt=$.isNumeric(s)&&$.isNumeric(c)&&a!=="0",hr=a/100;if(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsWholeNumber(s)){o="Please enter a valid integer.";n.attr("title",o);$('[id$="input-warning"]').attr("title",o);dt=!1;u.resolve(!0);break}if($("[id$='txtNumWeeks']").val(s),s!==""&&s!=="0"&&c===""||a===0){u.resolve(!1);break}dt?(kt=parseInt(s)>=1?a/s>=100:!1,kt?n.attr("title",""):(o=hr===1?"Please enter 1 week":"Please enter number of weeks between 1 – "+a/100,o+=" or increase your budget.",n.attr("title",o),$('[id$="input-warning"]').attr("title",o))):n.attr("title","Please enter the week in the correct format.");u.resolve(!dt||!kt);break;case"req-albumname":case"req-artistname":case"req-volumename":case"req-tracktitle":case"req-urlpage":case"req-cdtext":wi=r==="req-volumename"||r==="req-urlpage"?/[\[\]\/\\\"~'&^$!}{\;()?.*+=:<>| @#%,]/g:/[\/\\\*:<>|@#%]/g;i=t.val().replace(/[^\x00-\x7F]/g,"");i=i.replace(wi,"");t.val(i);t.closest("fieldset").sisyphus().saveAllData();f?u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i.trim())):u.resolve(!1);break;case"opt-isrc":if(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)){u.resolve(!1);break}case"req-isrc":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)||!/^[a-zA-Z]{2}(-?)[0-9a-zA-Z]{3}(-?)\d{2}(-?)\d{5}$/.test(i));break;case"req-search":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)||i.trim().toLowerCase()==="search");break;case"req-youtubelink":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)||!/^(http(s?)\:\/\/)?(www\.)?((youtube\.com\/watch\?v=)|(youtu.be\/))([a-zA-Z0-9\-_]){11}/.test(i.toLowerCase()));break;case"req-youtubechannel":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)||!/((http|https):\/\/|)(www\.|)youtube\.com\/(channel\/|user\/|c\/|@)[a-zA-Z0-9_\-]{1,}$/.test(i.toLowerCase()));break;case"req-partnerlink":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"req-fullname":u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)||!i.trim().includes(" "));break;case"req-selected-speaker":u.resolve(i.trim()==="Not Selected"||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"req-word-phrase":if(ft=n.parent().next().find(".textbox-mask"),!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)&&!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(ft.children(".textarea").val())){AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(ft,ft.children(".textarea"),!1,f);u.resolve(!1);break}u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;case"req-pronunciation":if(et=n.parent().prev().find(".textbox-mask"),!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i)&&!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(et.children(".textarea").val())){AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(et,et.children(".textarea"),!1,f);u.resolve(!1);break}u.resolve(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(i));break;default:u.resolve(!1)}return u.promise()},CheckCertifiedAddressMatch:function(n){return!AVL.RESPONSIVEFORM.VALIDATION.AddressCertified||AVL.RESPONSIVEFORM.VALIDATION.JsonCertifiedAddress.addressline1!==$.trim(n.addressline1)||AVL.RESPONSIVEFORM.VALIDATION.JsonCertifiedAddress.city!==$.trim(n.city)||AVL.RESPONSIVEFORM.VALIDATION.JsonCertifiedAddress.zipCode!==$.trim(n.zipCode)||AVL.RESPONSIVEFORM.VALIDATION.JsonCertifiedAddress.state!==$.trim(n.state)||AVL.RESPONSIVEFORM.VALIDATION.JsonCertifiedAddress.country!==$.trim(n.country)?(AVL.RESPONSIVEFORM.VALIDATION.AddressCertified=!1,$("#address-results").find("#addressCertified").val("false"),AVL.RESPONSIVEFORM.VALIDATION.JsonCertifiedAddress.addressline1=$.trim(n.addressline1),AVL.RESPONSIVEFORM.VALIDATION.JsonCertifiedAddress.city=$.trim(n.city),AVL.RESPONSIVEFORM.VALIDATION.JsonCertifiedAddress.zipCode=$.trim(n.zipCode),AVL.RESPONSIVEFORM.VALIDATION.JsonCertifiedAddress.state=$.trim(n.state),AVL.RESPONSIVEFORM.VALIDATION.JsonCertifiedAddress.country=$.trim(n.country),!1):!0},ValidateInput:function(n){var t=n.closest("p, div.radio-mask, div.textbox-mask"),i=$.trim(n.val()),r=n.attr("data-validation")||n.parent().attr("data-validation"),u=new $.Deferred;$.when(AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.CheckInputValue(t,n,i,r,u,!1)).done(function(r){AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(t,n,r,!1);AVL.RESPONSIVEFORM.VALIDATION.InstantValidationDebug&&console.log("input: "+n.attr("id")+"\r\nvalue: '"+i+"'\r\nfail: "+r)})},GetProjectedProceed:function(n,t,i,r){var u,f=r==="1"?t:t*n/100,e=i==="Print"?n/2:15*n/100;return u=n-f,u=u-e,u>0?u.toFixed(2):0..toFixed(2)},ValidateCoupondiscount:function(n,t,i,r,u){var f=!0;if(u.attr("title",""),$.isNumeric(i)){$("#coupon-modal [id$='projected-amount']").text("");switch(n){case"1":t==="eBook"?i>r*85/100&&i!=r&&(u.attr("title","The maximum allowable discount for an eBook is up to 85% or 100% of the book price [$"+r+"]."),f=!1):t==="Audiobook"?i>r*.75&&(u.attr("title","The maximum allowable discount for an audiobook is 75% of the book price [$"+r+"]."),f=!1):i>r/2&&(u.attr("title","The maximum allowable discount for a print book is half of the book price [$"+r+"]."),f=!1);break;case"2":t==="eBook"?parseFloat(i)!==100&&parseFloat(i)>85&&(u.attr("title","The maximum allowable discount for an eBook is up to 85% or 100% of the book price [$"+r+"]."),f=!1):t==="Audiobook"?r*i/100>r*.75&&(u.attr("title","The maximum allowable discount for an audiobook is 75% of the book price [$"+r+"]."),f=!1):r*i/100>r/2&&(u.attr("title","The maximum allowable discount for a print book is 50% of the price [$"+r+"]."),f=!1);break;case undefined:u.attr("title","Please select the discount type first.");f=!1}$("#coupon-modal [id$='projected-amount']").text(f?"Projected Proceeds: $"+AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.GetProjectedProceed(r,i,t,n):"")}else u.attr("title","Please enter a valid discount amount."),f=!1;return f||AVL.RESPONSIVEFORM.VALIDATION.DOM.SetIconWarningMessage(u),f},ShowBudgetLabel:function(n,t,i,r){var u=n/t>=100;r.text(u?"The budget you have entered will allow for 1 "+(i===1?"week":"- "+i+" weeks")+" of advertising":"")},GetRoundDownBudget:function(n){return n%100!=0?n-n%100:n}},POSTBACKS:{ValidateInputs:function(n,t,i,r){var e=n.target||n.srcElement,u=$(e),o=[],f=!0,s=u.attr("data-submit-text")==undefined?"Submitting...":u.attr("data-submit-text"),h=u.attr("data-submit-scrollform")==undefined?!0:u.attr("data-submit-scrollform");return u.data("validated")==="true"?!0:(u.data("original")==undefined&&u.data("original",u.val()),u.val(s).prop("disabled",!0),t.addClass("invalid-form"),t.each(function(){var n=$(this);AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.RemoveHazardousStrings(t);$(n).find("input.textbox:visible, textarea.textarea:visible, select.dropdown:visible, input.checkbox:visible, .checkbox input:visible, .radiobutton:visible").each(function(){var n=$(this),t=n.closest("p, div.radio-mask, div.textbox-mask"),r=$.trim(n.val()),u=n.attr("data-validation")||n.parent().attr("data-validation"),i=new $.Deferred;o.push(i);$.when(AVL.RESPONSIVEFORM.VALIDATION.FUNCTIONS.CheckInputValue(t,n,r,u,i,!0)).done(function(i){i&&(f=!1);AVL.RESPONSIVEFORM.VALIDATION.DOM.DisplayValidationResult(t,n,i,!0);AVL.RESPONSIVEFORM.VALIDATION.SubmitValidationDebug&&console.log(n.attr("id").split("_").pop()+"("+n.val()+") - fail: "+i)})})}),$.when.apply(null,o).done(function(){u.val(u.data("original")).prop("disabled",!1);f?i!=null?(AVL.RESPONSIVEFORM.CORE.UTILITIES.ReleaseLocalStorage($(".responsive-form")),localStorage.removeItem("focus"),i.apply(u[0])):(u.val(s).data("validated","true"),AVL.RESPONSIVEFORM.CORE.UTILITIES.ReleaseLocalStorage($(".responsive-form")),localStorage.removeItem("focus"),e.onclick=null,r!=null?(t.each(function(){score=$(this).attr("id")=="newsletter-form"?$("#recaptchaScoreNews"):$("#recaptchaScore")}),AVL.UTILITIES.FUNCTIONS.GetRecaptchaToken(r,score,$("#recaptchaKey"),u)):setTimeout(function(){u.trigger("click");u.attr("data-submit-disable")=="true"&&u.prop("disabled",!0)},1)):h===!0&&AVL.RESPONSIVEFORM.VALIDATION.DOM.MoveToFirstFailedInput();AVL.RESPONSIVEFORM.VALIDATION.SubmitValidationDebug&&console.log("Form sumbit validated: "+f)}),!1)}},UTILITIES:{FormatUSPhoneNumber:function(n,t,i){t=t.replace(/["'()-]/g,"");t=t.replace(/ /g,"");t=t.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNonUSCountry(n)||i)&&n.val(t)},GetCountryCode:function(n){var i="",t=n.closest(".responsive-form").find(".dd-country select:visible");return t.length>0&&t.val()&&(i=t.val().toLowerCase()),i},ValidateRange:function(n,t,i,r,u,f){var c=AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNumber(t),l=t.replace(/[^.0-9]/g,""),s=parseFloat(l),e=(""+t).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/),h,o=!1;return h=Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)),t===""||!c||s<=0?(o=!0,n.attr("data-warning-override","Please enter a valid "+f+".")):s<i||s>r?(o=!0,n.attr("data-warning-override","Please enter a valid "+f+".")):h>u&&(o=!0,n.attr("data-warning-override","Please enter a "+f+" of up to "+u+" decimal places.")),o},RemoveHazardousStrings:function(n){n.find("input.textbox, textarea.textarea").each(function(){$(this).val(AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.SanitizeValue($(this).val()))})},SanitizeValue:function(n){return n.replace(/\< /g,"<").replace(/\</g,"< ").replace(/\&\#/g,"& #")},IsAlphNumeric:function(n){return!/[^A-Za-z0-9]/.test(n)},IsNoSelection:function(n){return n!=="0"&&AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(n)},IsNotZero:function(n){return n>0},IsNotEmpty:function(n){return n!==""},IsNotAvailable:function(n){return n!=="N/A"},IsNumber:function(n){return!isNaN(n)},IsWholeNumber:function(n){return/^\d+$/.test(n)},IsPrice:function(n){return/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(n)},IsISBN:function(n){return/^(979|978)\d{10}$/i.test(n)},IsPhoneNumber:function(n){return/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/i.test(n)},IsUSPhoneNumber:function(n){var t=n.replace(/["'()-]/g,"");return t=t.replace(/ /g,""),/^[0-9]{1,11}$/.test(+t)&&(t.length===10||t.length===11)},IsPhoneNumberByCountry:function(n,t){var i=!1;switch(t){case"us":i=!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsUSPhoneNumber(n)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(n);break;case"ca":case"ant":case"bar":case"bah":case"angu":case"brv":case"cay":case"ber":case"gren":case"tc":case"mons":case"guam":case"stm":case"stl":case"domi":case"stv":case"pr":case"do":case"tri":case"stk":case"jam":i=!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsPhoneNumber(n);break;default:i=!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsInternationalPhoneNumber(n)}return i},IsInternationalPhoneNumber:function(n){return/^(\+)?[0-9\-().\s]{7,15}$/i.test(n)},IsNonUSCountry:function(n){var t=AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.GetCountryCode(n);return t!=="us"},IsEmailAddress:function(n){return/^[^@\s]{1,}@[^@\s]{1,}\.[^@\s]{1,}$/i.test(n)},IsLuhnPass:function(t){var e=!0,f,i;if(/[^0-9-]+/.test(t))e=!1;else{var u=0,i=0,r=!1;for(t=t.replace(/\D/g,""),n=t.length-1;n>=0;n--)f=t.charAt(n),i=parseInt(f,10),r&&(i*=2)>9&&(i-=9),u+=i,r=!r;return u%10==0?!0:!1}},IsSSN:function(n){return/^(?!000)([0-9]\d{2}|7([0-9]\d|7[012]))([ -]?)(?!00)\d\d\3(?!0000)\d{4}$/i.test(n)},IsURL:function(n){return/^(https?):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(n)},IsDate:function(n){return!/Invalid|NaN/.test(new Date(n))},IsValidDate:function(n){if(!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsNotEmpty(n)||!AVL.RESPONSIVEFORM.VALIDATION.UTILITIES.IsDateMMDDYY(n))return!1;var t=n.split("/"),r=parseInt(t[2],10),u=parseInt(t[0],10)-1,f=parseInt(t[1],10),i=new Date(r,u,f);return i.getFullYear()===r&&i.getMonth()===u&&i.getDate()===f},IsDateMMDDYY:function(n){return/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$/i.test(n)}}};;!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n="undefined"!=typeof globalThis?globalThis:n||self,function(){var t=n._,e=n._=r();e.noConflict=function(){return n._=t,e}}())}(this,(function(){var n="1.13.4",r="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},t=Array.prototype,e=Object.prototype,u="undefined"!=typeof Symbol?Symbol.prototype:null,o=t.push,i=t.slice,a=e.toString,f=e.hasOwnProperty,c="undefined"!=typeof ArrayBuffer,l="undefined"!=typeof DataView,s=Array.isArray,p=Object.keys,v=Object.create,h=c&&ArrayBuffer.isView,y=isNaN,d=isFinite,g=!{toString:null}.propertyIsEnumerable("toString"),b=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],m=Math.pow(2,53)-1;function j(n,r){return r=null==r?n.length-1:+r,function(){for(var t=Math.max(arguments.length-r,0),e=Array(t),u=0;u<t;u++)e[u]=arguments[u+r];switch(r){case 0:return n.call(this,e);case 1:return n.call(this,arguments[0],e);case 2:return n.call(this,arguments[0],arguments[1],e)}var o=Array(r+1);for(u=0;u<r;u++)o[u]=arguments[u];return o[r]=e,n.apply(this,o)}}function _(n){var r=typeof n;return "function"===r||"object"===r&&!!n}function w(n){return void 0===n}function A(n){return!0===n||!1===n||"[object Boolean]"===a.call(n)}function x(n){var r="[object "+n+"]";return function(n){return a.call(n)===r}}var S=x("String"),O=x("Number"),M=x("Date"),E=x("RegExp"),B=x("Error"),N=x("Symbol"),I=x("ArrayBuffer"),T=x("Function"),k=r.document&&r.document.childNodes;"function"!=typeof /./&&"object"!=typeof Int8Array&&"function"!=typeof k&&(T=function(n){return "function"==typeof n||!1});var D=T,R=x("Object"),F=l&&R(new DataView(new ArrayBuffer(8))),V="undefined"!=typeof Map&&R(new Map),P=x("DataView");var q=F?function(n){return null!=n&&D(n.getInt8)&&I(n.buffer)}:P,U=s||x("Array");function W(n,r){return null!=n&&f.call(n,r)}var z=x("Arguments");!function(){z(arguments)||(z=function(n){return W(n,"callee")})}();var L=z;function $(n){return O(n)&&y(n)}function C(n){return function(){return n}}function K(n){return function(r){var t=n(r);return "number"==typeof t&&t>=0&&t<=m}}function J(n){return function(r){return null==r?void 0:r[n]}}var G=J("byteLength"),H=K(G),Q=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var X=c?function(n){return h?h(n)&&!q(n):H(n)&&Q.test(a.call(n))}:C(!1),Y=J("length");function Z(n,r){r=function(n){for(var r={},t=n.length,e=0;e<t;++e)r[n[e]]=!0;return{contains:function(n){return!0===r[n]},push:function(t){return r[t]=!0,n.push(t)}}}(r);var t=b.length,u=n.constructor,o=D(u)&&u.prototype||e,i="constructor";for(W(n,i)&&!r.contains(i)&&r.push(i);t--;)(i=b[t])in n&&n[i]!==o[i]&&!r.contains(i)&&r.push(i)}function nn(n){if(!_(n))return[];if(p)return p(n);var r=[];for(var t in n)W(n,t)&&r.push(t);return g&&Z(n,r),r}function rn(n,r){var t=nn(r),e=t.length;if(null==n)return!e;for(var u=Object(n),o=0;o<e;o++){var i=t[o];if(r[i]!==u[i]||!(i in u))return!1}return!0}function tn(n){return n instanceof tn?n:this instanceof tn?void(this._wrapped=n):new tn(n)}function en(n){return new Uint8Array(n.buffer||n,n.byteOffset||0,G(n))}tn.VERSION=n,tn.prototype.value=function(){return this._wrapped},tn.prototype.valueOf=tn.prototype.toJSON=tn.prototype.value,tn.prototype.toString=function(){return String(this._wrapped)};var un="[object DataView]";function on(n,r,t,e){if(n===r)return 0!==n||1/n==1/r;if(null==n||null==r)return!1;if(n!=n)return r!=r;var o=typeof n;return("function"===o||"object"===o||"object"==typeof r)&&function n(r,t,e,o){r instanceof tn&&(r=r._wrapped);t instanceof tn&&(t=t._wrapped);var i=a.call(r);if(i!==a.call(t))return!1;if(F&&"[object Object]"==i&&q(r)){if(!q(t))return!1;i=un}switch(i){case "[object RegExp]":case "[object String]":return ""+r==""+t;case "[object Number]":return+r!=+r?+t!=+t:0==+r?1/+r==1/t:+r==+t;case "[object Date]":case "[object Boolean]":return+r==+t;case "[object Symbol]":return u.valueOf.call(r)===u.valueOf.call(t);case "[object ArrayBuffer]":case un:return n(en(r),en(t),e,o)}var f="[object Array]"===i;if(!f&&X(r)){if(G(r)!==G(t))return!1;if(r.buffer===t.buffer&&r.byteOffset===t.byteOffset)return!0;f=!0}if(!f){if("object"!=typeof r||"object"!=typeof t)return!1;var c=r.constructor,l=t.constructor;if(c!==l&&!(D(c)&&c instanceof c&&D(l)&&l instanceof l)&&"constructor"in r&&"constructor"in t)return!1}o=o||[];var s=(e=e||[]).length;for(;s--;)if(e[s]===r)return o[s]===t;if(e.push(r),o.push(t),f){if((s=r.length)!==t.length)return!1;for(;s--;)if(!on(r[s],t[s],e,o))return!1}else{var p,v=nn(r);if(s=v.length,nn(t).length!==s)return!1;for(;s--;)if(p=v[s],!W(t,p)||!on(r[p],t[p],e,o))return!1}return e.pop(),o.pop(),!0}(n,r,t,e)}function an(n){if(!_(n))return[];var r=[];for(var t in n)r.push(t);return g&&Z(n,r),r}function fn(n){var r=Y(n);return function(t){if(null==t)return!1;var e=an(t);if(Y(e))return!1;for(var u=0;u<r;u++)if(!D(t[n[u]]))return!1;return n!==hn||!D(t[cn])}}var cn="forEach",ln="has",sn=["clear","delete"],pn=["get",ln,"set"],vn=sn.concat(cn,pn),hn=sn.concat(pn),yn=["add"].concat(sn,cn,ln),dn=V?fn(vn):x("Map"),gn=V?fn(hn):x("WeakMap"),bn=V?fn(yn):x("Set"),mn=x("WeakSet");function jn(n){for(var r=nn(n),t=r.length,e=Array(t),u=0;u<t;u++)e[u]=n[r[u]];return e}function _n(n){for(var r={},t=nn(n),e=0,u=t.length;e<u;e++)r[n[t[e]]]=t[e];return r}function wn(n){var r=[];for(var t in n)D(n[t])&&r.push(t);return r.sort()}function An(n,r){return function(t){var e=arguments.length;if(r&&(t=Object(t)),e<2||null==t)return t;for(var u=1;u<e;u++)for(var o=arguments[u],i=n(o),a=i.length,f=0;f<a;f++){var c=i[f];r&&void 0!==t[c]||(t[c]=o[c])}return t}}var xn=An(an),Sn=An(nn),On=An(an,!0);function Mn(n){if(!_(n))return{};if(v)return v(n);var r=function(){};r.prototype=n;var t=new r;return r.prototype=null,t}function En(n){return U(n)?n:[n]}function Bn(n){return tn.toPath(n)}function Nn(n,r){for(var t=r.length,e=0;e<t;e++){if(null==n)return;n=n[r[e]]}return t?n:void 0}function In(n,r,t){var e=Nn(n,Bn(r));return w(e)?t:e}function Tn(n){return n}function kn(n){return n=Sn({},n),function(r){return rn(r,n)}}function Dn(n){return n=Bn(n),function(r){return Nn(r,n)}}function Rn(n,r,t){if(void 0===r)return n;switch(null==t?3:t){case 1:return function(t){return n.call(r,t)};case 3:return function(t,e,u){return n.call(r,t,e,u)};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)}}return function(){return n.apply(r,arguments)}}function Fn(n,r,t){return null==n?Tn:D(n)?Rn(n,r,t):_(n)&&!U(n)?kn(n):Dn(n)}function Vn(n,r){return Fn(n,r,1/0)}function Pn(n,r,t){return tn.iteratee!==Vn?tn.iteratee(n,r):Fn(n,r,t)}function qn(){}function Un(n,r){return null==r&&(r=n,n=0),n+Math.floor(Math.random()*(r-n+1))}tn.toPath=En,tn.iteratee=Vn;var Wn=Date.now||function(){return(new Date).getTime()};function zn(n){var r=function(r){return n[r]},t="(?:"+nn(n).join("|")+")",e=RegExp(t),u=RegExp(t,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,r):n}}var Ln={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},$n=zn(Ln),Cn=zn(_n(Ln)),Kn=tn.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},Jn=/(.)^/,Gn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Hn=/\\|'|\r|\n|\u2028|\u2029/g;function Qn(n){return "\\"+Gn[n]}var Xn=/^\s*(\w|\$)+\s*$/;var Yn=0;function Zn(n,r,t,e,u){if(!(e instanceof r))return n.apply(t,u);var o=Mn(n.prototype),i=n.apply(o,u);return _(i)?i:o}var nr=j((function(n,r){var t=nr.placeholder,e=function(){for(var u=0,o=r.length,i=Array(o),a=0;a<o;a++)i[a]=r[a]===t?arguments[u++]:r[a];for(;u<arguments.length;)i.push(arguments[u++]);return Zn(n,e,this,this,i)};return e}));nr.placeholder=tn;var rr=j((function(n,r,t){if(!D(n))throw new TypeError("Bind must be called on a function");var e=j((function(u){return Zn(n,e,r,this,t.concat(u))}));return e})),tr=K(Y);function er(n,r,t,e){if(e=e||[],r||0===r){if(r<=0)return e.concat(n)}else r=1/0;for(var u=e.length,o=0,i=Y(n);o<i;o++){var a=n[o];if(tr(a)&&(U(a)||L(a)))if(r>1)er(a,r-1,t,e),u=e.length;else for(var f=0,c=a.length;f<c;)e[u++]=a[f++];else t||(e[u++]=a)}return e}var ur=j((function(n,r){var t=(r=er(r,!1,!1)).length;if(t<1)throw new Error("bindAll must be passed function names");for(;t--;){var e=r[t];n[e]=rr(n[e],n)}return n}));var or=j((function(n,r,t){return setTimeout((function(){return n.apply(null,t)}),r)})),ir=nr(or,tn,1);function ar(n){return function(){return!n.apply(this,arguments)}}function fr(n,r){var t;return function(){return--n>0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}}var cr=nr(fr,2);function lr(n,r,t){r=Pn(r,t);for(var e,u=nn(n),o=0,i=u.length;o<i;o++)if(r(n[e=u[o]],e,n))return e}function sr(n){return function(r,t,e){t=Pn(t,e);for(var u=Y(r),o=n>0?0:u-1;o>=0&&o<u;o+=n)if(t(r[o],o,r))return o;return-1}}var pr=sr(1),vr=sr(-1);function hr(n,r,t,e){for(var u=(t=Pn(t,e,1))(r),o=0,i=Y(n);o<i;){var a=Math.floor((o+i)/2);t(n[a])<u?o=a+1:i=a}return o}function yr(n,r,t){return function(e,u,o){var a=0,f=Y(e);if("number"==typeof o)n>0?a=o>=0?o:Math.max(o+f,a):f=o>=0?Math.min(o+1,f):o+f+1;else if(t&&o&&f)return e[o=t(e,u)]===u?o:-1;if(u!=u)return(o=r(i.call(e,a,f),$))>=0?o+a:-1;for(o=n>0?a:f-1;o>=0&&o<f;o+=n)if(e[o]===u)return o;return-1}}var dr=yr(1,pr,hr),gr=yr(-1,vr);function br(n,r,t){var e=(tr(n)?pr:lr)(n,r,t);if(void 0!==e&&-1!==e)return n[e]}function mr(n,r,t){var e,u;if(r=Rn(r,t),tr(n))for(e=0,u=n.length;e<u;e++)r(n[e],e,n);else{var o=nn(n);for(e=0,u=o.length;e<u;e++)r(n[o[e]],o[e],n)}return n}function jr(n,r,t){r=Pn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=Array(u),i=0;i<u;i++){var a=e?e[i]:i;o[i]=r(n[a],a,n)}return o}function _r(n){var r=function(r,t,e,u){var o=!tr(r)&&nn(r),i=(o||r).length,a=n>0?0:i-1;for(u||(e=r[o?o[a]:a],a+=n);a>=0&&a<i;a+=n){var f=o?o[a]:a;e=t(e,r[f],f,r)}return e};return function(n,t,e,u){var o=arguments.length>=3;return r(n,Rn(t,u,4),e,o)}}var wr=_r(1),Ar=_r(-1);function xr(n,r,t){var e=[];return r=Pn(r,t),mr(n,(function(n,t,u){r(n,t,u)&&e.push(n)})),e}function Sr(n,r,t){r=Pn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(!r(n[i],i,n))return!1}return!0}function Or(n,r,t){r=Pn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(r(n[i],i,n))return!0}return!1}function Mr(n,r,t,e){return tr(n)||(n=jn(n)),("number"!=typeof t||e)&&(t=0),dr(n,r,t)>=0}var Er=j((function(n,r,t){var e,u;return D(r)?u=r:(r=Bn(r),e=r.slice(0,-1),r=r[r.length-1]),jr(n,(function(n){var o=u;if(!o){if(e&&e.length&&(n=Nn(n,e)),null==n)return;o=n[r]}return null==o?o:o.apply(n,t)}))}));function Br(n,r){return jr(n,Dn(r))}function Nr(n,r,t){var e,u,o=-1/0,i=-1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=tr(n)?n:jn(n)).length;a<f;a++)null!=(e=n[a])&&e>o&&(o=e);else r=Pn(r,t),mr(n,(function(n,t,e){((u=r(n,t,e))>i||u===-1/0&&o===-1/0)&&(o=n,i=u)}));return o}var Ir=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function Tr(n){return n?U(n)?i.call(n):S(n)?n.match(Ir):tr(n)?jr(n,Tn):jn(n):[]}function kr(n,r,t){if(null==r||t)return tr(n)||(n=jn(n)),n[Un(n.length-1)];var e=Tr(n),u=Y(e);r=Math.max(Math.min(r,u),0);for(var o=u-1,i=0;i<r;i++){var a=Un(i,o),f=e[i];e[i]=e[a],e[a]=f}return e.slice(0,r)}function Dr(n,r){return function(t,e,u){var o=r?[[],[]]:{};return e=Pn(e,u),mr(t,(function(r,u){var i=e(r,u,t);n(o,r,i)})),o}}var Rr=Dr((function(n,r,t){W(n,t)?n[t].push(r):n[t]=[r]})),Fr=Dr((function(n,r,t){n[t]=r})),Vr=Dr((function(n,r,t){W(n,t)?n[t]++:n[t]=1})),Pr=Dr((function(n,r,t){n[t?0:1].push(r)}),!0);function qr(n,r,t){return r in t}var Ur=j((function(n,r){var t={},e=r[0];if(null==n)return t;D(e)?(r.length>1&&(e=Rn(e,r[1])),r=an(n)):(e=qr,r=er(r,!1,!1),n=Object(n));for(var u=0,o=r.length;u<o;u++){var i=r[u],a=n[i];e(a,i,n)&&(t[i]=a)}return t})),Wr=j((function(n,r){var t,e=r[0];return D(e)?(e=ar(e),r.length>1&&(t=r[1])):(r=jr(er(r,!1,!1),String),e=function(n,t){return!Mr(r,t)}),Ur(n,e,t)}));function zr(n,r,t){return i.call(n,0,Math.max(0,n.length-(null==r||t?1:r)))}function Lr(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[0]:zr(n,n.length-r)}function $r(n,r,t){return i.call(n,null==r||t?1:r)}var Cr=j((function(n,r){return r=er(r,!0,!0),xr(n,(function(n){return!Mr(r,n)}))})),Kr=j((function(n,r){return Cr(n,r)}));function Jr(n,r,t,e){A(r)||(e=t,t=r,r=!1),null!=t&&(t=Pn(t,e));for(var u=[],o=[],i=0,a=Y(n);i<a;i++){var f=n[i],c=t?t(f,i,n):f;r&&!t?(i&&o===c||u.push(f),o=c):t?Mr(o,c)||(o.push(c),u.push(f)):Mr(u,f)||u.push(f)}return u}var Gr=j((function(n){return Jr(er(n,!0,!0))}));function Hr(n){for(var r=n&&Nr(n,Y).length||0,t=Array(r),e=0;e<r;e++)t[e]=Br(n,e);return t}var Qr=j(Hr);function Xr(n,r){return n._chain?tn(r).chain():r}function Yr(n){return mr(wn(n),(function(r){var t=tn[r]=n[r];tn.prototype[r]=function(){var n=[this._wrapped];return o.apply(n,arguments),Xr(this,t.apply(tn,n))}})),tn}mr(["pop","push","reverse","shift","sort","splice","unshift"],(function(n){var r=t[n];tn.prototype[n]=function(){var t=this._wrapped;return null!=t&&(r.apply(t,arguments),"shift"!==n&&"splice"!==n||0!==t.length||delete t[0]),Xr(this,t)}})),mr(["concat","join","slice"],(function(n){var r=t[n];tn.prototype[n]=function(){var n=this._wrapped;return null!=n&&(n=r.apply(n,arguments)),Xr(this,n)}}));var Zr=Yr({__proto__:null,VERSION:n,restArguments:j,isObject:_,isNull:function(n){return null===n},isUndefined:w,isBoolean:A,isElement:function(n){return!(!n||1!==n.nodeType)},isString:S,isNumber:O,isDate:M,isRegExp:E,isError:B,isSymbol:N,isArrayBuffer:I,isDataView:q,isArray:U,isFunction:D,isArguments:L,isFinite:function(n){return!N(n)&&d(n)&&!isNaN(parseFloat(n))},isNaN:$,isTypedArray:X,isEmpty:function(n){if(null==n)return!0;var r=Y(n);return "number"==typeof r&&(U(n)||S(n)||L(n))?0===r:0===Y(nn(n))},isMatch:rn,isEqual:function(n,r){return on(n,r)},isMap:dn,isWeakMap:gn,isSet:bn,isWeakSet:mn,keys:nn,allKeys:an,values:jn,pairs:function(n){for(var r=nn(n),t=r.length,e=Array(t),u=0;u<t;u++)e[u]=[r[u],n[r[u]]];return e},invert:_n,functions:wn,methods:wn,extend:xn,extendOwn:Sn,assign:Sn,defaults:On,create:function(n,r){var t=Mn(n);return r&&Sn(t,r),t},clone:function(n){return _(n)?U(n)?n.slice():xn({},n):n},tap:function(n,r){return r(n),n},get:In,has:function(n,r){for(var t=(r=Bn(r)).length,e=0;e<t;e++){var u=r[e];if(!W(n,u))return!1;n=n[u]}return!!t},mapObject:function(n,r,t){r=Pn(r,t);for(var e=nn(n),u=e.length,o={},i=0;i<u;i++){var a=e[i];o[a]=r(n[a],a,n)}return o},identity:Tn,constant:C,noop:qn,toPath:En,property:Dn,propertyOf:function(n){return null==n?qn:function(r){return In(n,r)}},matcher:kn,matches:kn,times:function(n,r,t){var e=Array(Math.max(0,n));r=Rn(r,t,1);for(var u=0;u<n;u++)e[u]=r(u);return e},random:Un,now:Wn,escape:$n,unescape:Cn,templateSettings:Kn,template:function(n,r,t){!r&&t&&(r=t),r=On({},r,tn.templateSettings);var e=RegExp([(r.escape||Jn).source,(r.interpolate||Jn).source,(r.evaluate||Jn).source].join("|")+"|$","g"),u=0,o="__p+='";n.replace(e,(function(r,t,e,i,a){return o+=n.slice(u,a).replace(Hn,Qn),u=a+r.length,t?o+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":e?o+="'+\n((__t=("+e+"))==null?'':__t)+\n'":i&&(o+="';\n"+i+"\n__p+='"),r})),o+="';\n";var i,a=r.variable;if(a){if(!Xn.test(a))throw new Error("variable is not a bare identifier: "+a)}else o="with(obj||{}){\n"+o+"}\n",a="obj";o="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{i=new Function(a,"_",o)}catch(n){throw n.source=o,n}var f=function(n){return i.call(this,n,tn)};return f.source="function("+a+"){\n"+o+"}",f},result:function(n,r,t){var e=(r=Bn(r)).length;if(!e)return D(t)?t.call(n):t;for(var u=0;u<e;u++){var o=null==n?void 0:n[r[u]];void 0===o&&(o=t,u=e),n=D(o)?o.call(n):o}return n},uniqueId:function(n){var r=++Yn+"";return n?n+r:r},chain:function(n){var r=tn(n);return r._chain=!0,r},iteratee:Vn,partial:nr,bind:rr,bindAll:ur,memoize:function(n,r){var t=function(e){var u=t.cache,o=""+(r?r.apply(this,arguments):e);return W(u,o)||(u[o]=n.apply(this,arguments)),u[o]};return t.cache={},t},delay:or,defer:ir,throttle:function(n,r,t){var e,u,o,i,a=0;t||(t={});var f=function(){a=!1===t.leading?0:Wn(),e=null,i=n.apply(u,o),e||(u=o=null)},c=function(){var c=Wn();a||!1!==t.leading||(a=c);var l=r-(c-a);return u=this,o=arguments,l<=0||l>r?(e&&(clearTimeout(e),e=null),a=c,i=n.apply(u,o),e||(u=o=null)):e||!1===t.trailing||(e=setTimeout(f,l)),i};return c.cancel=function(){clearTimeout(e),a=0,e=u=o=null},c},debounce:function(n,r,t){var e,u,o,i,a,f=function(){var c=Wn()-u;r>c?e=setTimeout(f,r-c):(e=null,t||(i=n.apply(a,o)),e||(o=a=null))},c=j((function(c){return a=this,o=c,u=Wn(),e||(e=setTimeout(f,r),t&&(i=n.apply(a,o))),i}));return c.cancel=function(){clearTimeout(e),e=o=a=null},c},wrap:function(n,r){return nr(r,n)},negate:ar,compose:function(){var n=arguments,r=n.length-1;return function(){for(var t=r,e=n[r].apply(this,arguments);t--;)e=n[t].call(this,e);return e}},after:function(n,r){return function(){if(--n<1)return r.apply(this,arguments)}},before:fr,once:cr,findKey:lr,findIndex:pr,findLastIndex:vr,sortedIndex:hr,indexOf:dr,lastIndexOf:gr,find:br,detect:br,findWhere:function(n,r){return br(n,kn(r))},each:mr,forEach:mr,map:jr,collect:jr,reduce:wr,foldl:wr,inject:wr,reduceRight:Ar,foldr:Ar,filter:xr,select:xr,reject:function(n,r,t){return xr(n,ar(Pn(r)),t)},every:Sr,all:Sr,some:Or,any:Or,contains:Mr,includes:Mr,include:Mr,invoke:Er,pluck:Br,where:function(n,r){return xr(n,kn(r))},max:Nr,min:function(n,r,t){var e,u,o=1/0,i=1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=tr(n)?n:jn(n)).length;a<f;a++)null!=(e=n[a])&&e<o&&(o=e);else r=Pn(r,t),mr(n,(function(n,t,e){((u=r(n,t,e))<i||u===1/0&&o===1/0)&&(o=n,i=u)}));return o},shuffle:function(n){return kr(n,1/0)},sample:kr,sortBy:function(n,r,t){var e=0;return r=Pn(r,t),Br(jr(n,(function(n,t,u){return{value:n,index:e++,criteria:r(n,t,u)}})).sort((function(n,r){var t=n.criteria,e=r.criteria;if(t!==e){if(t>e||void 0===t)return 1;if(t<e||void 0===e)return-1}return n.index-r.index})),"value")},groupBy:Rr,indexBy:Fr,countBy:Vr,partition:Pr,toArray:Tr,size:function(n){return null==n?0:tr(n)?n.length:nn(n).length},pick:Ur,omit:Wr,first:Lr,head:Lr,take:Lr,initial:zr,last:function(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[n.length-1]:$r(n,Math.max(0,n.length-r))},rest:$r,tail:$r,drop:$r,compact:function(n){return xr(n,Boolean)},flatten:function(n,r){return er(n,r,!1)},without:Kr,uniq:Jr,unique:Jr,union:Gr,intersection:function(n){for(var r=[],t=arguments.length,e=0,u=Y(n);e<u;e++){var o=n[e];if(!Mr(r,o)){var i;for(i=1;i<t&&Mr(arguments[i],o);i++);i===t&&r.push(o)}}return r},difference:Cr,unzip:Hr,transpose:Hr,zip:Qr,object:function(n,r){for(var t={},e=0,u=Y(n);e<u;e++)r?t[n[e]]=r[e]:t[n[e][0]]=n[e][1];return t},range:function(n,r,t){null==r&&(r=n||0,n=0),t||(t=r<n?-1:1);for(var e=Math.max(Math.ceil((r-n)/t),0),u=Array(e),o=0;o<e;o++,n+=t)u[o]=n;return u},chunk:function(n,r){if(null==r||r<1)return[];for(var t=[],e=0,u=n.length;e<u;)t.push(i.call(n,e,e+=r));return t},mixin:Yr,default:tn});return Zr._=Zr,Zr}));;/*!
* jQuery UI Touch Punch 0.2.3
*
* Copyright 2011�2014, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);;(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],function($){return factory($)})}else if(typeof module==="object"&&typeof module.exports==="object"){exports=factory(require("jquery"))}else{factory(jQuery)}})(function($){$.easing.jswing=$.easing.swing;var pow=Math.pow,sqrt=Math.sqrt,sin=Math.sin,cos=Math.cos,PI=Math.PI,c1=1.70158,c2=c1*1.525,c3=c1+1,c4=2*PI/3,c5=2*PI/4.5;function bounceOut(x){var n1=7.5625,d1=2.75;if(x<1/d1){return n1*x*x}else if(x<2/d1){return n1*(x-=1.5/d1)*x+.75}else if(x<2.5/d1){return n1*(x-=2.25/d1)*x+.9375}else{return n1*(x-=2.625/d1)*x+.984375}}$.extend($.easing,{def:"easeOutQuad",swing:function(x){return $.easing[$.easing.def](x)},easeInQuad:function(x){return x*x},easeOutQuad:function(x){return 1-(1-x)*(1-x)},easeInOutQuad:function(x){return x<.5?2*x*x:1-pow(-2*x+2,2)/2},easeInCubic:function(x){return x*x*x},easeOutCubic:function(x){return 1-pow(1-x,3)},easeInOutCubic:function(x){return x<.5?4*x*x*x:1-pow(-2*x+2,3)/2},easeInQuart:function(x){return x*x*x*x},easeOutQuart:function(x){return 1-pow(1-x,4)},easeInOutQuart:function(x){return x<.5?8*x*x*x*x:1-pow(-2*x+2,4)/2},easeInQuint:function(x){return x*x*x*x*x},easeOutQuint:function(x){return 1-pow(1-x,5)},easeInOutQuint:function(x){return x<.5?16*x*x*x*x*x:1-pow(-2*x+2,5)/2},easeInSine:function(x){return 1-cos(x*PI/2)},easeOutSine:function(x){return sin(x*PI/2)},easeInOutSine:function(x){return-(cos(PI*x)-1)/2},easeInExpo:function(x){return x===0?0:pow(2,10*x-10)},easeOutExpo:function(x){return x===1?1:1-pow(2,-10*x)},easeInOutExpo:function(x){return x===0?0:x===1?1:x<.5?pow(2,20*x-10)/2:(2-pow(2,-20*x+10))/2},easeInCirc:function(x){return 1-sqrt(1-pow(x,2))},easeOutCirc:function(x){return sqrt(1-pow(x-1,2))},easeInOutCirc:function(x){return x<.5?(1-sqrt(1-pow(2*x,2)))/2:(sqrt(1-pow(-2*x+2,2))+1)/2},easeInElastic:function(x){return x===0?0:x===1?1:-pow(2,10*x-10)*sin((x*10-10.75)*c4)},easeOutElastic:function(x){return x===0?0:x===1?1:pow(2,-10*x)*sin((x*10-.75)*c4)+1},easeInOutElastic:function(x){return x===0?0:x===1?1:x<.5?-(pow(2,20*x-10)*sin((20*x-11.125)*c5))/2:pow(2,-20*x+10)*sin((20*x-11.125)*c5)/2+1},easeInBack:function(x){return c3*x*x*x-c1*x*x},easeOutBack:function(x){return 1+c3*pow(x-1,3)+c1*pow(x-1,2)},easeInOutBack:function(x){return x<.5?pow(2*x,2)*((c2+1)*2*x-c2)/2:(pow(2*x-2,2)*((c2+1)*(x*2-2)+c2)+2)/2},easeInBounce:function(x){return 1-bounceOut(1-x)},easeOutBounce:bounceOut,easeInOutBounce:function(x){return x<.5?(1-bounceOut(1-2*x))/2:(1+bounceOut(2*x-1))/2}})});;;(function(factory){'use strict';if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else if(typeof module!=='undefined'&&module.exports){module.exports=factory(require('jquery'))}else{factory(jQuery)}})(function($){'use strict';var $scrollTo=$.scrollTo=function(target,duration,settings){return $(window).scrollTo(target,duration,settings)};$scrollTo.defaults={axis:'xy',duration:0,limit:true};function isWin(elem){return!elem.nodeName||$.inArray(elem.nodeName.toLowerCase(),['iframe','#document','html','body'])!==-1}function isFunction(obj){return typeof obj==='function'}$.fn.scrollTo=function(target,duration,settings){if(typeof duration==='object'){settings=duration;duration=0}if(typeof settings==='function'){settings={onAfter:settings}}if(target==='max'){target=9e9}settings=$.extend({},$scrollTo.defaults,settings);duration=duration||settings.duration;var queue=settings.queue&&settings.axis.length>1;if(queue){duration/=2}settings.offset=both(settings.offset);settings.over=both(settings.over);return this.each(function(){if(target===null){return}var win=isWin(this),elem=win?this.contentWindow||window:this,$elem=$(elem),targ=target,attr={},toff;switch(typeof targ){case 'number':case 'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=win?$(targ):$(targ,elem);case 'object':if(targ.length===0){return}if(targ.is||targ.style){toff=(targ=$(targ)).offset()}}var offset=isFunction(settings.offset)&&settings.offset(elem,targ)||settings.offset;$.each(settings.axis.split(''),function(i,axis){var Pos=axis==='x'?'Left':'Top',pos=Pos.toLowerCase(),key='scroll'+Pos,prev=$elem[key](),max=$scrollTo.max(elem,axis);if(toff){attr[key]=toff[pos]+(win?0:prev-$elem.offset()[pos]);if(settings.margin){attr[key]-=parseInt(targ.css('margin'+Pos),10)||0;attr[key]-=parseInt(targ.css('border'+Pos+'Width'),10)||0}attr[key]+=offset[pos]||0;if(settings.over[pos]){attr[key]+=targ[axis==='x'?'width':'height']()*settings.over[pos]}}else{var val=targ[pos];attr[key]=val.slice&&val.slice(-1)==='%'?parseFloat(val)/100*max:val}if(settings.limit&&/^\d+$/.test(attr[key])){attr[key]=attr[key]<=0?0:Math.min(attr[key],max)}if(!i&&settings.axis.length>1){if(prev===attr[key]){attr={}}else if(queue){animate(settings.onAfterFirst);attr={}}}});animate(settings.onAfter);function animate(callback){var opts=$.extend({},settings,{queue:true,duration:duration,complete:callback&&function(){callback.call(elem,targ,settings)}});$elem.animate(attr,opts)}})};$scrollTo.max=function(elem,axis){var Dim=axis==='x'?'Width':'Height',scroll='scroll'+Dim;if(!isWin(elem)){return elem[scroll]-$(elem)[Dim.toLowerCase()]()}var size='client'+Dim,doc=elem.ownerDocument||elem.document,html=doc.documentElement,body=doc.body;return Math.max(html[scroll],body[scroll])-Math.min(html[size],body[size])};function both(val){return isFunction(val)||$.isPlainObject(val)?val:{top:val,left:val}}$.Tween.propHooks.scrollLeft=$.Tween.propHooks.scrollTop={get:function(t){return $(t.elem)[t.prop]()},set:function(t){var curr=this.get(t);if(t.options.interrupt&&t._last&&t._last!==curr){return $(t.elem).stop()}var next=Math.round(t.now);if(curr!==next){$(t.elem)[t.prop](next);t._last=this.get(t)}}};return $scrollTo});;(function(window){"use strict";var CanvasLoader=function(id,opt){if(typeof(opt)=="undefined"){opt={};}
this.init(id,opt);},p=CanvasLoader.prototype,engine,engines=["canvas","vml"],shapes=["oval","spiral","square","rect","roundRect"],cRX=/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,ie8=navigator.appVersion.indexOf("MSIE")!==-1&&parseFloat(navigator.appVersion.split("MSIE")[1])===8?true:false,canSup=!!document.createElement('canvas').getContext,safeDensity=40,safeVML=true,addEl=function(tag,par,opt){var el=document.createElement(tag),n;for(n in opt){el[n]=opt[n];}
if(par!=null&&typeof(par)!=="undefined"){par.appendChild(el);}
return el;},setCSS=function(el,opt){for(var n in opt){el.style[n]=opt[n];}
return el;},setAttr=function(el,opt){for(var n in opt){el.setAttribute(n,opt[n]);}
return el;},transCon=function(c,x,y,r){c.save();c.translate(x,y);c.rotate(r);c.translate(-x,-y);c.beginPath();};p.init=function(pId,opt){if(typeof(opt.safeVML)==="boolean"){safeVML=opt.safeVML;}
try{if(document.getElementById(pId)!==undefined){this.mum=document.getElementById(pId);}else{this.mum=document.body;}}catch(error){this.mum=document.body;}
opt.id=typeof(opt.id)!=="undefined"?opt.id:"canvasLoader";this.cont=addEl("div",this.mum,{id:opt.id});if(canSup){engine=engines[0];this.can=addEl("canvas",this.cont);this.con=this.can.getContext("2d");this.cCan=setCSS(addEl("canvas",this.cont),{display:"none"});this.cCon=this.cCan.getContext("2d");}else{engine=engines[1];if(typeof(CanvasLoader.vmlSheet)==="undefined"){document.getElementsByTagName("head")[0].appendChild(addEl("style"));CanvasLoader.vmlSheet=document.styleSheets[document.styleSheets.length-1];var a=["group","oval","roundrect","fill"],n;for(var n=0;n<a.length;++n){CanvasLoader.vmlSheet.addRule(a[n],"behavior:url(#default#VML); position:absolute;");}}
this.vml=addEl("group",this.cont);}
this.setColor(this.color);this.draw();setCSS(this.cont,{display:"none"});};p.cont={};p.can={};p.con={};p.cCan={};p.cCon={};p.timer={};p.activeId=0;p.diameter=40;p.setDiameter=function(diameter){this.diameter=Math.round(Math.abs(diameter));this.redraw();};p.getDiameter=function(){return this.diameter;};p.cRGB={};p.color="#000000";p.setColor=function(color){this.color=cRX.test(color)?color:"#000000";this.cRGB=this.getRGB(this.color);this.redraw();};p.getColor=function(){return this.color;};p.shape=shapes[0];p.setShape=function(shape){var n;for(n in shapes){if(shape===shapes[n]){this.shape=shape;this.redraw();break;}}};p.getShape=function(){return this.shape;};p.density=40;p.setDensity=function(density){if(safeVML&&engine===engines[1]){this.density=Math.round(Math.abs(density))<=safeDensity?Math.round(Math.abs(density)):safeDensity;}else{this.density=Math.round(Math.abs(density));}
if(this.density>360){this.density=360;}
this.activeId=0;this.redraw();};p.getDensity=function(){return this.density;};p.range=1.3;p.setRange=function(range){this.range=Math.abs(range);this.redraw();};p.getRange=function(){return this.range;};p.speed=2;p.setSpeed=function(speed){this.speed=Math.round(Math.abs(speed));};p.getSpeed=function(){return this.speed;};p.fps=24;p.setFPS=function(fps){this.fps=Math.round(Math.abs(fps));this.reset();};p.getFPS=function(){return this.fps;};p.getRGB=function(c){c=c.charAt(0)==="#"?c.substring(1,7):c;return{r:parseInt(c.substring(0,2),16),g:parseInt(c.substring(2,4),16),b:parseInt(c.substring(4,6),16)};};p.draw=function(){var i=0,size,w,h,x,y,ang,rads,rad,de=this.density,animBits=Math.round(de*this.range),bitMod,minBitMod=0,s,g,sh,f,d=1000,arc=0,c=this.cCon,di=this.diameter,e=0.47;if(engine===engines[0]){c.clearRect(0,0,d,d);setAttr(this.can,{width:di,height:di});setAttr(this.cCan,{width:di,height:di});while(i<de){bitMod=i<=animBits?1-((1-minBitMod)/animBits*i):bitMod=minBitMod;ang=270-360/de*i;rads=ang/180*Math.PI;c.fillStyle="rgba("+this.cRGB.r+","+this.cRGB.g+","+this.cRGB.b+","+bitMod.toString()+")";switch(this.shape){case shapes[0]:case shapes[1]:size=di*0.07;x=di*e+Math.cos(rads)*(di*e-size)-di*e;y=di*e+Math.sin(rads)*(di*e-size)-di*e;c.beginPath();if(this.shape===shapes[1]){c.arc(di*0.5+x,di*0.5+y,size*bitMod,0,Math.PI*2,false);}else{c.arc(di*0.5+x,di*0.5+y,size,0,Math.PI*2,false);}
break;case shapes[2]:size=di*0.12;x=Math.cos(rads)*(di*e-size)+di*0.5;y=Math.sin(rads)*(di*e-size)+di*0.5;transCon(c,x,y,rads);c.fillRect(x,y-size*0.5,size,size);break;case shapes[3]:case shapes[4]:w=di*0.3;h=w*0.27;x=Math.cos(rads)*(h+(di-h)*0.13)+di*0.5;y=Math.sin(rads)*(h+(di-h)*0.13)+di*0.5;transCon(c,x,y,rads);if(this.shape===shapes[3]){c.fillRect(x,y-h*0.5,w,h);}else{rad=h*0.55;c.moveTo(x+rad,y-h*0.5);c.lineTo(x+w-rad,y-h*0.5);c.quadraticCurveTo(x+w,y-h*0.5,x+w,y-h*0.5+rad);c.lineTo(x+w,y-h*0.5+h-rad);c.quadraticCurveTo(x+w,y-h*0.5+h,x+w-rad,y-h*0.5+h);c.lineTo(x+rad,y-h*0.5+h);c.quadraticCurveTo(x,y-h*0.5+h,x,y-h*0.5+h-rad);c.lineTo(x,y-h*0.5+rad);c.quadraticCurveTo(x,y-h*0.5,x+rad,y-h*0.5);}
break;}
c.closePath();c.fill();c.restore();++i;}}else{setCSS(this.cont,{width:di,height:di});setCSS(this.vml,{width:di,height:di});switch(this.shape){case shapes[0]:case shapes[1]:sh="oval";size=d*0.14;break;case shapes[2]:sh="roundrect";size=d*0.12;break;case shapes[3]:case shapes[4]:sh="roundrect";size=d*0.3;break;}
w=h=size;x=d*0.5-h;y=-h*0.5;while(i<de){bitMod=i<=animBits?1-((1-minBitMod)/animBits*i):bitMod=minBitMod;ang=270-360/de*i;switch(this.shape){case shapes[1]:w=h=size*bitMod;x=d*0.5-size*0.5-size*bitMod*0.5;y=(size-size*bitMod)*0.5;break;case shapes[0]:case shapes[2]:if(ie8){y=0;if(this.shape===shapes[2]){x=d*0.5-h*0.5;}}
break;case shapes[3]:case shapes[4]:w=size*0.95;h=w*0.28;if(ie8){x=0;y=d*0.5-h*0.5;}else{x=d*0.5-w;y=-h*0.5;}
arc=this.shape===shapes[4]?0.6:0;break;}
g=setAttr(setCSS(addEl("group",this.vml),{width:d,height:d,rotation:ang}),{coordsize:d+","+d,coordorigin:-d*0.5+","+(-d*0.5)});s=setCSS(addEl(sh,g,{stroked:false,arcSize:arc}),{width:w,height:h,top:y,left:x});f=addEl("fill",s,{color:this.color,opacity:bitMod});++i;}}
this.tick(true);};p.clean=function(){if(engine===engines[0]){this.con.clearRect(0,0,1000,1000);}else{var v=this.vml;if(v.hasChildNodes()){while(v.childNodes.length>=1){v.removeChild(v.firstChild);}}}};p.redraw=function(){this.clean();this.draw();};p.reset=function(){if(typeof(this.timer)==="number"){this.hide();this.show();}};p.tick=function(init){var c=this.con,di=this.diameter;if(!init){this.activeId+=360/this.density*this.speed;}
if(engine===engines[0]){c.clearRect(0,0,di,di);transCon(c,di*0.5,di*0.5,this.activeId/180*Math.PI);c.drawImage(this.cCan,0,0,di,di);c.restore();}else{if(this.activeId>=360){this.activeId-=360;}
setCSS(this.vml,{rotation:this.activeId});}};p.show=function(){if(typeof(this.timer)!=="number"){var t=this;this.timer=self.setInterval(function(){t.tick();},Math.round(1000/this.fps));setCSS(this.cont,{display:"block"});}};p.hide=function(){if(typeof(this.timer)==="number"){clearInterval(this.timer);delete this.timer;setCSS(this.cont,{display:"none"});}};p.kill=function(){var c=this.cont;if(typeof(this.timer)==="number"){this.hide();}
if(engine===engines[0]){c.removeChild(this.can);c.removeChild(this.cCan);}else{c.removeChild(this.vml);}
var n;for(n in this){delete this[n];}};window.CanvasLoader=CanvasLoader;}(window));;;(function($,window,document,undefined){jQuery.fn.cssAnimate=function(transforms,time,easing,onAnimateComplete){if(typeof time!='number'){onAnimateComplete=easing;easing=time;time=400;}
if(typeof easing=='function'){onAnimateComplete=easing;easing='';}
return this.each(function(){if(jQuery.fn.cssAnimate.hasTransitions){var transitionEnd="transitionend",transitions='',i=0;var transEndEventNames={"WebkitTransition":"webkitTransitionEnd","MozTransition":"transitionend","transition":"transitionend"};transitionEnd=transEndEventNames[Modernizr.prefixed('transition')];this.addEventListener(transitionEnd,function(event){this.removeEventListener(transitionEnd,arguments.callee,false);$(this).css({'-webkit-transition':'','-moz-transition':'','-o-transition':'','-ms-transition':'','transition':''});if(typeof onAnimateComplete=='function'){onAnimateComplete();}},false);if(typeof easing=='undefined'||easing=='swing'){easing='ease';}
for(var index in transforms){if(transitions!=''){transitions+=', ';}
transitions+=index+' '+time+'ms '+easing}
$(this).css({'-webkit-transition':transitions,'-moz-transition':transitions,'-o-transition':transitions,'-ms-transition':transitions,'transition':transitions});$(this).css(transforms);}
else{if(easing!='linear'){easing='swing';}
if(typeof onAnimateComplete!='function'){onAnimationComplete=function(){};}
$(this).animate(transforms,time,easing,onAnimateComplete);}});};jQuery.fn.cssAnimate.hasTransitions=false;if(typeof Modernizr!='undefined'&&typeof Modernizr.csstransitions!='undefined'){jQuery.fn.cssAnimate.hasTransitions=Modernizr.csstransitions;}
else{var s=document.createElement('p').style;jQuery.fn.cssAnimate.hasTransitions='transition'in s||'WebkitTransition'in s||'MozTransition'in s||'msTransition'in s||'OTransition'in s;}})(jQuery,window,document);;MODAL={OpenedModal:[],ResizeObserver:null,INIT:{Init:function(){MODAL.BINDINGS.BindWindowResize()}},BINDINGS:{BindWindowResize:function(){$(window).on("resize onorientationchange",function(){MODAL.OpenedModal.forEach(function(n){MODAL.DOM.ResizeModal(n)})})}},DOM:{CloseModal:function(n){$(n).dialog("close")},OpenModal:function(n){var i=n.modalElementId,t=$(i),r=t.find(".modal-content")[0],o;if(typeof n.beforeOpen!="undefined"&&n.beforeOpen(),$(".ui-dialog").find(i).length){t.dialog("open");return}var u=n.width,f=n.height,e=n.windowBuffer;typeof u!="undefined"&&t.data("initialWidth",u);typeof f!="undefined"&&t.data("initialHeight",f);typeof e!="undefined"&&t.data("windowBuffer",e);t.find(".modal-content-wrapper").length||t.find(".modal-content").wrap("<div class='modal-content-wrapper'><\/div>");t.find("input").length||t.find(".modal-content").prop("autofocus",!0);o=t.dialog({height:"auto",minHeight:50,width:"auto",autoOpen:!1,resizable:!1,modal:!0,appendTo:"#site-container",open:function(){if(MODAL.OpenedModal.push(i),typeof n.open=="function"&&n.open(),MODAL.DOM.ResizeModal(i),typeof ResizeObserver!="undefined"){var u=0;MODAL.ResizeObserver=new ResizeObserver(n=>{var t=n[0].borderBoxSize;if(t){const n=t[0].blockSize;Math.abs(n-u)>10&&(u=n,MODAL.DOM.ResizeModal(i))}});MODAL.ResizeObserver.observe(r,{box:"border-box"})}else MODAL.FUNCTIONS.OnElementHeightChange(r,function(){MODAL.DOM.ResizeModal(i)});if(!n.hideCloseButton)$(".ui-widget-overlay").on("click",function(){$(".ui-dialog").find(i).length&&t.dialog("close")})},beforeClose:function(){typeof n.beforeClose=="function"&&n.beforeClose();MODAL.ResizeObserver!=null&&MODAL.ResizeObserver.unobserve(r)},close:function(){MODAL.OpenedModal.splice(MODAL.OpenedModal.indexOf(i),1);typeof n.close=="function"&&n.close();clearTimeout(r.onElementHeightChangeTimer);t.dialog("destroy")},show:{effect:"fadeIn",duration:400},hide:{effect:"fadeOut",duration:400}});o.dialog("open");t.closest(".ui-dialog").find(".modal-close").length||n.hideCloseButton||t.closest(".ui-dialog").append("<a href='javascript:void(0);' class='modal-close' title='Close this modal window' onClick='$(\""+i+"\").dialog(\"close\");'><i id='closeModalIcon' class='icon-cancel'><\/i><\/a>")},ResizeModal:function(n){var t=$(n);if(t.dialog("instance")&&t.dialog("isOpen")){var r=t.data("initialHeight"),u=t.data("initialWidth"),i=t.data("windowBuffer")||60,c=typeof u!="undefined"?$(window).width()>u+i?u:$(window).width()-i:$(window).width()>700?700:"auto",l=typeof r!="undefined"?$(window).height()>r+i?r:$(window).height()-i:"auto";t.dialog("option","width",c);t.dialog("option","height",l);var f=t.find(".modal-wrapper"),e=t.find(".modal-content-wrapper"),a=t.find(".modal-header").outerHeight(!0)||0,v=t.find(".modal-buttons").not(".modal-content .modal-buttons").outerHeight(!0)||0,o=$(window).height(),y=$(window).width(),p=y-i,w=t.css({"max-width":p}).find(".modal-content")[0].scrollHeight,s="auto",h=f.outerHeight(!0)-f.height()+a+v,b=w+h;b+i>=o&&(s=o-i-h+"px",e.addClass("scrollable"));e.css("height",s)}}},FUNCTIONS:{OnElementHeightChange:function(n,t){var r=n.clientHeight,i;(function u(){i=n.clientHeight;r!=i&&t();r=i;n.onElementHeightChangeTimer&&clearTimeout(n.onElementHeightChangeTimer);n.onElementHeightChangeTimer=setTimeout(u,250)})()}}};$(document).ready(function(){MODAL.INIT.Init()});;if(typeof JSON!=='object'){JSON={};}
(function(){'use strict';function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case 'string':return quote(value);case 'number':return isFinite(value)?String(value):'null';case 'boolean':case 'null':return String(value);case 'object':if(!value){return 'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return '\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());;/*!
* jquery.customSelect() - v0.4.1
* http://adam.co/lab/jquery/customselect/
* 2013-05-13
*
* Copyright 2013 Adam Coulombe
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @license http://www.gnu.org/licenses/gpl.html GPL2 License
*/(function($){'use strict';$.fn.extend({customSelect:function(options){if(typeof document.body.style.maxHeight==='undefined'){return this;}
var defaults={customClass:'customSelect',mapClass:true,mapStyle:true},options=$.extend(defaults,options),prefix=options.customClass,changed=function($select,customSelectSpan){var currentSelected=$select.find(':selected'),customSelectSpanInner=customSelectSpan.children(':first'),html=currentSelected.html()||'&nbsp;';customSelectSpanInner.html(html);if(currentSelected.attr('disabled')){customSelectSpan.addClass(getClass('DisabledOption'));}else{customSelectSpan.removeClass(getClass('DisabledOption'));}
setTimeout(function(){customSelectSpan.removeClass(getClass('Open'));$(document).off('mouseup.'+getClass('Open'));},60);},getClass=function(suffix){return prefix+suffix;};return this.each(function(){var $select=$(this),customSelectInnerSpan=$('<span />').addClass(getClass('Inner')),customSelectSpan=$('<span />');if(!$select.hasClass('hasCustomSelect')){$select.after(customSelectSpan.append(customSelectInnerSpan));customSelectSpan.addClass(prefix);if(options.mapClass){customSelectSpan.addClass($select.attr('class'));}
if(options.mapStyle){customSelectSpan.attr('style',$select.attr('style'));}
$select.addClass('hasCustomSelect').on('update',function(){changed($select,customSelectSpan);var selectBoxWidth=parseInt($select.outerWidth(),10)-
(parseInt(customSelectSpan.outerWidth(),10)-
parseInt(customSelectSpan.width(),10));customSelectSpan.css({display:'inline-block'});var selectBoxHeight=customSelectSpan.outerHeight();if($select.attr('disabled')){customSelectSpan.addClass(getClass('Disabled'));}else{customSelectSpan.removeClass(getClass('Disabled'));}
customSelectInnerSpan.css({'padding-right':'30px',display:'inline-block'});$select.css({'-webkit-appearance':'menulist-button',width:"100%",position:'absolute',opacity:0,zIndex:"3",height:$select.closest("p").height()===0?"25px":$select.closest("p").height(),fontSize:customSelectSpan.css('font-size')});}).on('change',function(){customSelectSpan.addClass(getClass('Changed'));changed($select,customSelectSpan);}).on('keyup',function(e){if(!customSelectSpan.hasClass(getClass('Open'))){$select.trigger("blur");$select.trigger("focus");}else{if(e.which==13||e.which==27){changed($select,customSelectSpan);}}}).on('mousedown',function(e){customSelectSpan.removeClass(getClass('Changed'));}).on('mouseup',function(e){if(!customSelectSpan.hasClass(getClass('Open'))){if($('.'+getClass('Open')).not(customSelectSpan).length>0&&typeof InstallTrigger!=='undefined'){$select.trigger("focus");}else{customSelectSpan.addClass(getClass('Open'));e.stopPropagation();$(document).one('mouseup.'+getClass('Open'),function(e){if(e.target!=$select.get(0)&&$.inArray(e.target,$select.find('*').get())<0){$select.trigger("blur");}else{changed($select,customSelectSpan);}});}}}).on("focus",function(){customSelectSpan.removeClass(getClass('Changed')).addClass(getClass('Focus'));}).on("blur",function(){customSelectSpan.removeClass(getClass('Focus')+' '+getClass('Open'));}).on("mouseenter",function(){customSelectSpan.addClass(getClass('Hover'));}).on("mouseleave",function(){customSelectSpan.removeClass(getClass('Hover'));}).trigger('update');}});}});})(jQuery);;var EventRecorder=function(n,t,i){var r={},s=null,a=-1,v=!1,y=2147483647,tt=3e3,f={record:!0,debug:!1,escPlayback:!1},it=function(n,t,i){var r=parent&&parent.EVENTPLAYBACK&&parent.EVENTPLAYBACK.playback;typeof n=="boolean"&&(f.record=n);typeof t=="boolean"&&(f.debug=t);typeof i=="boolean"&&(f.escPlayback=i);f.record&&!r&&st()},rt=function(){f.record&&(s=Date.now(),e(null,null,null,null,null,null,null,null,null,o(s),null,null,null),u("recording started at "+s),v=!0,ot())},ut=function(){var t=Date.now(),n;u("recording stopped");v=!1;e(null,null,null,null,null,null,null,null,null,o(t),null,null,null);r.Filesize=AVL.UTILITIES.FUNCTIONS.GetPhysicalSize(h());(r.Inactivity==null||r.Inactivity<0)&&(r.Inactivity=0);n=t-s;r.Duration=n>y?y:n;r.Engagement=r.Duration-r.Inactivity;ft()},ft=function(){r.Active=!1;r.Events=[];f.record&&r.Unloadable&&ct()},h=function(){return JSON.stringify(r)},et=function(t){if(t.length>0)switch(t[0]){case"tagRecording":typeof r.Tags=="undefined"&&(r.Tags="");switch(typeof t[1]){case"object":n.each(t[1],function(n,t){var i=t==null||t==""?"":":"+t,u=n+i,f=r.Tags==""?"":",";r.Tags+=f+u});break;case"string":r.Tags+=","+t[1]}u(r.Tags)}},ot=function(){if(f.record){i.onload=function(){wgxpath.install()};r.Unloadable?(i.addEventListener("beforeunload",function(n){c(n)}),i.addEventListener("pagehide",function(n){c(n)}),i.addEventListener("unload",function(n){c(n)}),u("Window unload events bound.")):(r.Active=!1,u("Window unload events not bound!"));n(i).on("resize",function(n){n.timeStamp=Date.now();p(n)});n(t).on("resize mousedown mouseup mousemove dblclick keydown keyup scroll change touchstart touchmove touchend touchcancel",function(n){if(wt(n)){n.timeStamp=Date.now();switch(n.type){case"mousedown":case"mouseup":n.which==1&&p(n);break;default:p(n)}}});var e=n("#slideout-content").length==0?n(t):n("#slideout-content");e.on("scroll",function(n){n.timeStamp=Date.now();p(n)})}},p=function(t){if(v&&f.record)switch(t.type){case"mousemove":case"mousedown":case"mouseup":case"dblclick":(r.Events.length==0||t.type!="mousemove"||t.type=="mousemove"&&r.Events[r.Events.length-1].Mx!=t.pageX&&r.Events[r.Events.length-1].My!=t.pageY)&&(at(n(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t))),t.type=="mouseup"&&(e(t.type,null,t.pageX,t.pageY,n(i).scrollLeft(),n(i).scrollTop(),null,n(i).width(),n(i).height(),o(Date.now()),d(n(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t))),AVL.UTILITIES.FUNCTIONS.GetElementXPath(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t)),null),t.type="click",r.Clicks==null?r.Clicks=1:r.Clicks++),e(t.type,null,t.pageX,t.pageY,n(i).scrollLeft(),n(i).scrollTop(),null,n(i).width(),n(i).height(),o(Date.now()),null,AVL.UTILITIES.FUNCTIONS.GetElementXPath(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t)),null));break;case"keydown":case"keyup":if(typeof i.overrideERMV!="undefined"&&i.overrideERMV===!0)break;var u=t.which?t.which:t.keyCode;e(t.type,u,null,null,n(i).scrollLeft(),n(i).scrollTop(),null,n(i).width(),n(i).height(),o(Date.now()),null,AVL.UTILITIES.FUNCTIONS.GetElementXPath(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t)),n(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t)).val());break;case"change":e(t.type,null,null,null,n(i).scrollLeft(),n(i).scrollTop(),null,n(i).width(),n(i).height(),o(Date.now()),d(n(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t))),AVL.UTILITIES.FUNCTIONS.GetElementXPath(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t)),n(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t)).val());break;case"resize":w();e(t.type,null,null,null,n(i).scrollLeft(),n(i).scrollTop(),null,n(i).width(),n(i).height(),o(Date.now()),null,AVL.UTILITIES.FUNCTIONS.GetElementXPath(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t)),null);break;case"scroll":w();e(t.type,t.pageX,t.pageY,null,n(i).scrollLeft(),n(i).scrollTop(),"window",n(i).width(),n(i).height(),o(Date.now()),null,AVL.UTILITIES.FUNCTIONS.GetElementXPath(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t)),null)}},e=function(n,t,i,f,e,o,s,h,c,l,a,v,y){var p={Et:n,Kc:t,Mx:i,My:f,Sx:e,Sy:o,St:s,Ww:h,Wh:c,Ts:l,Tg:a,Tr:v,Vl:y};pt(l,tt);r.Events.push(p);u(p)},u=function(n){f.debug&&console.log(n)},c=function(n){c._hasUnloaded||(c._hasUnloaded=!0,ut(),u(n.type+" event triggered stopRecording()."))},st=function(){r={Active:!0,Application:"",Belowfold:0,Brand:0,Browsername:"",Browserversion:"",Clicks:0,Colordepth:"",Cookiesenabled:!1,Country:"",Countrycode:"",Customerid:"",Date:l(),Devicetype:"",Documentheight:0,Duration:0,Engagement:0,Error:0,Events:"",Filesize:"",Inactivity:0,Ip:"",Isp:"",Javaenabled:!1,Language:"",Lastmodified:l(),Lastvisit:l(),Latitude:"",Loadtime:0,Longitude:"",Osname:"",Osversion:"",Page:"",Pagetitle:"",Referrer:"",Region:"",Regioncode:"",Screenheight:0,Screenres:"",Screenwidth:0,Scrollreach:0,Servertime:0,Sessionid:"",Sourcecode:"",Tags:"",Timezone:"",Unscrolled:0,Url:"",Useragent:"",Utmcampaign:"",Utmsource:"",Utmmedium:"",Utmcontent:"",Viewportheight:"",Viewportwidth:"",Visitortype:"",Browserfeatures:{Applicationcache:"",Audio:"",Backgroundsize:"",Borderimage:"",Canvas:"",Canvastext:"",Cssanimations:"",Csscolumns:"",Cssgradients:"",Cssreflections:"",Csstransforms:"",Csstransforms3d:"",Csstransitions:"",Borderradius:"",Boxshadow:"",Draganddrop:"",Flexbox:"",Fontface:"",Geolocation:"",Generatedcontent:"",Hashchange:"",History:"",Hsla:"",Indexeddb:"",Inlinesvg:"",Localstorage:"",Multiplebgs:"",Opacity:"",Postmessage:"",Rgba:"",Sessionstorage:"",Smil:"",Svg:"",Svgclippaths:"",Textshadow:"",Touch:"",Unloadable:0,Video:"",Webgl:"",Websockets:"",websqldatabase:"",webworkers:""}};lt();yt();ht();u(r);rt()},ht=function(){function i(n){a=parseInt(n.d);r.Servertime=(new Date).getTime()-t;u(r.Servertime)}function f(){r.Servertime=(new Date).getTime()-t;u("failed save!")}var t=(new Date).getTime();!0&&n.ajax({type:"POST","async":!0,cache:!1,url:nt()+"/AddRecording",contentType:"application/json; charset=utf-8",data:JSON.stringify({jsonRequest:h()}),dataType:"json",success:i,error:f})},ct=function(){function r(n){u(n)}function f(n){u(n.status+" \n\r "+n.statusText+"\n\r"+n.responseText)}var t=nt()+(a==-1?"/AddRecording":"/UpdateRecording"),i=a==-1?JSON.stringify({jsonRequest:h()}):JSON.stringify({id:a,jsonRequest:h()});!0&&n.ajax({type:"POST","async":!0,cache:!1,url:t,contentType:"application/json; charset=utf-8",data:i,dataType:"json",success:r,error:f})},lt=function(){var e=!0,o="ER_PV_"+g(),s="ER_RSID",u="ER_RLV",h="ER_RVT",t=AVL.UTILITIES.FUNCTIONS.GetCookie(s),f,n,i;t==undefined||t==null||t==""?(r.Sessionid=bt(),AVL.UTILITIES.FUNCTIONS.SetSessionCookie(s,r.Sessionid)):(r.Sessionid=t,e=!1);f=AVL.UTILITIES.FUNCTIONS.GetCookie(u);n=AVL.UTILITIES.FUNCTIONS.GetCookie(h);e||!b(f)||n==undefined||n==null||n==""?(i=AVL.UTILITIES.FUNCTIONS.GetCookie(o),b(i)?(r.Visitortype="returning",r.Lastvisit=i,AVL.UTILITIES.FUNCTIONS.SetSessionCookie(u,i)):(r.Visitortype="new",r.Lastvisit=k(),AVL.UTILITIES.FUNCTIONS.SetSessionCookie(u,k())),AVL.UTILITIES.FUNCTIONS.SetSessionCookie(h,r.Visitortype)):(r.Lastvisit=f,r.Visitortype=n);b(r.Lastvisit)||(r.Lastvisit=k());AVL.UTILITIES.FUNCTIONS.SetCookie(o,l(),360)},at=function(r){var f=r.scrollParent(),s=r.hasScroll(),h=!f.is(t)&&f.hasScroll(),u;if((s||h)&&(u=s?r:r.scrollParent(),!u.hasClass("scrollable-record"))){u.addClass("scrollable-record");u.on("scroll",function(t){v&&e(t.type,null,null,null,u.scrollLeft(),u.scrollTop(),"element",n(i).width(),n(i).height(),o(Date.now()),null,AVL.UTILITIES.FUNCTIONS.GetElementXPath(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t)),null)})}},w=function(){var h=n(i).height(),c=n("#slideout-content").length==0?n(t).height():n("#slideout-content")[0].scrollHeight,o=n("#slideout-content").length==0?n(i).scrollTop():n("#slideout-content").scrollTop(),e=c-h,l=Math.ceil(e-o),s=100,f;return e>0&&(s=parseInt((o/e*100).toFixed(0))),f={percent:s,unscrolled:l},(r.Scrollreach==null||r.Scrollreach<f.percent)&&(r.Scrollreach=f.percent),(r.Unscrolled==null||r.Unscrolled>f.unscrolled)&&(r.Unscrolled=Math.ceil(f.unscrolled)),u(r.Unscrolled+"/"+f.unscrolled+"px - "+r.Scrollreach+"/"+f.percent+"%"),f},vt=function(){return"onbeforeunload"in i||"onunload"in i||"onpagehide"in i},l=function(){return AVL.UTILITIES.FUNCTIONS.FormatDate(new Date)},yt=function(){var p="-",b=screen.width||0,k=screen.height||0,tt=b+" x "+k,it=navigator.appVersion||"",u=navigator.userAgent||"",o=navigator.appName||"",f=""+parseFloat(navigator.appVersion),a=parseInt(navigator.appVersion,10),d,e,c,h,v,nt,y,s;(e=u.indexOf("Opera"))!=-1?(o="Opera",f=u.substring(e+6),(e=u.indexOf("Version"))!=-1&&(f=u.substring(e+8))):(e=u.indexOf("MSIE"))!=-1?(o="Internet Explorer",f=u.substring(e+5)):(e=u.indexOf("Chrome"))!=-1?(o="Chrome",f=u.substring(e+7)):(e=u.indexOf("Safari"))!=-1?(o="Safari",f=u.substring(e+7),(e=u.indexOf("Version"))!=-1&&(f=u.substring(e+8))):(e=u.indexOf("Firefox"))!=-1?(o="Firefox",f=u.substring(e+8)):u.indexOf("Trident/")!=-1?(o="Internet Explorer",f=u.substring(u.indexOf("rv:")+3)):(d=u.lastIndexOf(" ")+1)<(e=u.lastIndexOf("/"))&&(o=u.substring(d,e),f=u.substring(e+1),o.toLowerCase()==o.toUpperCase()&&(o=navigator.appName||""));(c=f.indexOf(";"))!=-1&&(f=f.substring(0,c));(c=f.indexOf(" "))!=-1&&(f=f.substring(0,c));(c=f.indexOf(")"))!=-1&&(f=f.substring(0,c));a=parseInt(""+f,10);isNaN(a)&&(f=""+parseFloat(navigator.appVersion),a=parseInt(navigator.appVersion,10));typeof navigator.cookieEnabled!="undefined"||cookieEnabled||(t.cookie="testcookie",cookieEnabled=t.cookie.indexOf("testcookie")!=-1?!0:!1);h=p;v=[{s:"Windows 3.11",r:/Win16/},{s:"Windows 95",r:/(Windows 95|Win95|Windows_95)/},{s:"Windows ME",r:/(Win 9x 4.90|Windows ME)/},{s:"Windows 98",r:/(Windows 98|Win98)/},{s:"Windows CE",r:/Windows CE/},{s:"Windows 2000",r:/(Windows NT 5.0|Windows 2000)/},{s:"Windows XP",r:/(Windows NT 5.1|Windows XP)/},{s:"Windows Server 2003",r:/Windows NT 5.2/},{s:"Windows Vista",r:/Windows NT 6.0/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows NT 4.0",r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:"Windows ME",r:/Windows ME/},{s:"Android",r:/Android/},{s:"Open BSD",r:/OpenBSD/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"QNX",r:/QNX/},{s:"UNIX",r:/UNIX/},{s:"BeOS",r:/BeOS/},{s:"OS/2",r:/OS\/2/},{s:"Search Bot",r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}];for(nt in v)if(y=v[nt],y.r.test(u)){h=y.s;break}s=p;/Windows/.test(h)&&(s=/Windows (.*)/.exec(h)[1],h="Windows");switch(h){case"Mac OS X":s=/Mac OS X (10[\.\_\d]+)/.exec(u)[1];break;case"Android":s=/Android ([\.\_\d]+)/.exec(u)[1];break;case"iOS":s=/OS (\d+)_(\d+)_?(\d+)?/.exec(it);s=s[1]+"."+s[2]+"."+(s[3]|0)}typeof r.Tags=="undefined"&&(r.Tags="");r.Customerid=n("#avlCT").val()||"";r.Devicetype=AVL.UTILITIES.FUNCTIONS.GetDeviceType();r.Application=AVL.UTILITIES.FUNCTIONS.GetApplication();r.Date=l();r.Brand=AVL.UTILITIES.FUNCTIONS.GetAvlBrand();r.Lastmodified=t.lastModified||"";r.Loadtime=(new Date).getTime()-ERMV.ls;r.Url=t.URL||"";r.Page=AVL.UTILITIES.FUNCTIONS.GetFileNameNoParams(t.URL);r.Pagetitle=AVL.UTILITIES.FUNCTIONS.GetPageTitle();r.Error=AVL.UTILITIES.FUNCTIONS.IsErrorPage(t.URL);r.Duration=0;r.Language=navigator.language||"";r.Useragent=navigator.userAgent||"";r.Browsername=o||"";r.Browserversion=f||"";r.Osname=h||"";r.Osversion=s||"";r.Cookiesenabled=AVL.UTILITIES.FUNCTIONS.IsCookiesEnabled();r.Javaenabled=navigator.javaEnabled()||!1;r.Belowfold=n(t).height()-n(i).height();r.Documentheight=n(t).height();r.Scrollreach=w().percent;r.Unscrolled=w().unscrolled;r.Viewportheight=n(i).height();r.Viewportwidth=n(i).width();r.Unloadable=vt();r.Screenres=tt;r.Screenwidth=b;r.Screenheight=k;r.Colordepth=screen.colorDepth+" bit";r.Sourcecode=AVL.UTILITIES.FUNCTIONS.GetCookie(g()+"SourceCode","")||"";r.Utmcampaign=AVL.UTILITIES.FUNCTIONS.GetQuerystringParamByName(t.URL,"utm_campaign");r.Utmsource=AVL.UTILITIES.FUNCTIONS.GetQuerystringParamByName(t.URL,"utm_source");r.Utmmedium=AVL.UTILITIES.FUNCTIONS.GetQuerystringParamByName(t.URL,"utm_medium");r.Utmcontent=AVL.UTILITIES.FUNCTIONS.GetQuerystringParamByName(t.URL,"utm_content");r.Referrer=t.referrer||"";r.Events=[];r.Browserfeatures=AVL.UTILITIES.FUNCTIONS.GetBrowserFeatures()},b=function(n){return!(n==undefined||n==null||n==""||isNaN(new Date(n)))},k=function(){return AVL.UTILITIES.FUNCTIONS.FormatDate(new Date(1970,0,1,12))},o=function(n){return n-s},d=function(n){var t=n.attr("data-tagEvent"),i=null;return typeof t!="undefined"&&t!==!1&&(i=t),i},pt=function(n,t){if(r.Events.length>0){var i=n-r.Events[r.Events.length-1].Ts;i>t&&((r.Inactivity==null||r.Inactivity<0)&&(r.Inactivity=0),r.Inactivity+=i,r.Inactivity>y&&(r.Inactivity=y),u(n+" / "+r.Inactivity))}},wt=function(t){var i=n(AVL.UTILITIES.FUNCTIONS.GetEventTarget(t));return i.attr("data-recordingignore")!="true"&&i.closest("[data-recordingignore='true']").length==0},bt=function(){var n=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var i=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(t=="x"?i:i&7|8).toString(16)})},g=function(){var n="";switch(AVL.UTILITIES.FUNCTIONS.GetAvlBrand()){case"0":n="DM";break;case"4":n="OAS";break;case"5":n="CDB";break;case"12":n="TC";break;case"14":n="BB";break;case"16":n="BS"}return n},nt=function(){return"/EventRecorderWebService/EventRecorder.asmx"};return{init:it,push:et,getRecording:h}}(jQuery,document,window);$(document).ready(function(){typeof ERMV!="undefined"&&ERMV.on&&EventRecorder.init(!0,null,!1)});;