function IsValTrue(n){var t=["false","False",!1,0,undefined,null];return t.indexOf(n)===-1}function BindFlyoutMenuHover(){LoadFlyoutMenus()}function ConfigureAjax(){console.log("Ajax Configured.");$.ajaxSetup({cache:!1})}function LoadFlyoutMenus(){var n=amplify.store("flyoutmenudata");n===undefined?$.ajax({url:"/Common/GetFlyoutMenusJson",type:"GET",cache:!1,success:function(n){amplify.store("flyoutmenudata",n,{expires:6e5});FillFlyoutMenus(n)}}):FillFlyoutMenus(n)}function FillFlyoutMenus(n){var t,i,r;if(n.length>0)for(t=0;t<n.length;t++)i=n[t].Item1,r=n[t].Item2,$("#"+i).html(r)}function loadQueryResults(n,t){var i=$("#MainSearch").val();i.length==n.length&&$.get("/catalog/searchsuggestions",{q:n},function(i){i.length==0?bad_request_cache.push(n):suggestion_cache[n]=i;t(i);appendStoreLocationLink()})}function appendStoreLocationLink(){$(".tt-suggestion").hasClass("storelocation")||$(".tt-dataset-suggestions").append('<a href="#" onclick="event.preventDefault()" data-href-store="/store/changestore" data-toggle="modal" data-target="#baseModal"><div class="tt-suggestion tt-selectable storelocation"><strong class="tt-highlight">Find a Store<\/strong><\/div><\/a>');$(".tt-empty").addClass("tt-open");$(".tt-empty").show();$("a[data-toggle=modal][data-target]").click(function(n){const t=n.currentTarget&&n.currentTarget.getAttribute("data-href-store"),i=n.currentTarget&&n.currentTarget.getAttribute("data-target");t&&$(i).find(".modal-content").load(t)})}function ConfigureSearchAutocomplete(){$("#MainSearch").typeahead({hint:!0,minLength:2,highlight:!0},{name:"suggestions",matcher:function(){return!0},source:function(n,t,i){if(bad_request_cache.some(function(t){return startsWith(n,t)})){t([]);appendStoreLocationLink();return}if(suggestion_cache[n]){t(suggestion_cache[n]);appendStoreLocationLink();return}var r=JD.debounce(function(){loadQueryResults(n,i)},200);r()}})}function ConfigureResponsiveCatalog(){$("#list").click(function(n){n.preventDefault();SetListView(!0)});$("#grid").click(function(n){n.preventDefault();SetGridView(!0)});$(window).on("resize",function(){WidthChange()});WidthChange();$(".product-box img.lazy").lazyload({event:"catalog-view-change"})}function WidthChange(){$("#list").blur();$("#grid").blur();window.innerWidth<=991?SetGridView(!1):docCookies.getItem("list-view")=="grid"?SetGridView(!1):SetListView(!1)}function SetGridView(n){$(".product-box").removeClass("product-box-list");$("#list").removeClass("active");$("#grid").addClass("active");$('span[data-toggle="popover"]').data("placement","top");$(".product-box img.lazy").trigger("catalog-view-change");n&&docCookies.setItem("list-view","grid",null,"/")}function SetListView(n){$(".product-box").addClass("product-box-list");$("#list").addClass("active");$("#grid").removeClass("active");$('span[data-toggle="popover"]').data("placement","left");$(".product-box img.lazy").trigger("catalog-view-change");n&&docCookies.setItem("list-view","list",null,"/")}function ConfigureModalToggles(){$("a[data-toggle=modal][data-target]").click(function(n){const t=n.currentTarget&&n.currentTarget.getAttribute("data-href"),i=n.currentTarget&&n.currentTarget.getAttribute("data-target");t&&$(i).find(".modal-content").load(t,ConfigureModalToggles)})}function verticallyCenterModal(){var t=$(this),n=t.find(".modal-dialog");$(n).find(".modal-center").length&&(t.css("display","block"),n.css("margin-top",Math.max(0,($(window).height()-n.height())/2)))}function ConfigureModal(){$("body").on("hidden.bs.modal",".modal",function(n){$(n.target).removeData("bs.modal");$(n.target).find(".modal-content").html("")});$(".modal").on("show.bs.modal",verticallyCenterModal);$(window).on("resize",function(){$(".modal:visible").each(verticallyCenterModal)});$(ConfigureModalToggles)}function getScrollBarWidth(){var t=document.createElement("p"),n,r,i;return t.style.width="100%",t.style.height="200px",n=document.createElement("div"),n.style.position="absolute",n.style.top="0px",n.style.left="0px",n.style.visibility="hidden",n.style.width="200px",n.style.height="150px",n.style.overflow="hidden",n.appendChild(t),document.body.appendChild(n),r=t.offsetWidth,n.style.overflow="scroll",i=t.offsetWidth,r==i&&(i=n.clientWidth),document.body.removeChild(n),r-i}function ConfigureNotifications(){$(".messageBox").on("click","button",function(){$(this).parent().remove()})}function ConfigureImageLazyLoad(){$("img.lazy").lazyload({effect:"fadeIn",failure_limit:10,threshold:100})}function ConfigureDateTimeEditors(){$(".datePicker").each(function(){var n=$(this);n.datetimepicker({format:"m/d/Y",timepicker:!1,minDate:n.data("mindate"),maxDate:n.data("maxdate")})});$(".dateTimePicker").each(function(){var n=$(this);n.datetimepicker({format:"m/d/Y g:i A",formatTime:"g:i A",timepicker:!0,minDate:n.data("mindate"),maxDate:n.data("maxdate"),step:30})})}function ConfigurePopovers(){var n={placement:function(n,t){var i=$(t).offset();return i.left>515?"left":i.top<110?"bottom":"top"}};$('div[data-toggle="popover"]').popover(n);$(".attribute-tooltip").popover({content:function(){return $(this).find(".popover-content").html()},title:function(){return $(this).find(".popover-title").html()},html:!0});configureStoreAvailablityPopover()}function configureStoreAvailablityPopover(){if(storeCode!=""){if($(".store-availability:eq(0)").attr("data-toggle","popover").addClass("storePop"),!$("#basePopover").hasClass("in")){setTimeout(function(){$('.storePop[data-toggle="popover"]').popover("show");$(".popover").addClass("storePopover")},2e3);$(".storePop").on("shown.bs.popover",function(){setTimeout(function(){$(".storePopover.popover").fadeOut("slow",function(){})},5e3)})}$(".storePop .popover-title").css({"font-size":"16px"});$(".storePopover.popover").css({"margin-right":"15px","z-index":"1010"})}}function getQueryString(n){var i=new RegExp("(^|&)"+n+"=([^&]*)(&|$)","i"),t=window.location.search.substr(1).match(i);return t!=null?unescape(t[2]):null}function encodeAndSymbol(n){return n=n.replace(/\&/g,"%26"),n.replace(/#/g,"%23")}function geolocateStoreList(n){navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){loadStoreListByPosition(n,t)},geolocateStoreListFail)}function loadStoreListByPosition(n,t){clearStoreSearchError(n);var i=t.coords.latitude,r=t.coords.longitude,u=IsValTrue(n.find("#RegisterSelectStoreView").val()),f=IsValTrue(n.find("#SelectDefaultStoreView").val());n.find(".geolocate-stores").addClass("disabled");$.post("/Store/ChangeStore",{latitude:i,longitude:r,RegisterSelectStoreView:u,SelectDefaultStoreView:f},function(t){ajaxFormSubmitResponse(t,n)})}function geolocateStoreListFail(){var n=$(".search-store-error");n.removeClass("hidden");n.find(".error-message").text("We are unable to retrieve your location. Please check your browser settings.")}function reloadStoreListSearch(n){clearStoreSearchError(n);var t=n.find(".search-store-list-input").val(),i=IsValTrue(n.find("#RegisterSelectStoreView").val()),r=IsValTrue(n.find("#SelectDefaultStoreView").val()),u=encodeAndSymbol(encodeURI(t));$.post("/Store/ChangeStore",{searchTerm:u,RegisterSelectStoreView:i,SelectDefaultStoreView:r},function(t){ajaxFormSubmitResponse(t,n)})}function clearStoreSearchError(n,t){(n||t)&&(!n&&t&&(n=$(t.currentTarget).parents(".modal")),n.find("form#search-store-list .search-store-error").addClass("hidden"))}function makethismystore(n,t,i){return $.ajax({url:"/Store/MakeThisMyStore",data:{storeCode:n,setDefault:t,returnStoreData:i},type:"POST",cache:!1,success:function(t){t&&(i=$(".form-store-code").length?!0:!1,i?($(".form-store-code").get(0).value=n,$(".form-store-info .code").html("#"+n),$(".form-store-info .address").html(t.address1+"<br/>"+t.city+","+t.state)):(currentURL=window.location.href,currentURL.toLowerCase().indexOf("storecode=")>-1&&(currentURL=currentURL.slice(0,currentURL.toLowerCase().indexOf("storecode="))+currentURL.slice(currentURL.toLowerCase().indexOf("storecode=")+13)),currentURL.indexOf("#")==-1?window.location.href=currentURL:location.reload(!1)))}}),!1}function PromptSelectDefaultStore(){$("#baseModal .modal-content").load("/store/changestore?SelectDefaultStoreView=true",function(){$(this).find(".close").hide();$(this).parents(".modal").modal({keyboard:!1,backdrop:"static",show:!0})})}function getLocation(){navigator.geolocation&&navigator.geolocation.getCurrentPosition(sendPositionToServer)}function sendPositionToServer(n){var t=n.coords.latitude,i=n.coords.longitude;SetCurrentStoreByLatLong(t,i)}function SetCurrentStoreByLatLong(n,t){$.post("/Store/SetCurrentStoreByLatLong",{latitude:n,longitude:t},function(n){n&&(window.location.href=window.location.href)})}function ajaxFormSubmitResponse(n,t){n.Success?window.location.href=window.location.href:n.RedirectURL?window.location=n.RedirectURL:(t=t||$("#baseModal"),typeof t=="string"?($("#baseModal .modal-content").html(n.Content),$("#submitting-overlay").remove()):(t.find(".modal-content").html(n.Content),$("#submitting-overlay").remove()))}function imageError(n){return n.onerror="",n.src="/content/images/catalog/nopicture.jpg",!0}function ConfigureFormValidation(){$("input[data-val-range-max],input[data-val-length-max]").each(function(n,t){var i=$(t),r=i.is("[data-val-range-max]")?i.data("valRangeMax").toString().length:i.data("valLengthMax");i.attr("maxlength",r)});$("textarea[data-val-length-max]").bind("input propertychange",function(){var n=$(this).data("val-length-max");$(this).val().length>n&&$(this).val($(this).val().substring(0,n))});$("body").on("submit","form",function(){$(this).hasClass("dont-disable-submit")||($(this).find('input[type="submit"]').attr("disabled","disabled"),$(this).find('button[type="submit"]').attr("disabled","disabled"))})}function HideCollapsibles(){$('.collapse-single a[data-toggle="collapse"]').click(function(){var n=$(this).closest(".collapse-single");n.find(".in").collapse("toggle")})}function endsWith(n,t){return n.indexOf(t,n.length-t.length)!==-1}function startsWith(n,t){return n.indexOf(t)===0}function ConfigureNativeMapLinks(){$(function(){$(".native-map-link").each(function(){var n=$(this).data("address");n&&bpjscontext.IsIOS&&$(this).attr("href","http://maps.apple.com?q="+n)});$(".native-directions-link").each(function(){var n=$(this).data("address");n&&bpjscontext.IsIOS&&$(this).attr("href","http://maps.apple.com?saddr=Current+Location&daddr="+n)})})}function reloadStoreAvailability(){var t=$("#baseModal .store-availability-form input[name=UPN]").val(),n=$("#baseModal .store-availability-form input[name=storeAvailSearchTerm]").val();n.length<=0||$(".modal-content").load("/catalog/storeavailability?upn="+t+"&zipCode="+encodeURIComponent(n))}function geolocateStoreAvailability(){navigator.geolocation&&navigator.geolocation.getCurrentPosition(loadStoreAvailabilityByPosition,geolocateStoreListFail)}function loadStoreAvailabilityByPosition(n){$("#baseModal .modal-body > div").html("loading...");var t=$("#baseModal .store-availability-form input[name=UPN]").val(),i=n.coords.latitude,r=n.coords.longitude;$(".modal-content").load("/catalog/storeavailability?upn="+t+"&latitude="+i+"&longitude="+r)}function LoadMatchingItem(n){$("#viewPerPageResults").find('option[value="'+n+'"]').attr("selected",!0)}function AddProductToCart(n){$.ajax({url:"/ShoppingCart/AddProductToCart",data:n,type:"POST",success:function(n){ajaxFormSubmitResponse(n);n.ShowContent&&($("#baseModal").modal("show"),n.Success&&RefreshCartCount())}})}function OnSubmitFormAddProductToCart(n){if(n.preventDefault(),$(n.currentTarget).valid()){var t=$(n.currentTarget).serialize();AddProductToCart(t)}}function LoadCartCount(){var n=$("#HeaderCart,#HeaderCart-2,#HeaderCart-3").data("cartcount");SetCartCount(n)}function PopulateUOMddl(){var n=$("#UPN").val(),i=$("#lastUPN").val(),t;n.toLowerCase()!=i.toLowerCase()&&(t=$("#UOMNumerator"),t.find("option").remove(),n.length>=3&&$.getJSON("/ShoppingCart/GetQuickAddProductUoms?upn="+n,{},function(n){$(n).each(function(n,i){t.append('<option value="'+i.Value+'">'+i.Name+"<\/option>")})}),$("#lastUPN").val(n))}function RefreshCartCount(){$.ajax({url:"/ShoppingCart/CartItemsCount",type:"GET",cache:!1,success:function(n){SetCartCount(n)},error:function(){SetCartCount(0)}})}function SetCartCount(n){$("#HeaderCart,#HeaderCart-2,#HeaderCart-3").data("cartcount",n);var t=n,i="("+n+(n>1?" items)":" item)");$("#HeaderCartCount,#HeaderCartCount-2,#HeaderCartCount-3").html(t);$("#floatingcart").hide();n>0&&window.location.pathname!=="/cart"&&($("#FloatingCartCount").html(i),$("#floatingcart").show());window.localStorage.removeItem("bp_cartcount");window.localStorage.setItem("bp_cartcount",n)}function ReCalculateBulbEnergyTotals(){if($("form#bulb-energy-calc").length>0){var n=$("#bulb-energy-calc input[name='numberLamps']").val(),h=$("#bulb-energy-calc input[name='costPerKwh']").val(),i=$("#bulb-energy-calc input[name='hoursPerDay']").val(),t=$("#bulb-energy-calc input[name='daysPerYear']").val();(!$.isNumeric(n)||n<1)&&(n=1,$("#bulb-energy-calc input[name='numberLamps']").val(n));(!$.isNumeric(i)||i<1)&&(i=1,$("#bulb-energy-calc input[name='hoursPerDay']").val(i));(!$.isNumeric(t)||t<1||t>365)&&(t=365,$("#bulb-energy-calc input[name='hoursPerDay']").val(t));var y=$("#bulb-energy-calc input[name='CurrentWattage']").val(),p=$("#bulb-energy-calc input[name='NewWattage']").val(),r=$("#bulb-energy-calc input[name='CurrentAverageRatedHours']").val(),u=$("#bulb-energy-calc input[name='NewAverageRatedHours']").val(),w=$("#bulb-energy-calc input[name='CurrentPricePerLamp']").val(),b=$("#bulb-energy-calc input[name='NewPricePerLamp']").val(),k=r/i/t,f=u/i/t,d=n*r*w/r,e=n*b,c=h*u*n*y/1e3,l=h*u*n*p/1e3,o=c-l,a=o-e,s=o+a,v=s/f,g=v/12,nt=e/(s/f);$("#bulb-energy-calc .cur-lifespan-years").html(k.toFixed(2));$("#bulb-energy-calc .new-lifespan-years").html(f.toFixed(2));$("#bulb-energy-calc .cur-product-cost").html("$"+d.toFixed(2));$("#bulb-energy-calc .new-product-cost").html("$"+e.toFixed(2));$("#bulb-energy-calc .cur-lifetime-cost").html("$"+c.toFixed(2));$("#bulb-energy-calc .new-lifetime-cost").html("$"+l.toFixed(2));$("#bulb-energy-calc .totalLifetimeEnergySavings").html("$"+o.toFixed(2));$("#bulb-energy-calc .totalReplacementSavings").html("$"+a.toFixed(2));$("#bulb-energy-calc .totalLifetimeSavings").html("$"+s.toFixed(2));$("#bulb-energy-calc .yearlySavings").html("$"+v.toFixed(2));$("#bulb-energy-calc .monthlySavings").html("$"+g.toFixed(2));$("#bulb-energy-calc .paybackPeriod").html(nt.toFixed(2)+" years")}}function GetNumber(n){var t=n.val();return(!$.isNumeric(t)||t<0)&&(t=1,n.val(t)),t}function loadGoogleReviewsScript(n,t){if(typeof google=="object"&&typeof google.maps=="object")window[t]();else{var i=document.createElement("script");i.type="text/javascript";i.src="//maps.googleapis.com/maps/api/js?v=3.exp&client="+n+"&sensor=false&callback="+t+"&libraries=places";document.body.appendChild(i)}}function initializeReviews(n,t,i){$("#google-reviews").googlePlaces({placeId:i,render:["review"]})}var docCookies,JD,debouncetimeout,zippattern,exclude;Array.from||(Array.from=function(){var t=Object.prototype.toString,n=function(n){return typeof n=="function"||t.call(n)==="[object Function]"},i=function(n){var t=Number(n);return isNaN(t)?0:t===0||!isFinite(t)?t:(t>0?1:-1)*Math.floor(Math.abs(t))},r=Math.pow(2,53)-1,u=function(n){var t=i(n);return Math.min(Math.max(t,0),r)};return function(t){var h=this,c=Object(t),i,o;if(t==null)throw new TypeError("Array.from requires an array-like object - not null or undefined");if(i=arguments.length>1?arguments[1]:void undefined,typeof i!="undefined"){if(!n(i))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(o=arguments[2])}for(var f=u(c.length),s=n(h)?Object(new h(f)):new Array(f),r=0,e;r<f;)e=c[r],s[r]=i?typeof o=="undefined"?i(e,r):i.call(o,e,r):e,r+=1;return s.length=f,s}}());docCookies={getItem:function(n){return n?decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(n).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null:null},setItem:function(n,t,i,r,u,f){if(!n||/^(?:expires|max\-age|path|domain|secure)$/i.test(n))return!1;var e="";if(i)switch(i.constructor){case Number:e=i===Infinity?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+i;break;case String:e="; expires="+i;break;case Date:e="; expires="+i.toUTCString()}return document.cookie=encodeURIComponent(n)+"="+encodeURIComponent(t)+e+(u?"; domain="+u:"")+(r?"; path="+r:"")+(f?"; secure":""),!0},removeItem:function(n,t,i){return this.hasItem(n)?(document.cookie=encodeURIComponent(n)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(i?"; domain="+i:"")+(t?"; path="+t:""),!0):!1},hasItem:function(n){return n?new RegExp("(?:^|;\\s*)"+encodeURIComponent(n).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie):!1},keys:function(){for(var n=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/),i=n.length,t=0;t<i;t++)n[t]=decodeURIComponent(n[t]);return n}};$(document).ready(function(){var n=n||{};n.IsIOS=/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!window.MSStream;n.IsAndroid=/android/i.test(navigator.userAgent);BindFlyoutMenuHover();ConfigureModal();ConfigureAjax();ConfigureNotifications();ConfigureSearchAutocomplete();ConfigureResponsiveCatalog();ConfigureImageLazyLoad();ConfigureFormValidation();ConfigureDateTimeEditors();ConfigurePopovers();ConfigureNativeMapLinks();HideCollapsibles();var t=$("#Header-IsMobile").html()=="False"?!1:!0,r=$("#Header-IsCrawler").html()=="False"?!1:!0,u=$("#Header-CurrentStoreCode").html(),i=getQueryString("testmobile");i&&i.length>0&&(t=!0);typeof n!="undefined"&&!n.IsCrawler&&n.IsMobile&&n.CurrentStoreCode.length==0&&getLocation();!r&&t&&u.length==0&&getLocation();$(".navbar-main li.dropdown").on("click",".dropdown-toggle",function(n){$(n.delegateTarget).find(".dropdown-menu").toggleClass("open")});$(".navbar-main li.dropdown").on("focusout",function(n){var t=$(n.currentTarget);t.find(n.relatedTarget)[0]||t.find(".dropdown-menu").removeClass("open")});$(document).on("keydown",function(n){n.keyCode===27&&$(".navbar-main li.dropdown .dropdown-menu.open").removeClass("open")});$(".modal-content").on("submit","form#search-store-list",function(n){n.preventDefault();var t=$(n.currentTarget).parents(".modal");reloadStoreListSearch(t)});$(".modal-content").on("click","form#search-store-list .geolocate-stores",function(n){n.preventDefault();var t=$(n.currentTarget).parents(".modal");geolocateStoreList(t)});$(".modal-content").on("click",".confirm-store-list-makestore",function(n){console.log("modal-content.onClick() ",n);n.preventDefault();var i=$(this).attr("data-storecode"),t=IsValTrue($(this).attr("data-registerSelectStoreView")),r=IsValTrue($(this).attr("data-selectDefaultStoreView"));return makethismystore(i,t||r,t),$(n.currentTarget).parents(".modal").modal("hide"),!1});$("body").on("click",".make-this-my-store[data-storecode]",function(n){n.preventDefault();var t=$(this).attr("data-storecode");return makethismystore(t,!1),!1})});window.suggestion_cache=[];window.bad_request_cache=[];JD={};JD.debounce=function(n,t){return function(){var r=this,u=arguments,i;clearTimeout(debouncetimeout);i=function(){debouncetimeout=null;n.apply(r,u)};debouncetimeout=setTimeout(i,t)}};zippattern=/(^\d{5}$)|(^\d{5}-\d{4}$)/;$(document).ready(function(){$("input[type=number]").click(function(){$(this).select()})}),function(){$.get("/cart/fiddle").done(function(){console.log("Fiddled the cart")}).fail(function(){console.log("Failed fiddle the cart")})}();$("#baseModal").on("submit","#ContactStoreForm",function(n){n.preventDefault();var t=$("#ContactStoreForm").serialize();$.post("/Store/ContactStoreModal",t,ajaxFormSubmitResponse)});$(".modal-content").on("submit","form#StoreAvailability",function(n){n.preventDefault();reloadStoreAvailability()});$(".modal-content").on("click","form#StoreAvailability .geolocate-stores",function(n){n.preventDefault();geolocateStoreAvailability()});$(function(){$("#viewPerPageResults").change(function(){var t=$(this).find("option:selected").val(),n=$(".mark-queryurl").attr("data-url");n||(n="?");location.href=n+"page=1&perPage="+t})});$(".modal-content").on("submit","form#AddFavoriteForm",function(n){n.preventDefault();var t=$("form#AddFavoriteForm").serialize();$.post("/favorites/AddFavorite",t,ajaxFormSubmitResponse)});$(".modal-content").on("submit","form#EditFavoriteForm",function(n){n.preventDefault();var t=$("form#EditFavoriteForm").serialize();$.post("/favorites/Edit",t,ajaxFormSubmitResponse)});$(".modal-content").on("submit","form#DeleteFavoriteForm",function(n){n.preventDefault();var t=$("form#DeleteFavoriteForm").serialize();$.post("/favorites/ConfirmDeleteFavorite",t,ajaxFormSubmitResponse)});$("form.favorite-add-to-cart").on("submit",function(n){if(n.preventDefault(),$(this).valid()){var t=$(this).serialize();AddProductToCart(t)}});$("form.add-product-to-cart").submit(function(n){if(n.preventDefault(),$(this).valid()){var t=$(this).serialize();AddProductToCart(t)}});$(document).ready(function(){LoadCartCount()});$("#baseModal").on("keyup","form#QuickAddToCartForm #UPN",function(){var t=$(this).val(),n;t.length>=3&&(n=JD.debounce(PopulateUOMddl,500),n())});$("#baseModal").on("change","form#QuickAddToCartForm #UPN",function(){var t=$(this).val(),n;t.length>=3&&(n=JD.debounce(PopulateUOMddl,0),n())});$("form.update-shipping-method").on("click",".shippingMethod",function(){var n=$(this).data("shippingmethod");$("#ShippingMethod-"+n).attr("checked",!0);$("form.update-shipping-method").submit()});$('input[name="shippingMethodId"]').change(function(){$("form.update-shipping-method").submit()});$("#baseModal").on("submit","form#NewCouponForm",function(n){n.preventDefault();var t=$(this).serialize();$.post("/shoppingcart/discountsmodal",t,ajaxFormSubmitResponse)});$("#baseModal").on("submit","form.remove-coupon-form",function(n){n.preventDefault();var t=$(this).serialize();$.post("/shoppingcart/removecouponcode",t,ajaxFormSubmitResponse)});$("#baseModal").on("submit","form#QuickAddToCartForm",function(n){if(n.preventDefault(),$(this).valid()){var t=$(this).serialize();$.ajax({url:"/ShoppingCart/QuickAddProductToCart",data:t,type:"POST",success:function(n){ajaxFormSubmitResponse(n)}})}});$("#chkForceTaxable").on("change",function(){$("#ForceTaxableForm").submit()});$(".shoppingcart-controller.cart-action, .checkout-controller.review-action").find(".discount-summary").on("click","button.remove-discount",function(n){return n.preventDefault(),$(this)[0].disabled=!0,$.post($(this).data("action"),{couponCode:$(this).data("couponcode")},ajaxFormSubmitResponse),!1});$(".shoppingcart-controller.cart-action, .checkout-controller.review-action").find(".discount-entry").on("click","button.add-discount",function(n){return n.preventDefault(),$(this)[0].disabled=!0,$.post($(this).data("action"),{couponCode:$(this).closest(".discount-entry").find("input[type=text]").val()},ajaxFormSubmitResponse),!1});$(".shoppingcart-controller.cart-action, .checkout-controller.review-action").find(".discount-entry").on("keyup keydown keypress","input[type=text]",function(n){if(n.which==13)return n.preventDefault(),n.type=="keydown"&&$(this).closest(".discount-entry").find("button").trigger("click"),!1});$(function(){var n=$(".shoppingcart-controller.cart-action, .checkout-controller.review-action").find(".discount-entry .alert");n&&n.length&&window.innerWidth<767&&$("body").animate({scrollTop:n.offset().top-15},750)});$("[data-toggle=tooltip]").tooltip();$("#baseModal").on("submit","#EditAddressForm",function(n){n.preventDefault();var t=$("#EditAddressForm").serialize();$.post("/MyAccount/EditAddress",t,ajaxFormSubmitResponse)});$("#baseModal").on("submit","#AddAddressForm",function(n){n.preventDefault();var t=$("#AddAddressForm").serialize();$.post("/MyAccount/AddAddress",t,ajaxFormSubmitResponse)});$("#baseModal").on("submit","#DeleteAddressForm",function(n){n.preventDefault();var t=$("#DeleteAddressForm").serialize();$.post("/MyAccount/ConfirmDeleteAddress",t,ajaxFormSubmitResponse)});$("#baseModal").on("submit","#EditCreditCardForm",function(n){n.preventDefault();var t=$("#EditCreditCardForm").serialize();$.post("/MyAccount/EditCreditCard",t,ajaxFormSubmitResponse)});$("#baseModal").on("submit","#DeleteCreditCardForm",function(n){n.preventDefault();var t=$("#DeleteCreditCardForm").serialize();$.post("/MyAccount/ConfirmDeleteCreditCard",t,ajaxFormSubmitResponse)});$("#NewEmailAddress").focusout(function(){var n=$.trim($("#NewEmailAddress").val());$("#NewEmailAddress").val(n)});$("#ConfirmEmailAddress").focusout(function(){var n=$.trim($("#ConfirmEmailAddress").val());$("#ConfirmEmailAddress").val(n)}),new function(){function t(){$("h1,h2,h3,h4,h5,h6,p").widont()}function r(t){return t.replace(n.regexp,"&#160;$1")}var i={auto:function(t){return t!=undefined?n.auto=t:n.auto},init:function(){return n.init()},transform:function(t){return n.widont(t)}},n;$.jqwidont=i;n={auto:!0,init:t,widont:r,regexp:new RegExp("[\\n\\r\\s]+([^>\\n\\r\\s(?:&#160;)]+[\\n\\r\\s]*)$","m")};$(document).ready(function(){n.auto&&t()});$.fn.widont=function(){return $(this).each(function(){var t=$(this);t.html(n.widont(t.html()))})}};$(".modal-content").on("change","form#bulb-energy-calc input",function(){ReCalculateBulbEnergyTotals()});exclude=!1;$(".modal-content").on("click","#ExcludeStoresBtn",function(){exclude=!0;$("#ExclusionsUpdated").val("true");$("#UserStoresForm").submit()});$(".modal-content").on("click","#AllowStoresBtn",function(){exclude=!1;$("#ExclusionsUpdated").val("true");$("#UserStoresForm").submit()});$(".modal-content").on("submit","#UserStoresForm",function(n){n.preventDefault();var t=$("#UserStoresForm").serialize();t+=exclude?"&ExcludeStores=ExcludeStores":"&AllowStores=AllowStores";$.post("/Admin/UserStores",t,ajaxFormSubmitResponse)});$(".modal-content").on("submit","#RemoveApproverForm",function(n){n.preventDefault();var t=$("#RemoveApproverForm").serialize();$.post("/Admin/RemoveUserOrderApprover",t,ajaxFormSubmitResponse)});$(".modal-content").on("submit","#AddUserForm",function(n){n.preventDefault();var t=$("#AddUserForm").serialize();$.post("/Admin/AddUser",t,ajaxFormSubmitResponse)});$(".modal-content").on("submit","#RemoveUserForm",function(n){n.preventDefault();var t=$("#RemoveUserForm").serialize();$.post("/Admin/RemoveUser",t,ajaxFormSubmitResponse)});$("#baseModal").on("submit","#DeclineOrderForm",function(n){n.preventDefault();var t=$("#DeclineOrderForm").serialize();$.post("/Order/ConfirmDeclineOrder",t,ajaxFormSubmitResponse)});$("form.contract-product-form").submit(function(n){if(n.preventDefault(),$(this).valid()){var t=$(this).serialize();AddProductToCart(t)}}),function(){window.bp=window.bp||{};window.bp.appointment=window.bp.appointment||{isSchedulePending:!1,schedule:function(){if(!(this instanceof window.bp.appointment.schedule))return new window.bp.appointment.schedule;var n={minDate:{},maxDate:{},dates:{},holidays:[],timeFormat:"g:i a",dateFormat:"Y-m-d",availableTimes:{},step:{}};return this.init=function(t){n=$.extend({},n,t)},this.finalize=function(){$("#AppointmentScheduleForm input[name=ScheduledDate]").datetimepicker({formatDate:n.dateFormat,format:n.dateFormat,inline:!0,scrollMonth:!1,scrollInput:!1,defaultSelect:!1,monthChangeSpinner:!1,todayButton:!1,minDate:n.minDate,maxDate:n.maxDate,disabledDates:n.holidays,timepicker:!1,onSelectDate:function(t,i){!t||($(".select-time-group .scheduled-date-text").text(t.dateFormat("m/d/Y")),!n.dates[t.dateFormat(n.dateFormat)]||($("#AppointmentScheduleForm input[name=ScheduledTime]").datetimepicker({minTime:n.dates[t.dateFormat(n.dateFormat)][0],maxTime:n.dates[t.dateFormat(n.dateFormat)][1],allowTimes:n.availableTimes[t.dateFormat(n.dateFormat)]}),$(".select-date-group").hide(),$(".select-time-group").show()));i.valid()}});$("#AppointmentScheduleForm input[name=ScheduledTime]").datetimepicker({formatTime:n.timeFormat,format:"G:i",inline:!0,scrollTime:!1,scrollInput:!1,timepickerScrollbar:!1,defaultSelect:!1,minTime:"11:00 am",maxTime:"12:00 pm",step:n.step,datepicker:!1,onSelectTime:function(n,t){t.valid()}});var t=function(n){var i,r,u;if(!window.bp.appointment.isSchedulePending){if(window.bp.appointment.isSchedulePending=!0,i=$(this),r=i.find("input[type=submit]"),r.prop("disabled",!0),n.preventDefault(),i.valid())u=$("#Message").val(),$("#Message").val(encodeURIComponent(u)),$.ajax({method:i[0].method,url:i[0].action,data:i.serialize()}).done(function(n){$("#Message").val(u);console.log("hiding modal");var f=$("#baseLargeModal");if(f.is(":visible")&&f.modal("toggle"),n.State){try{i.validate().showErrors(n.State)}catch(e){}r.prop("disabled",!1);window.bp.appointment.isSchedulePending=!1;$("#AppointmentScheduleForm").one("submit",t)}else n.RedirectURL&&(window.location=n.RedirectURL)}).fail(function(){r.prop("disabled",!1);window.bp.appointment.isSchedulePending=!1;$("#AppointmentScheduleForm").one("submit",t)});else{window.bp.appointment.isSchedulePending=!1;r.prop("disabled",!1);$("#AppointmentScheduleForm").one("submit",t)}return!1}},i=$("#AppointmentScheduleForm").on("click",".select-time-group .show-date-group-link",function(){return $("#AppointmentScheduleForm .select-time-group").hide(),$("#AppointmentScheduleForm .select-date-group").show(),!1}).validate();i==null?$("#AppointmentScheduleForm").validate({ignore:"input[type=hidden]"}):i.settings.ignore="input[type=hidden]";$("#AppointmentScheduleForm").one("submit",t)},this}}}(),function(){docCookies.getItem("noGeoloation")==null&&$("form.find-stores-by-location .geolocate-search").removeClass("hidden");var n=function(){$(".find-stores").find("input, button[type='submit']").addClass("disabled")},t=function(){$(".find-stores").find("input, button[type='submit']").removeClass("disabled")},i=function(n){$(".store-list").hide().empty().html(n).trigger("loaded.stores").show()};$("form.find-stores-by-term").on("submit",function(){var t=$(this);t.valid()&&n()});$("form.find-stores-by-location").on("submit",function(t){var i=$(this);if(!i.find("input[name=Latitude]").val()||!i.find("input[name=Longitude]").val())return t.preventDefault(),navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(n){i.find("input[name=Latitude]").val(n.coords.latitude);i.find("input[name=Longitude]").val(n.coords.longitude);i.trigger("submit")},geolocateStoreListFail),!1;n();$("form.find-stores-by-term").find("input[name=SearchTerm]").val("");$("form.find-stores-by-term").validate().resetForm()});$(function(){$("form.find-stores .search-store-list-input").focus();$.validator.unobtrusive.parse("form.find-stores-by-term");var n=$("form.find-stores-by-term").find("input[name=SearchTerm]").val();n&&console.log("trackStoreSearch("+n+", "+$(".store-box").length+")")})}(),function(){var n;n=function(){function n(n,t){var i,r;if(this.options={target:"instafeed",get:"popular",resolution:"thumbnail",sortBy:"none",links:!0,mock:!1,useHttp:!1},typeof n=="object")for(i in n)r=n[i],this.options[i]=r;this.context=t!=null?t:this;this.unique=this._genKey()}return n.prototype.hasNext=function(){return typeof this.context.nextUrl=="string"&&this.context.nextUrl.length>0},n.prototype.next=function(){return this.hasNext()?this.run(this.context.nextUrl):!1},n.prototype.run=function(t){var u,r,i;if(typeof this.options.clientId!="string"&&typeof this.options.accessToken!="string")throw new Error("Missing clientId or accessToken.");if(typeof this.options.accessToken!="string"&&typeof this.options.clientId!="string")throw new Error("Missing clientId or accessToken.");return this.options.before!=null&&typeof this.options.before=="function"&&this.options.before.call(this),typeof document!="undefined"&&document!==null&&(i=document.createElement("script"),i.id="instafeed-fetcher",i.src=t||this._buildUrl(),u=document.getElementsByTagName("head"),u[0].appendChild(i),r="instafeedCache"+this.unique,window[r]=new n(this.options,this),window[r].unique=this.unique),!0},n.prototype.parse=function(n){var s,ft,h,c,lt,f,o,et,nt,l,a,t,r,tt,u,i,v,y,p,at,w,it,b,k,ot,st,ht,ct,rt,d,ut,e,g;if(typeof n!="object"){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"Invalid JSON data"),!1;throw new Error("Invalid JSON response");}if(n.meta.code!==200){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,n.meta.error_message),!1;throw new Error("Error from Instagram: "+n.meta.error_message);}if(n.data.length===0){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"No images were returned from Instagram"),!1;throw new Error("No images were returned from Instagram");}if(this.options.success!=null&&typeof this.options.success=="function"&&this.options.success.call(this,n),this.context.nextUrl="",n.pagination!=null&&(this.context.nextUrl=n.pagination.next_url),this.options.sortBy!=="none"){ut=this.options.sortBy==="random"?["","random"]:this.options.sortBy.split("-");d=ut[0]==="least"?!0:!1;switch(ut[1]){case"random":n.data.sort(function(){return.5-Math.random()});break;case"recent":n.data=this._sortBy(n.data,"created_time",d);break;case"liked":n.data=this._sortBy(n.data,"likes.count",d);break;case"commented":n.data=this._sortBy(n.data,"comments.count",d);break;default:throw new Error("Invalid option for sortBy: '"+this.options.sortBy+"'.");}}if(typeof document!="undefined"&&document!==null&&this.options.mock===!1){if(i=n.data,rt=parseInt(this.options.limit,10),this.options.limit!=null&&i.length>rt&&(i=i.slice(0,rt)),o=document.createDocumentFragment(),this.options.filter!=null&&typeof this.options.filter=="function"&&(i=this._filter(i,this.options.filter)),this.options.template!=null&&typeof this.options.template=="string"){for(nt="",tt="",at="",g=document.createElement("div"),a=0,ot=i.length;a<ot;a++){if(t=i[a],r=t.images[this.options.resolution],typeof r!="object"){f="No image found for resolution: "+this.options.resolution+".";throw new Error(f);}w=r.width;y=r.height;p="square";w>y&&(p="landscape");w<y&&(p="portrait");u=r.url;l=window.location.protocol.indexOf("http")>=0;l&&!this.options.useHttp&&(u=u.replace(/https?:\/\//,"//"));tt=this._makeTemplate(this.options.template,{model:t,id:t.id,link:t.link,type:t.type,image:u,width:w,height:y,orientation:p,caption:this._getObjectProperty(t,"caption.text"),likes:t.likes.count,comments:t.comments.count,location:this._getObjectProperty(t,"location.name")});nt+=tt}for(g.innerHTML=nt,c=[],h=0,ft=g.childNodes.length;h<ft;)c.push(g.childNodes[h]),h+=1;for(b=0,st=c.length;b<st;b++)ct=c[b],o.appendChild(ct)}else for(k=0,ht=i.length;k<ht;k++){if(t=i[k],v=document.createElement("img"),r=t.images[this.options.resolution],typeof r!="object"){f="No image found for resolution: "+this.options.resolution+".";throw new Error(f);}u=r.url;l=window.location.protocol.indexOf("http")>=0;l&&!this.options.useHttp&&(u=u.replace(/https?:\/\//,"//"));v.src=u;this.options.links===!0?(s=document.createElement("a"),s.href=t.link,s.appendChild(v),o.appendChild(s)):o.appendChild(v)}if(e=this.options.target,typeof e=="string"&&(e=document.getElementById(e)),e==null){f='No element with id="'+this.options.target+'" on page.';throw new Error(f);}e.appendChild(o);et=document.getElementsByTagName("head")[0];et.removeChild(document.getElementById("instafeed-fetcher"));it="instafeedCache"+this.unique;window[it]=void 0;try{delete window[it]}catch(vt){lt=vt}}return this.options.after!=null&&typeof this.options.after=="function"&&this.options.after.call(this),!0},n.prototype._buildUrl=function(){var i,n,t;i="https://api.instagram.com/v1";switch(this.options.get){case"popular":n="media/popular";break;case"tagged":if(!this.options.tagName)throw new Error("No tag name specified. Use the 'tagName' option.");n="tags/"+this.options.tagName+"/media/recent";break;case"location":if(!this.options.locationId)throw new Error("No location specified. Use the 'locationId' option.");n="locations/"+this.options.locationId+"/media/recent";break;case"user":if(!this.options.userId)throw new Error("No user specified. Use the 'userId' option.");n="users/"+this.options.userId+"/media/recent";break;default:throw new Error("Invalid option for get: '"+this.options.get+"'.");}return t=i+"/"+n,t+=this.options.accessToken!=null?"?access_token="+this.options.accessToken:"?client_id="+this.options.clientId,this.options.limit!=null&&(t+="&count="+this.options.limit),t+("&callback=instafeedCache"+this.unique+".parse")},n.prototype._genKey=function(){var n;return n=function(){return((1+Math.random())*65536|0).toString(16).substring(1)},""+n()+n()+n()+n()},n.prototype._makeTemplate=function(n,t){for(var u,f,e,r=/(?:\{{2})([\w\[\]\.]+)(?:\}{2})/,i=n;r.test(i);)f=i.match(r)[1],e=(u=this._getObjectProperty(t,f))!=null?u:"",i=i.replace(r,function(){return""+e});return i},n.prototype._getObjectProperty=function(n,t){var i,r;for(t=t.replace(/\[(\w+)\]/g,".$1"),r=t.split(".");r.length;)if(i=r.shift(),n!=null&&i in n)n=n[i];else return null;return n},n.prototype._sortBy=function(n,t,i){var r;return r=function(n,r){var u,f;return(u=this._getObjectProperty(n,t),f=this._getObjectProperty(r,t),i)?u>f?1:-1:u<f?1:-1},n.sort(r.bind(this)),n},n.prototype._filter=function(n,t){var r,u,i,f,e;for(r=[],u=function(n){if(t(n))return r.push(n)},i=0,e=n.length;i<e;i++)f=n[i],u(f);return r},n}(),function(n,t){return typeof define=="function"&&define.amd?define([],t):typeof module=="object"&&module.exports?module.exports=t():n.Instafeed=t()}(this,function(){return n})}.call(this),function(n){n.fn.googlePlaces=function(t){var i=n.extend({header:"<h3 class='hidden-xs hidden-sm'>Here's What People Are Saying <span class='fa fa-comments'><\/span><\/h3>",footer:"",maxRows:10,minRating:3,months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],textBreakLength:"90",shortenNames:!0,writeReviewButtonUrl:"/review/"+thisStoreCode,writeReviewButtonLabel:"Write New Review"},t),f=this[0],r=this,e=function(){return'<div class="more-reviews"><a href="'+i.moreReviewsButtonUrl+'" target="_blank">'+i.moreReviewsButtonLabel+"<\/a><\/div>"},o=function(){return'<div class="write-review"><a href="'+i.writeReviewButtonUrl+'" target="_blank" class="btn btn-primary">'+i.writeReviewButtonLabel+"<\/a><\/div>"},s=function(n){var t="";t+=n;r.append(t)},h=function(n){var u="",t="";i.moreReviewsButtonUrl&&(t+=e());i.writeReviewButtonUrl&&(t+=o());t!==""&&(u+='<div class="buttons top-spacer">'+t+"<\/div>");u+=n;r.after(u)},c=function(n){var t,i,r;return n.split(" ").length>1?(t="",t=n.split(" "),i=t[1][0],r=t[0],i==="."?r:r+" "+i+"."):n!==undefined?n:""},l=function(n){for(var i='<div class="review-stars"><ul>',t=0;t<n;t++)i+='<li><i class="star"><\/i><\/li>';if(n<5)for(t=0;t<5-n;t++)i+='<li><i class="star inactive"><\/i><\/li>';return i+"<\/ul><\/div>"},a=function(n){var t=new Date(n*1e3),r=i.months;return t.getDate()+". "+r[t.getMonth()]+" "+t.getFullYear()},v=function(n){var t,r;if(n===void 0)return[];for(t=n.length-1;t>=0;t--)r=n[t],r.rating<i.minRating&&n.splice(t,1);return n},y=function(n){return typeof n!="undefined"&&n!==null&&n.length!==null&&n.length>0?n.sort(function(n,t){return n.time>t.time?1:t.time>n.time?-1:0}).reverse():[]},p=function(n){var t,u,e;if(n.reverse(),t="",u=i.maxRows>0?i.maxRows-1:n.length-1,u=u>n.length-1?n.length-1:u,console.log("reviews.length = "+n.length+" rowCount = "+u),n.length<1)t=t+"<div class='no-reviews top-spacer-2'><h4>No reviews available yet. Please let us know what you think!<\/h4>";else for(e=u;e>=0;e--){var f=n[e],o=l(f.rating),v=a(f.time),s=i.shortenNames?c(f.author_name):f.author_name,h=f.text.length>parseInt(i.textBreakLength)?"review-item-long":"review-item";t=t+"<div class="+h+"><div class='review-meta'><span class='review-author'>"+s+"<\/span><span class='review-sep'><\/span><\/div>"+o+"<p class='review-text'>"+f.text+"<\/p><\/div>"}r.append(t)},w=new google.maps.places.PlacesService(f),u;const b={placeId:i.placeId,fields:["review"]};return u=function(n,t){if(t===google.maps.places.PlacesServiceStatus.OK){var u=v(n.reviews),r=y(u);r.length>0&&(s(i.header),p(r),h(i.footer))}},this.each(function(){if(i.placeId===undefined||i.placeId===""){n("#reviews").html("<div class='no-reviews top-spacer-2 hidden-sm hidden-xs'><h4>No reviews available.<\/h4>");console.error("NO PLACE ID DEFINED");return}w.getDetails(b,u)})}}(jQuery)