function PowerSearch(){}PowerSearch.data={};PowerSearch.data.widgetAjaxUrl="";PowerSearch.Init=function(){$(".ejs-powerSearch-section").each(function(){PowerSearch.ShowLess($(this))});$(".ejs-cmdShowMore").on("click",function(){PowerSearch.ShowMore($(this).closest(".ejs-powerSearch-section"));$(this).hide();$(this).closest(".ejs-powerSearch-section").find(".ejs-cmdShowLess").show();!ListingProduct.data.powerSearchSectionsShowed.indexOf("|"+$(this).data("key")+"|")>-1&&(ListingProduct.data.powerSearchSectionsShowed=ListingProduct.data.powerSearchSectionsShowed+"|"+$(this).closest(".ejs-powerSearch-section").data("key")+"|",ListingProduct.data.powerSearchSectionsShowed=ListingProduct.data.powerSearchSectionsShowed.replace("||","|"))});$(".ejs-cmdShowLess").on("click",function(){PowerSearch.ShowLess($(this).closest(".ejs-powerSearch-section"));$(this).closest(".ejs-powerSearch-section").find(".ejs-cmdShowMore").show();$(this).closest(".ejs-powerSearch-section").find(".ejs-cmdShowMore");$(this).hide();ListingProduct.data.powerSearchSectionsShowed.indexOf("|"+$(this).closest(".ejs-powerSearch-section").data("key")+"|")>-1&&(ListingProduct.data.powerSearchSectionsShowed=ListingProduct.data.powerSearchSectionsShowed.replace("|"+$(this).closest(".ejs-powerSearch-section").data("key")+"|","|"))});$(".ejs-powerSearch-chk-subsection").on("click",function(){ListingProduct.data.powerSearchFilter=$(this).closest(".ejs-powerSearch-subsection").data("parent-key")+","+$(this).closest(".ejs-powerSearch-subsection").data("key");$(this).prop("checked")&&(ListingProduct.data.powerSearchFilter="+"+ListingProduct.data.powerSearchFilter);PowerSearch.getResultPaging(!0,$("#ListingProducts"),1,1,$("#ListingProducts"),$("#PowerSearchSection "),PowerSearch.afterAjaxSuccess)})};PowerSearch.afterAjaxSuccess=function(){ListingProduct.afterAjaxSuccess!=undefined&&ListingProduct.afterAjaxSuccess();ListingProduct.initProductsUOMChange();PowerSearch.EnableSections()};PowerSearch.DisableSections=function(){$(".ejs-powerSearch-chk-subsection").prop("disabled",!0);$(".ejs-cmdShowLess").prop("disabled",!0);$(".ejs-cmdShowMore").prop("disabled",!0)};PowerSearch.EnableSections=function(){$(".ejs-powerSearch-chk-subsection").prop("disabled",!1);$(".ejs-cmdShowLess").prop("disabled",!1);$(".ejs-cmdShowMore").prop("disabled",!1)};PowerSearch.ShowMore=function(n){for(var i=n.find(".ejs-powerSearch-subsection"),t=0;t<i.length;t++)$(i[t]).show()};PowerSearch.ShowLess=function(n){var i,r,t;if(n.data("showmore")==!0)for(i=0,r=n.find(".ejs-powerSearch-subsection"),i=n.data("max-element"),t=0;t<r.length;t++)t>=i&&$(r[t]).hide()};PowerSearch.getResultPaging=function(n,t,r,u,f,e,o){var s,h,c;typeof n=="undefined"&&(n=!0);n==!0&&(r=1);typeof r=="undefined"&&(r=ListingProduct.data.pageFrom);typeof u=="undefined"&&(u=ListingProduct.data.pageTo);PowerSearch.DisableSections();s=$("#ListingHeader");s.hide();h=EcomUtils.getLoadingBig(t);t.hide();h.show();$("#PowerSearchSection").length>0&&$("html, body").animate({scrollTop:$("#PowerSearchSection").offset().top-100},50);c=$("#ListingViewMore");c.hide();c.removeAttr("href");$.ajax({cache:!1,async:!0,type:"POST",url:PowerSearch.data.widgetAjaxUrl,data:{categoryId:ListingProduct.data.categoryId,subCategoryId:ListingProduct.data.subCategoryId,widgetCode:ListingProduct.data.widgetCode,displayMode:ListingProduct.data.displayMode,pageFrom:r,pageTo:u,userResultPerPage:ListingProduct.data.userResultPerPage,sortBy:ListingProduct.data.sortBy,sortOrder:ListingProduct.data.sortOrder,filterBy:ListingProduct.data.filterBy,uniqueListingString:ListingProduct.data.searchstring,enterBy:ListingProduct.data.enterBy,widgetUniqueCode:ListingProduct.data.widgetUniqueCode,powerSearchFilter:ListingProduct.data.powerSearchFilter,powerSearchShowedSections:ListingProduct.data.powerSearchSectionsShowed},error:function(n){Utils.handleAjaxUnauthorize(n)||Statusbar.showMessage(TextResources.getText("requesterror"),Utils.messageTypeResult.ERROR);PowerSearch.EnableSections()},success:function(t){var r,u,s,h;if(Utils.handleSuccessAjaxCallResult(t)){for(n?(f.html(t.ProductsSection),e.html(t.PowerSearchSection)):(f.append(t.ProductsSection),e.append(t.PowerSearchSection)),s=$(".ejs-listing-toomanyresults"),h=$(".ejs-product-search-term"),t.TooManyResults?(s.show(),h.hide()):(s.hide(),h.show()),ListingProduct.data.powerSearchSectionsShowed=t.PowerSearchShowedSections,r=ListingProduct.data.powerSearchSectionsShowed.split("|"),i=0;i<r.length;i++)r[i]!=""&&r[i]!=undefined&&(u=$(".ejs-powerSearch-section[data-key='"+r[i]+"']"),$(u).find(".ejs-cmdShowLess").show(),$(u).find(".ejs-cmdShowMore").hide(),PowerSearch.ShowMore($(u)));typeof o=="function"&&o();ListingProduct.restoreScrollHeight()}},complete:function(n,i){h.hide();t.show();s.show();i=="success"&&(EcomUtils.bindProductsImagesRedirect(),ListingProduct.onAjaxComplete(),$forms=$("#formProductListing"),$forms.unbind(),$forms.removeData("validator"),$.validator.unobtrusive.parse($forms))}})};

(function(n){n.slidebars=function(t){function g(){!o.disableOver||typeof o.disableOver=="number"&&o.disableOver>=b?(p=!0,n("html").addClass("sb-init"),o.hideControlClasses&&rt.removeClass("sb-hide"),nt()):typeof o.disableOver=="number"&&o.disableOver<b&&(p=!1,n("html").removeClass("sb-init"),o.hideControlClasses&&rt.addClass("sb-hide"),c.css("minHeight",""),(u||f)&&e())}function nt(){c.css("minHeight","");c.css("minHeight",n("html").height()+"px");i&&i.hasClass("sb-width-custom")&&i.css("width",i.attr("data-sb-width"));r&&r.hasClass("sb-width-custom")&&r.css("width",r.attr("data-sb-width"));i&&(i.hasClass("sb-style-push")||i.hasClass("sb-style-overlay"))&&i.css("marginLeft","-"+i.css("width"));r&&(r.hasClass("sb-style-push")||r.hasClass("sb-style-overlay"))&&r.css("marginRight","-"+r.css("width"));o.scrollLock&&n("html").addClass("sb-scroll-lock")}function w(n,t,u){var f,e;f=n.hasClass("sb-style-push")?c.add(n).add(ut):n.hasClass("sb-style-overlay")?n:c.add(ut);i&&(i.hasClass("sb-style-push")||i.hasClass("sb-style-overlay"))&&i.css("marginLeft","-"+i.css("width"));r&&(r.hasClass("sb-style-push")||r.hasClass("sb-style-overlay"))&&r.css("marginRight","-"+r.css("width"));v==="translate"?f.css("transform","translate("+t+")"):v==="side"?(t[0]==="-"&&(t=t.substr(1)),t!=="0px"&&f.css(u,"0px"),setTimeout(function(){f.css(u,t)},1)):v==="jQuery"&&(t[0]==="-"&&(t=t.substr(1)),e={},e[u]=t,f.stop().animate(e,400));setTimeout(function(){t==="0px"&&(f.removeAttr("style"),nt())},400)}function h(t){function o(){p&&t==="left"&&i?(n("html").addClass("sb-active sb-active-left"),i.addClass("sb-active"),w(i,i.css("width"),"left"),setTimeout(function(){u=!0},400)):p&&t==="right"&&r&&(n("html").addClass("sb-active sb-active-right"),r.addClass("sb-active"),w(r,"-"+r.css("width"),"right"),setTimeout(function(){f=!0},400))}t==="left"&&i&&f||t==="right"&&r&&u?(e(),setTimeout(o,400)):o()}function e(t){(u||f)&&(u&&(w(i,"0px","left"),u=!1),f&&(w(r,"0px","right"),f=!1),setTimeout(function(){n("html").removeClass("sb-active sb-active-left sb-active-right");i&&i.removeClass("sb-active");r&&r.removeClass("sb-active");typeof t!="undefined"&&(window.location=t)},400))}function k(n){n==="left"&&i&&(u?e():h("left"));n==="right"&&r&&(f?e():h("right"))}function l(n,t){n.stopPropagation();n.preventDefault();n.type==="touchend"&&t.off("click")}var o=n.extend({siteClose:!0,scrollLock:!1,disableOver:!1,hideControlClasses:!1},t),s=document.createElement("div").style,tt=!1,it=!1,c,i,u,r,f,v;(s.MozTransition===""||s.WebkitTransition===""||s.OTransition===""||s.transition==="")&&(tt=!0);(s.MozTransform===""||s.WebkitTransform===""||s.OTransform===""||s.transform==="")&&(it=!0);var a=navigator.userAgent,y=!1,d=!1;/Android/.test(a)?y=a.substr(a.indexOf("Android")+8,3):/(iPhone|iPod|iPad)/.test(a)&&(d=a.substr(a.indexOf("OS ")+3,3).replace("_","."));(y&&y<3||d&&d<5)&&n("html").addClass("sb-static");c=n("#sb-site, .sb-site-container");n(".sb-left").length&&(i=n(".sb-left"),u=!1);n(".sb-right").length&&(r=n(".sb-right"),f=!1);var p=!1,b=n(window).width(),rt=n(".sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close"),ut=n(".sb-slide");g();n(window).resize(function(){var t=n(window).width();b!==t&&(b=t,g(),u&&h("left"),f&&h("right"))});tt&&it?(v="translate",y&&y<4.4&&(v="side")):v="jQuery";this.slidebars={open:h,close:e,toggle:k,init:function(){return p},active:function(n){return n==="left"&&i?u:n==="right"&&r?f:void 0},destroy:function(n){n==="left"&&i&&(u&&e(),setTimeout(function(){i.remove();i=!1},400));n==="right"&&r&&(f&&e(),setTimeout(function(){r.remove();r=!1},400))}};n(".sb-toggle-left").on("touchend click",function(t){l(t,n(this));k("left")});n(".sb-toggle-right").on("touchend click",function(t){l(t,n(this));k("right")});n(".sb-open-left").on("touchend click",function(t){l(t,n(this));h("left")});n(".sb-open-right").on("touchend click",function(t){l(t,n(this));h("right")});n(".sb-close").on("touchend click",function(t){if(n(this).is("a")||n(this).children().is("a")){if(t.type==="click"){t.preventDefault();var i=n(this).is("a")?n(this).attr("href"):n(this).find("a").attr("href");e(i)}}else l(t,n(this)),e()});c.on("touchend click",function(t){o.siteClose&&(u||f)&&(l(t,n(this)),e())})}})(jQuery);

