function GetTopCategories(){var t=$.Deferred(),n="#idTopcategory";return spinStart(n),$.ajax({url:"/site/ProductPlacementV2/GetTopCategoriesAsync",data:{viewMode:IM.ProductPlacement.getDeviceType()},method:"POST",dataType:"text"}).done(function(i){i&&$.trim(i)!=""&&($(n).html(i),IM.ProductPlacement.initFlexCarousel($(n)),IM.ProductPlacement.attachAddCartBtnClick(n));spinStop(n);IM&&IM.AddToCartColoring&&IM.AddToCartColoring.initialize(n);t.resolve()}).fail(function(i,r,u){r&&(console.log(r),console.log(u));spinStop(n);t.reject()}),t.promise()}function spinStart(n){$(n).addClass("spinner-block");$(n).spin("small")}function spinStop(n){$(n).removeClass("spinner-block");$(n).spin(!1)}var IM=function(n,t){"use strict";function e(n){IM.ProductPlacement.loadAllPlacements(IM.ProductPlacement.homePageSize);GetTopCategories();i();r();t("#divAds .carousel-inner .item a img").on("mouseover",function(n){n.srcElement.title=""});n=="True"&&t("#NotoficationEmailModal").modal({backdrop:"static",keyboard:!1})}function o(n){n?(t("#NotoficationEmailModal").modal("hide"),toastr.success("Notification email saved successfully!")):toastr.error("Notification email could not be saved. Please try again.")}function s(){toastr.error("Notification email could not be saved. Please try again.")}function h(t,i,r,u){c();n.Common.Ajax.post(t,i).done(r).fail(u).always(function(){l()})}function c(){t("#overlay_center").show().spin({color:"black"});t("#overlay").show()}function l(){t("#overlay, #overlay_center").hide()}function i(){var n=t("#divAds");u(n);n.mouseenter(function(){a(n)}).mouseleave(function(){u(n)})}function r(){t(".topBanners img:not(.img-responsive),#topAdBanner img:not(.img-responsive),#divAds img:not(.img-responsive),#divHomePageAdsMiddlePreSpotLight img:not(.img-responsive), #divHomePageAdsMiddle img:not(.img-responsive)").addClass("img-responsive")}function u(n){n.children(".left.carousel-control").hide(200);n.children(".right.carousel-control").hide(200)}function a(n){n.children(".left.carousel-control").show(200);n.children(".right.carousel-control").show(200)}function v(){var n=[];isLoggedIn?IM.Home.serverSidePlacementsDivId.push("#divBuyItAgain"):IM.Home.serverSidePlacementsDivId.push("#idFeaturedPromotions");IM.Home.serverSidePlacementsDivId.forEach(function(i){IM.ProductPlacement.initFlexCarousel(t(i),!0);IM.ProductPlacement.IsClientsidePNAEnabled&&IM.ProductPlacement.IsClientsidePNAEnabled.toLowerCase()=="true"&&(n=n.concat(IM.ProductPlacement.GetTheSkusForInitialPNACall(i)))});IM.ProductPlacement.IsClientsidePNAEnabled&&IM.ProductPlacement.IsClientsidePNAEnabled.toLowerCase()=="true"&&(IM.Home.serverSideskuListForInitialPNAcall=n,IM.ProductPlacement.performClientPNA(IM.Home.serverSideskuListForInitialPNAcall,IM.Home.serverSidePlacementsDivId));IM.ProductPlacement.attachAddCartBtnClick()}function y(){let n=setInterval(function(){t("#HomeMainSection").find(".spinner").length==0&&(clearInterval(n),t("#HomeMainSection").find("#carouselResources[data-pnaerror='False']").length==0&&t("#HomeMainSection").find("#carouselResources[data-pnaerror='True']").length>0&&t("#divPnAError").removeClass("hide"))},1e3)}var f={initialize:e,serverSidePlacementsDivId:["#idProductShowcase"],serverSideskuListForInitialPNAcall:[],productPlacementWidgetIds:["idProductShowcase","divBuyItAgain","idFeaturedPromotions","divYouMayAlsoLike","divTopTrendingProducts","divTopcategory"]};return t(document).ready(function(){function r(){var e=t("#NotificationEmailAddress").val().trim(),i=e.split(/[;,]+/),o=[],s=[],r=!0,f,n;for(f in i)n=i[f].trim(),n&&(u(n)?o.push(n):(r=!1,s.push(n)));return r}function u(n){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n)}var n,i;t("#divAds").swipe({swipe:function(n,i,r){i=="left"&&t(this).carousel("next");i=="right"&&t(this).carousel("prev");i=="up"&&t(window).scrollTop(t(window).scrollTop()+r);i=="down"&&t(window).scrollTop(t(window).scrollTop()-r)},allowpagescroll:"vertical"});t("#NotoficationEmailModal").on("hidden.bs.modal",function(){t("#NotificationEmailAddress").val("")});t("#saveNotificationEmail").click(function(n){var i=t("#NotificationEmailAddress").val(),u;i!=null&&i!=""&&r()?(t("#ErrorMessage").text(""),u={emailAddress:t("#NotificationEmailAddress").val()},h("/site/UserProfileApi/SaveNotificationEmail",u,o,s)):(t("#ErrorMessage").text("Please enter valid email address"),n.preventDefault(),n.stopPropagation())});v();t(document).ajaxStop(function(){!isAdobeAnalyticsEnabled||(IM&&IM.AdobeAnalyticsCommon.productModule(),IM&&IM.AdobeAnalyticsCommon&&IM.AdobeAnalyticsCommon.trackPlacements(IM.Home.productPlacementWidgetIds,"HomePage"))});setTimeout(function(){t(".topBanners img").each(function(n){t(this).css("max-height",t(".topBanners img").length>1&&n==0||t(this).height()<=70?70:140)})},500);n=t("#divHomePageAdsMiddlePreSpotLight a");n.length==1&&n.addClass("align-content-center");i=t("#divHomePageAdsMiddle a");i.length==1&&i.addClass("align-content-center");t("#divHomePageAdsBottom .adBanner").each(function(){var n=t(this).find("span");n.length<=4&&n.addClass("align-content-center")});y()}),n.Home=n.Home||{},t.extend(n.Home,f),n}(IM||{},jQuery,window)