function showNodesByAutoPopup(n){var t="/catalogues/parts/nodesbyautopopup.aspx?rnd="+(new Date).valueOf(),i;return n&&(n.vendor&&(t+="&vendor="+n.vendor),n.model&&(t+="&model="+n.model),n.year&&(t+="&year="+n.year),n.modif&&(t+="&modif="+n.modif),n.modifID&&(t+="&modifID="+n.modifID),n.carName&&(n.carName.includes(" ")&&(n.carName=encodeURI(n.carName)),t+="&carName="+n.carName)),$(document.body).append("<div class='popup2-abs popup2-nodesbyauto'><\/div>"),i=$("div.popup2-nodesbyauto"),i.load(t,function(){i.find(".closePopup").click(function(){e&&e.preventDefault();popup.close($(".popup2-nodesbyauto")[0])});popup.show("popup2-nodesbyauto");initUlTreeNodes()}),!1}function eventWinScroll(){getMQ("min-width","sm")&&showYMapOnceFilter()}function showYMapOnceFilter(){var t,n;document.body.getAttribute("data-ymaploaded")||(t=document.documentElement.clientHeight,document.getElementById("divRegionMap")&&(n=document.getElementById("divRegionMap").getBoundingClientRect(),(n.top<0||t>n.top)&&(showRegionsMapFilter(),document.body.setAttribute("data-ymaploaded","1"))))}function showRegionsMapFilter(){if(!window.jQuery){setTimeout("showRegionsMapFilter()",500);return}var n="/Scripts/MapInPanel.ashx?region=Moscow";$.get(n,function(t){maps.divRegionMap?initYMapData("divRegionMap",t):initYmap("divRegionMap",{pointsURL:n})})}function showNodesByVinPopup(n,t){var r,u="/catalogues/parts/nodesbyvinpopup.aspx?rnd="+(new Date).valueOf(),f=$(t).closest(".divPartSearchByVin"),i;return f.length&&(r=f.find("#txtVin").val(),r.length&&(u+="&vin="+r)),n&&(n.vin&&(u+="&vin="+n.vin,r=n.vin),n.node&&(u+="&node="+n.node)),r&&(i=$("div.popup2-nodesbyvin"),i.length==0&&($(document.body).append("<div class='popup2-abs popup2-nodesbyvin stayInDOM'><\/div>"),i=$("div.popup2-nodesbyvin")),i.load(u,function(){var t=i.find(".popupVin-img").length,n;i.find(".closePopup").click(function(){hideNodesByVinPopup()});popup.show("popup2-nodesbyvin");t&&(i.find(".popupVin-wrapper").addClass("popupVin-wrapperWide"),n=i.find(".vinNodeDetails_title").first(),n.addClass("active"),n.next().removeClass("vinNodeDetails_collapsed"),i.find(".vinNodeDetails").first().addClass("active"),setTimeout(()=>window.dispatchEvent(new Event("resize")),400),$("#divTabNodes").click(function(){i.find(".popupVin-wrapper").removeClass("popupVin-wrapperWide");i.find(".popupVin-img").addClass("hidden")}));initUlTreeNodes()})),!1}function sendPartSearchCallBack(){if(updateCustomValidity($("#divPartSearchForm"))){$(document.body).append("<div class='popup2-abs popup2-callback'><\/div>");var n=$("div.popup2-callback"),t=$("#divPartSearchForm").find("input, textarea").serialize();$.post("/CallBackPopup.aspx?cmd=send&new=1",t,function(t){n.html(t);initCallBackPopup(n)});popup.show("popup2-callback")}return!1}var SmartSearch={updateFilterTimeout:null,firstLoadFilterFlag:!1,createUpdateTimeout:function(){this.clearUpdateTimeout();this.updateFilterTimeout=setTimeout(function(){SmartSearch.updateFilter()},700)},clearUpdateTimeout:function(){this.updateFilterTimeout&&(clearTimeout(this.updateFilterTimeout),this.updateFilterTimeout=null)},pnlFilter:null,firstInitiated:!1,showSizesPopupAfterDDLChanged:!1,priceChangedFlag:0,initStart:function(n){var i,t,r,u,f,e;if(typeof addScript=="undefined"){setTimeout(SmartSearch.initStart,200);return}if(!window.jQuery&&n!=1){addScript("/Scripts/jQuery/jquery-2.1.4.min.js",function(){SmartSearch.initStart(1)});return}if(!window.jQuery.ui&&n!=2){addScript("/Scripts/jQuery/ui-1.11.4.custom/jquery-ui.min.js",function(){SmartSearch.initStart(2)});return}if(!window.jQuery.ui.draggable&&n!=3){addScript("/Scripts/jQuery/ui-1.11.4.custom/jquery-ui-touch-punch.min.js",function(){SmartSearch.initStart(3)});return}this.pnlFilter=$(".tabs2-filterRed").parent();this.pnlFilter.length==0&&(this.pnlFilter=$(".filterRed-inner:eq(0)").parent());$(".lnk-showMoreItems_redFilterPage").click(function(){var n=parseInt($(this).attr("data-start")),i=parseInt($(this).attr("data-count")),r=$(this).attr("data-type"),u="/catalogues/SmartSearch/SpecsJquery.aspx?pageSize=20&start="+n+"&diameter="+$(this).attr("data-diameter")+"&type="+r,t=$(this).parent();$("div.updFilter").parent().show();$.get(u,function(n){var i=t.find(".lnk-showMoreItems_redFilterPage");i.length==0?t.append(n):i.before(n);$("div.updFilter").parent().hide()});n+20<i?$(this).attr("data-start",n+20):$(this).remove()});document.location.hash=="#bysize"?($("#hiddFilterType").val("bySize"),getMQ("max-width","xs")&&document.location.href.indexOf("/bysize/")==-1&&(document.location.href.indexOf("/podbor-diskov")!=-1||document.location.href.indexOf("/podbor-shin")!=-1)&&(i=new Date,t=timeCurr=0,t=setInterval(function(){if(document.querySelector(".filterRed.filterRed-wrapper"))clearInterval(t),timeCurr=0,window.filterRed.toExpand(document.getElementsByClassName("filterRed-compactBtn")[0]);else if(timeCurr=new Date,timeCurr-i>=5e3){clearInterval(t);timeCurr=0;return}},500))):getMQ("max-width","xs")&&document.location.href.indexOf("bysize")==-1&&document.location.href.indexOf("FilterType")==-1&&(document.location.href.indexOf("/podbor-diskov.aspx")!=-1||document.location.href.indexOf("/podbor-shin.aspx")!=-1||document.location.href.indexOf("/podbor-gruzovyh-shin.aspx")!=-1)&&(i=new Date,t=timeCurr=0,t=setInterval(function(){if(document.querySelector(".filterRed.filterRed-wrapper"))clearInterval(t),timeCurr=0,window.filterRed.toExpand(document.getElementsByClassName("filterRed-compactBtn")[0]);else if(timeCurr=new Date,timeCurr-i>=5e3){clearInterval(t);timeCurr=0;return}},500));Sys.Application.add_load(function(){SmartSearch.init();this.firstLoadFilterFlag&&SmartSearch.shortedDdlsByAuto()});filterRed.init();collapseLists.init();this.init();r=$("#txtVin");u=$("#txtVin").val();u===""?r.closest(".innerOneField").removeClass("cart-vin"):r.closest(".innerOneField").addClass("cart-vin");f=$('[data-tabn="byCae"]');e=$('[data-tabn="byAuto"]');document.location.search.toLowerCase()=="?bycae"?f.click():document.location.search.toLowerCase()=="?byauto"?e.click():document.location.pathname.toLowerCase()=="/zapchasti.aspx"&&$("#aShowNodesByVin").click()},init:function(){var n,t,i;(this.firstLoadFilterFlag||(SmartSearch.shortedDdlsByAuto(),this.firstLoadFilterFlag=!0),$("#hiddFilterType").attr("data-init")!="1")&&($("#hiddFilterType").attr("data-init","1"),this.initSliders(),this.pnlFilter.find("select").change(function(){SmartSearch.updateFilter(this)}),this.pnlFilter.find(":checkbox,:radio").change(function(n){function u(n){var u=n.closest(".filterRed-producersModels").find('input[type="checkbox"]'),t=n.closest(".filterRed-producersModels").prev().prev().find('input[type="checkbox"]'),i=[],r;u.each(function(n,t){i.push($(t).is(":checked"))});r=!i.filter(n=>!n).length;r?(t.prop("checked",!0),t.parent().addClass("radCheck-itemsSelected")):(t.prop("checked",!1),t.parent().removeClass("radCheck-itemsSelected"))}var t=$(n.target),r=t.parent().hasClass("radCheck-producerParent"),i;r?(i=t.closest("li").find('.filterRed-producersModels input[type="checkbox"]'),t.is(":checked")?i.each(function(n,t){$(t).prop("checked",!0)}):i.each(function(n,t){$(t).prop("checked",!1)})):u(t);SmartSearch.updateFilter()}),n=this.pnlFilter.find("div[data-tabs='tabs-wrapper_filter'] div[data-tabn]"),n.click(function(){$("#hiddFilterType").val($(this).attr("data-tabn"))}),n.filter(".active").attr("data-tabn")!=$("#hiddFilterType").val()&&n.filter("[data-tabn='"+$("#hiddFilterType").val()+"']").click(),t=$(".popup2-filterRedSizes .row_oemTune"),t.length>0?($.each(t.filter(".active"),function(){SmartSearch.pickSize(this,!0)}),$("#divSelectedSizes").parent().show()):$("#divSelectedSizes").parent().hide(),this.showSizesPopupAfterDDLChanged&&popup.show("popup2-filterRedSizes"),this.showSizesPopupAfterDDLChanged=!1,i=document.getElementById("pFilterCount"),i&&($(i).click(function(){$("#btnFilterSearch")[0].click()}),this.firstInitiated&&glidedPnl.update()),this.firstInitiated?(filterRedParams.selectedItems(),filterRed.showAllItemsList()):this.firstInitiated=!0)},initSliders:function(){var n=/\s/,t=this.pnlFilter.find(".ui-slider");$.each(t,function(){var i=$(this),t=i.closest(".filterRed-section"),o=parseInt(t.find("input[type='hidden']:eq(0)").val()),s=parseInt(t.find("input[type='hidden']:eq(1)").val()),u=t.find("input[type='text']:eq(0)"),f=t.find("input[type='text']:eq(1)"),e=parseInt(u.val().replace(n,"")),r;e||(e=o,u.attr("value",e));r=parseInt(f.val().replace(n,""));r||(r=s,f.attr("value",r));i.data("lastLow",e);i.data("lastHigh",r);i.slider({range:!0,values:[e,r],min:o,max:s,slide:function(n,t){typeof t.values[0].toLocaleString=="function"?(u.val(t.values[0].toLocaleString("ru-RU")),f.val(t.values[1].toLocaleString("ru-RU"))):(u.val(t.values[0]),f.val(t.values[1]))},stop:function(n,t){(t.values[0]!=$(this).data("lastLow")||t.values[1]!=$(this).data("lastHigh"))&&($(this).data("lastLow",t.values[0]),$(this).data("lastHigh",t.values[1]),SmartSearch.updateFilter())},change:function(){window.SmartSearch.priceChangedFlag=1}});u.change(function(){SmartSearch.sliderInputsChanged(t,i)});f.change(function(){SmartSearch.sliderInputsChanged(t,i)});window.SmartSearch.priceChangedFlag&&t.addClass("active")});try{t.draggable()}catch(i){console.log(i)}},sliderInputsChanged:function(n,t){var u=/\s/,f=n.find("input[type='text']:eq(0)"),e=n.find("input[type='text']:eq(1)"),o=parseInt(n.find("input[type='hidden']:eq(0)").val()),s=parseInt(n.find("input[type='hidden']:eq(1)").val()),r=parseInt(f.val().replace(u,"")),i;r<o&&(r=o,f.val(r));i=parseInt(e.val().replace(u,""));i>s&&(i=s,e.val(i));t.slider("option",{values:[r,i]});SmartSearch.updateFilter()},updateFilter:function(n){n&&($("#__EVENTTARGET").val(n.id),$(n).attr("data-type")=="modif"&&$(n).val()&&document.getElementById("divSelectedSizes")&&(this.showSizesPopupAfterDDLChanged=!0));$("#btnFilterChanged").click();$(".filterRed-spinner").addClass("shown");setTimeout(()=>{this.shortedDdlsByAuto(),collapseLists.initOnAjax(),n==undefined&&document.getElementById("pFilterCount")&&document.getElementById("pFilterCount").classList.add("hover")},2e3)},shortedDdlsByAuto:function(){var r,n,u,t,i;(n=document.getElementById("shortedRecordDdlsByAuto"))&&(r=document.getElementById("divModifications"))&&(u=r.querySelector("select"),u.selectedIndex>0?(t=document.getElementById("ctl00_cphFilter_ddlVendors"))&&(i=document.getElementById("ctl00_cphFilter_ddlYears"),n.querySelector(".shortedRecordDdls-dataAuto").textContent=t.options[t.selectedIndex].textContent+" "+i.options[i.selectedIndex].textContent,n.classList.add("d-flex")):n.classList.remove("d-flex"))}},filterRed,filterRedParams,collapseLists,fnDelay;window.jQuery?SmartSearch.initStart():setTimeout(function(){SmartSearch.initStart()},1e3);filterRed={filter:undefined,btnToCompact:undefined,btnToExpand:undefined,noNeededCollaps:[],init:function(){document.getElementsByClassName("filterRed-wrapper")[0]&&(this.filter||(this.filter=document.getElementsByClassName("filterRed-wrapper")[0]))},isXS:function(){return Modernizr.mq("(max-width: 767px)")?!0:!1},toExpand:function(n){self=window.filterRed;self.btnToCompact=n;n.classList.add("hideAnim");document.body.className+=" filterRed_opened overlay2";setTimeout(function(){window.filterRed.filter.classList.add("filterRed-wrapper_expandMode")},0)},toCompact:function(n){n&&(this.btnToExpand=n);this.filter.classList.remove("filterRed-wrapper_expandMode");document.body.classList.remove("filterRed_opened");document.body.classList.remove("overlay2");setTimeout(function(){window.filterRed.btnToCompact.classList.remove("hideAnim")},0)},onResize:function(){this.isXS()&&this.filter?(this.btnToCompact||(this.btnToCompact=document.getElementsByClassName("filterRed-compactBtn")[0]),!this.filter.classList.contains("filterRed-wrapper_expandMode")&&this.btnToCompact&&this.btnToCompact.classList.remove("hideAnim")):this.filter&&(this.filter.classList.remove("filterRed-wrapper_expandMode"),this.filter.removeAttribute("style"))},showAllItemsList:function(n){var t,i,r;if(n)t=n.parentNode.querySelector(".radCheck-aspNetList"),!isValInArr(t.id,this.noNeededCollaps)&&document.getElementById(t.id).classList.contains("radCheck-aspNetList_partCollapsed")?this.noNeededCollaps.push(t.id):isValInArr(t.id,this.noNeededCollaps)&&document.getElementById(t.id).classList.contains("radCheck-aspNetList_partUnCollapsed")&&removeValInArr(t.id,this.noNeededCollaps),t.classList.contains("radCheck-aspNetList_partCollapsed")?(t.classList.remove("radCheck-aspNetList_partCollapsed"),t.classList.add("radCheck-aspNetList_partUnCollapsed"),glidedPnl.update()):(t.classList.remove("radCheck-aspNetList_partUnCollapsed"),t.classList.add("radCheck-aspNetList_partCollapsed"),t.parentNode.getBoundingClientRect().top<0&&(t.parentNode.scrollIntoView(!0),window.scrollBy(0,-60)));else if(this.noNeededCollaps.length)for(i=0,r=this.noNeededCollaps.length;i<r;i++)document.getElementById(this.noNeededCollaps[i])&&(document.getElementById(this.noNeededCollaps[i]).classList.remove("radCheck-aspNetList_partCollapsed"),document.getElementById(this.noNeededCollaps[i]).classList.add("radCheck-aspNetList_partUnCollapsed"))}};filterRedParams={hiddContent:undefined,init:function(n){var t=n.parentNode;this.hiddContent=t.getElementsByClassName("hiddContent")[0];t.classList.contains("active")?this.hide(t):this.show(t)},hide:function(n){if(this.hiddContent){var t=this;t.selectedItems(n);t.hiddContent.classList.add("hideAnim");setTimeout(function(){n.classList.remove("active");t.hiddContent.classList.remove("hideAnim");t.hiddContent.classList.remove("showAnim");t.hiddContent.removeAttribute("style")},300)}},show:function(n){if(n.classList.add("active"),this.hiddContent){var t=this;setTimeout(function(){t.hiddContent.style.height=t.hiddContent.scrollHeight+"px";t.hiddContent.classList.add("showAnim")},15)}},reset:function(){var t,n,i;if(document.getElementsByClassName("filterRed")[0]&&Modernizr.mq("(min-width: 768px)"))for(t=document.getElementsByClassName("filterRed")[0].querySelectorAll("div.filterRed-section.active"),n=0,i=t.length;n<i;n++)(function(n){var t;n.classList.remove("active");(t=n.getElementsByClassName("hiddContent")[0])&&(t.classList.remove("showAnim"),t.classList.remove("hideAnim"),t.removeAttribute("style"))})(t[n])},selectedItems:function(n){var i,t,r;if(n)for(i=n.getElementsByTagName("input"),t=0,r=i.length;t<r;t++)i[t].checked?$(i[t]).closest("li").addClass("selected"):$(i[t]).closest("li").removeClass("selected");else if(document.getElementsByClassName("filterRed")[0]&&filterRed.isXS)for(i=document.getElementsByClassName("filterRed")[0].querySelectorAll(".hiddContent input"),t=0,r=i.length;t<r;t++)i[t].checked&&$(i[t]).closest("li").addClass("selected")},showHiddenItems:function(n){var u=n.parentNode,t=u.querySelectorAll(".hidden"),i,r;if(t.length)for(n.parentNode.removeChild(n),t[0].parentNode.classList.contains("showAnim")&&t[0].parentNode.removeAttribute("style"),i=0,r=t.length;i<r;i++)t[i].classList.remove("hidden")}};collapseLists={lists:undefined,inervalId:0,btn:'<span class="lnk-abs lnk-white lnk-dotted lnk-showAll_filterRed lnk-showAll_collapseList novisited"><span class="lnk-inner"><span class="lnk-txt"><span class="toShow">Показать <span class="name">все<\/span><\/span><span class="toHide">Скрыть <span class="name"><\/span><\/span><\/span><\/span><\/span>',init:function(){var n,t,i;if(!getMQ("max-width","xs")&&(n=window.collapseLists,n.lists=document.querySelectorAll("[data-collapse]"),n.lists.length))for(t=0,i=n.lists.length;t<i;t++)n.oneList(n.lists[t])},initOnAjax:function(){self=window.collapseLists;self.inervalId=setInterval(function(){document.querySelector("[data-collapse]")&&(clearInterval(self.inervalId),self.init())},30)},oneList:function(n){var r=n.getAttribute("data-collapse"),i=n.getElementsByTagName("li"),t;for(this.appendBtn(n),t=i.length-1;t>=r;t--)i[t].classList.add("hidden")},appendBtn:function(n){n.insertAdjacentHTML("afterend",this.btn);var t=n.nextSibling,i=closeTxt="";(i=n.getAttribute("data-collapse-open"))&&(t.querySelector(".toShow .name").textContent=i);(closeTxt=n.getAttribute("data-collapse-close"))&&(t.querySelector(".toHide .name").textContent=closeTxt);t.onclick=function(t){window.collapseLists.btnClick(t,n)}},btnClick:function(n,t){$(n.target).closest(".lnk-showAll_collapseList").toggleClass("active");t.classList.toggle("active");!t.classList.contains("active")&&t.parentNode.getBoundingClientRect().top<0&&(t.parentNode.scrollIntoView(!0),window.scrollBy(0,-60))}};window.addEventListener("scroll",function(){fnDelay(function(){eventWinScroll();$&&$("#pFilterCount").removeClass("hover")},300)},!1);fnDelay=function(){var n=0;return function(t,i){clearTimeout(n);n=setTimeout(t,i)}}()