const Header={calc:function(){let sizes=["watch","mobile","tablet","netbook","laptop","desktop"];let header=$("header").addClass(sizes.join(" "));let title=header.find("h1");let icons=header.find(".icons");let size;while(size=sizes.pop()){if(icons.position().top<=title.position().top+10){break}header.removeClass(size)}if(header.hasClass("laptop")&&header.find(".Burger").hasClass("open")){header.find(".Burger").click()}}};$(function(){if($(".Cart").length){let h=$("header").addClass("watch mobile");h.find("nav section").addClass("slim").find(".Burger, ul, form").remove();h.find("aside").remove();$("footer").remove();return}Header.calc();$(window).resize(function(){Header.calc()});$("header a.Burger").click(function(e){e.preventDefault();let s=$(this).siblings("ul.icons").find("li.search a");if(s.hasClass("open")){s.click();setTimeout(function(){$("header .Burger").click()},400);return}let toggle=$("header aside, header nav ul.views, header nav ul.langs").stop();if($(this).toggleClass("open").hasClass("open")){$("header").attr("style","height:100vh;z-index:2").siblings().attr("style","display:none");toggle.slideDown(400)}else{toggle.slideUp(400,function(){$("header").attr("style","").siblings().attr("style","")})}});$("header ul.icons li.search a").click(function(e){e.preventDefault();let b=$("header a.Burger");if(b.hasClass("open")){b.click();setTimeout(function(){$("header ul.icons li.search a").click()},400);return}$(this).toggleClass("open");$("header form").slideToggle(400,function(){$("header form input").focus()})});$("header form a").click(function(e){e.preventDefault();let f=$(this).closest("form");let i=f.find("input");if(!i.val()){i.focus();return}f.submit()})}); const Actions={};gtag("consent","default",{ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"granted"});$(function(){let Actions_run=function(e){let list=$(this).data("action").split(" ");for(let k in list){Actions[list[k]](e,this)}};$("body").on("click","a[data-action]",Actions_run).on("change","input[data-action]",Actions_run).on("submit","form[data-action]",Actions_run);if(cookie_get("gdpr_hide")==="1"){Actions.gdpr_save()}let outbound_nofollow=setInterval(()=>{$(".klix_later").each(()=>{let kpl=$(this).find("klix-pay-later");if(kpl.length){$(kpl[0].shadowRoot).find(".klix-widget-container").css("max-width","none").find("a").attr("rel","nofollow")}})},500);setTimeout(()=>{clearInterval(outbound_nofollow)},2e3);$(".Spec span[title]").on("click",function(){Overlay.dialog($(this).text(),$(this).attr("title"))});$("form.voucher input").on("change",function(){$.post("/lv/cart/",{coupon:this.checked?$(this).val():"none"},function(){window.location.reload()})})});const Api={};Api.call=function(method,get_data,post_data,callback){get_data.lang=$("html").attr("lang");$.post("/API/"+method+"/json?"+$.param(get_data),post_data,function(reply){if(reply){if(typeof reply.error!=="undefined"){Overlay.dialog("Error",reply.error[0].text);return}if(typeof reply.alert!=="undefined"){Overlay.dialog("Alert",reply.alert[0].text);reply.alert=null}}callback(reply)},"json")};Api.error=function(data){let req=new XMLHttpRequest;req.open("POST","/APP/js_error/");req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("msg="+encodeURIComponent(JSON.stringify(data)));Api.error=function(){}};window.onerror=function(msg,file,line,col,error){Api.error(window.location.href+": "+msg+" on "+file+":"+line+":"+col+", "+JSON.stringify(error))};function cookie_set(name,value,days){let expires="";if(days){let date=new Date;date.setTime(date.getTime()+days*24*60*60*1e3);expires="; expires="+date.toGMTString()}document.cookie=name+"="+value+expires+"; secure; path=/"}function cookie_get(name){let value="; "+document.cookie;let parts=value.split("; "+name+"=");return parts.length===2?parts.pop().split(";").shift():null}const Form={};Form.init=function(){$("input[data-datetime]").each(function(){$(this).datetimepicker({dayOfWeekStart:1,format:$(this).attr("data-datetime")})})};$(function(){$('.Form input[type="checkbox"], .Form input[type="radio"]').wrap('
').after("
").closest("label").addClass("pointer");$(".Form").on("focus","label.text > input, label.text > textarea",function(){$(this).closest("label").addClass("active")}).on("blur","label.text > input, label.text > textarea",function(){$(this).closest("label").removeClass("active")});Form.init();$(".Form2").on("focus","input, textarea",function(){$(this).closest(".Form2 div.block").addClass("active")}).on("blur","input, textarea",function(){$(this).closest(".Form2 div.block").removeClass("active")})});const fitWindow={calc:function(){let top=$(window).scrollTop();let bot=top+$(window).height();$(".fitWindow").each(function(){let off_top=$(this).offset().top;let pos_top=$(this).position().top;let pos_bot=off_top+$(this).height()+parseInt($(this).css("bottom"));$(this).css("top",Math.max(top-(off_top-pos_top),0)+"px");$(this).css("bottom",Math.max(pos_bot-bot,0)+"px")})}};const Group={};$(function(){$("main section.Group.small .results").css("position","relative");$('main section.Group.big a[href="#filters"]').click(function(e){e.preventDefault();$(this).closest(".info").siblings(".filters").stop().slideToggle()});$('main section.Group.big select[name="sort"]').change(function(){cookie_set("sort",$(this).val());location.reload()});$("main section.Group.big div.filters div label input").on("click",function(e){e.preventDefault();document.location="?spec="+$(this).val()})});const Misc={cart_count:function(count){$("header .icons sup").text(count).css("display","inline");Header.calc()}};const Overlay={dialog:function(title,body){$("body").append($('
'+'

'+title+'

'+'
'+body+"
"+"
"))}};const Price={init:function(){$(".Price").each(function(){let price,vat,t=$(this);if(this.hasAttribute("data-price")){price=t.attr("data-price")}else{price=t.text();t.attr("data-price",price)}if(this.hasAttribute("data-vat")){vat=t.attr("data-vat")}else{vat="X";t.attr("data-vat",vat)}t.text(Price.price_vat(parseFloat(price),vat).toFixed(2))})},price:function(price){return Math.round(price*100)/100},price_vat:function(price,vat_type){return Math.round(price*(vat_type==="R"||vat_type==="E"||vat_type==="0"?100:121))/100},vat:function(price,vat_type){return Math.round((Price.price_vat(price,vat_type)-Price.price(price))*100)/100}};$(function(){Price.init()});const Slider={x:null,y:null,speed:null,speed_ads:0,touch:null,timer:null,timer_ads:null,easing:"swing",resize:null,init:function(){$(".Slider ol.index li:first").addClass("open");$(".Slider ol.index li a").click(function(e){if(e.screenX||e.screenY){clearInterval(Slider.timer_ads)}e.preventDefault();$(this).parent().addClass("open").siblings(".open").removeClass("open");clearInterval(Slider.timer);let nr=$(this).parent().index();$(this).closest(".Slider").find(".stick").each(function(){let first=$(this).find("> *:first-child");let step=Math.round(first.outerWidth()*-100/$(this).outerWidth());$(this).find("> *:first-child").stop().animate({"margin-left":nr*step+"%"},{easing:Slider.easing})});let ct=$(this).parent().siblings().length;Slider.reset_ads($(this).closest(".Slider"))});$(".Slider.ads ol.index li a").first().click();$('.Slider.ads a[href="#back"]').click(function(e){if(e.screenX||e.screenY){clearInterval(Slider.timer_ads)}e.preventDefault();let open=$(this).siblings("ol").find("li.open");(open.prev().length?open.prev():open.siblings().last()).find("a").click()});$('.Slider.ads a[href="#next"]').click(function(e){if(e.screenX||e.screenY){clearInterval(Slider.timer_ads)}e.preventDefault();let open=$(this).siblings("ol").find("li.open");(open.next().length?open.next():open.siblings().first()).find("a").click()});Slider.timer_ads=setInterval(function(){$('.Slider a[href="#next"]').click()},1e4);$(".Slider.ads").each(function(){if($(this).find("> ol > li").length<=1){$(this).find("> a").css("display","none");$(this).find("> ol").css("display","none")}});if(!Slider.is_touch_device()){$(".Slider .swipe").removeClass("swipe").addClass("swipe_0")}$(".Slider .swipe").each(function(){this.addEventListener("touchstart",function(e){clearInterval(Slider.timer_ads);clearInterval(Slider.timer);let t=e.changedTouches[0];Slider.x=t.pageX;Slider.y=t.pageY},false);this.addEventListener("touchmove",function(e){let t=e.changedTouches[0];let x=t.pageX-Slider.x;let y=t.pageY-Slider.y;Slider.x=t.pageX;Slider.y=t.pageY;if(Math.abs(y)>Math.abs(x)){Slider.speed=0;return}e.preventDefault();Slider.swipe(this,x);Slider.speed=x},false);this.addEventListener("touchend",function(){if($(this).hasClass("stick")){let cw=parseFloat(getComputedStyle(this.children[0]).width);let cp=parseFloat(getComputedStyle(this.children[0]).marginLeft);let nr=-cp/cw;nr=Slider.speed<0?Math.ceil(nr):Math.floor(nr);Slider.easing="linear";$(this).closest(".Slider").find("ol.index li:nth-child("+(nr+1)+") a").click();Slider.easing="swing";return}Slider.touch=this;Slider.timer=setInterval(function(){Slider.speed=Math.round(Slider.speed*970)/1e3;if(Slider.speed>-1&&Slider.speed<1||!Slider.swipe(Slider.touch,Slider.speed/3)){clearInterval(Slider.timer)}},3)},false)})},reset:function(slider){$(slider).find(".swipe").each(function(){let width=0;for(let k=0;k div").show().each(function(){if($(this).position().top>=1){$(this).hide()}});$(".swipe_0[data-oneLine_is]").each(function(){if($(this).children().last().position().top){$(this).removeClass("oneLine_is")}else{$(this).addClass("oneLine_is")}});Slider.reset_ads($(slider))},reset_ads:function(slider){if(slider.hasClass("ads")){let nr=slider.find("ol li.open").index(),ul=slider.find("> ul");ul.stop().animate({height:ul.find("> li:nth-child("+(nr+1)+")").height()+"px"},{easing:Slider.easing,duration:Slider.speed_ads});Slider.speed_ads=400}},swipe:function(swipe,x_move){let active=false;$(swipe).closest(".Slider").find(".swipe").each(function(){let x_old=parseFloat(getComputedStyle(this.children[0]).marginLeft)||0;let x_new=Math.max(this.dataset.swipeMin,Math.min(0,x_old+x_move));if(x_old!==x_new){this.children[0].style.marginLeft=x_new+"px";active=true}});return active},is_touch_device:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch||window.matchMedia(["("," -webkit- -moz- -o- -ms- ".split(" ").join("touch-enabled),("),"heartz)"].join("")).matches}};$(function(){Slider.init();$(window).resize(function(){if(Slider.resize===window.innerWidth){return}Slider.resize=window.innerWidth;$(".Slider").each(function(){Slider.reset(this)})});$(".Slider").each(function(){Slider.reset(this)})});const Sticky={calc:function(){let top=$(window).scrollTop();$(".Sticky.bound").each(function(){let pos=$(this).parent().offset().top+($(this).data("sticky_offset")||0);if(top>pos){if(!$(this).hasClass("top")){$(this).parent().css("height",getComputedStyle(this).height);$(this).css("width",getComputedStyle(this).width).addClass("top")}}else if($(this).hasClass("top")){Sticky.reset($(this))}});$(".Sticky.inside").each(function(){let min=$(this).parent().offset().top;let max=min+$(this).parent().height()-$(this).outerHeight();$(this).css("top",Math.max(0,Math.min(max,top)-min))})},reset:function(sticky){sticky.css("width","auto").removeClass("top").parent().css("height","auto")}};$(function(){$(".Sticky.bound").each(function(){$(this).wrap("
")});fitWindow.calc();$(window).scroll(function(){fitWindow.calc();Sticky.calc()}).resize(function(){fitWindow.calc();$(".Sticky.bound.top").each(function(){Sticky.reset($(this))});Sticky.calc()})});$(function(){$(".Spec > a").click(function(e){e.preventDefault();$(this).toggleClass("open").next().slideToggle()});$('
').insertBefore(".wysiwyg figure");$(".wysiwyg figure").parent().append('
');$(".Contacts").on("click",'a[href="#"]',function(e){e.preventDefault();let shop=$(this).closest(".shop");let addr=shop.find("[data-lat]").first();shop.addClass("show").siblings(".show").removeClass("show");$("body").addClass("map_show");map_fill();GMaps.map.fitBounds(GMaps.area);GMaps.map.panTo(new google.maps.LatLng(parseFloat(addr.attr("data-lat")),parseFloat(addr.attr("data-lng"))))});$(".Contacts").on("click",'a[href="#map_hide"]',function(e){e.preventDefault();$("body").removeClass("map_show");$("div.shop.show").removeClass("show")});$("body").on("change","form.AutoSubmit input",function(){$(this).closest("form").submit()});setInterval(function(){$.get("/CORE_CMS_API/ping/")},59e3)}); Actions.order_add=function(e,t){e.preventDefault();let item_id=$(t).closest("[data-item_id]").data("item_id");let get={shop_orders:{rows:1}};let post={rows:[{item_id:item_id,count:1}]};let item=$(t).closest(".Item");if(item.length){if(item.find("form.sets").length){let set=item.find('form.sets input[name="set"]:checked');if(set.length){post.rows=[];set=set.val().split("&");for(let k in set){let s=set[k].split("=");post.rows.push({item_id:parseInt(s[0]),count:parseInt(s[1])})}}}else if(item.find("form.rent").length){post.rows[0].from=item.find('input[name="from"]').val();post.rows[0].till=item.find('input[name="till"]').val()}}Api.call("shop_orders",get,post,function(reply){let count=0;for(let k in reply.shop_orders[0].rows){let row=reply.shop_orders[0].rows[k];if(row.status!=="unfinished"){continue}count+=reply.shop_orders[0].rows[k].count}Misc.cart_count(count)});$(t).css("opacity","0").stop().animate({opacity:1});for(let k in post.rows){window.dataLayer.push({event:"cart_add",cart:{items:[{item_id:post.rows[k].item_id,quantity:post.rows[k].count}]}})}};Actions.compare_add=function(e,t){e.preventDefault();let item=$(t).closest("[data-item_id]");let item_id=item.attr("data-item_id");let compare=cookie_get("compare");if(compare===null||compare===""){compare=[]}else{compare=compare.split(",");if(compare.indexOf(item_id)>=0){Overlay.dialog("O-ou!",Terms.compare_error_used);return}if(compare.length>=4){Overlay.dialog("O-ou!",Terms.compare_error_limit);return}}compare.push(item_id);cookie_set("compare",compare.join(","));let img,name;if(item.prop("tagName")==="SECTION"){img=item.find("> .Slider ul img");name=item.find("h2").text()}else{img=item.find("div img");name=item.find("h3").text()}$("div.Compare ul").append('
  • '+''+(img.length?'':"")+"
    "+name+"
    "+''+"
  • ");$("div.Compare .Slider").each(function(){Slider.reset(this)});$("div.Compare").slideDown()};Actions.compare_rem=function(e,t){e.preventDefault();let item=$(t).closest("[data-item_id]");let item_id=item.attr("data-item_id");let compare=cookie_get("compare").split(",");for(let k in compare){if(compare[k]===item_id){compare.splice(k,1);break}}if(compare.length){cookie_set("compare",compare.join(","))}else{cookie_set("compare","",-1);$("div.Compare").slideUp()}if($(".Spec").length){window.location="./"+($('input[data-action="compare_diff"]').is(":checked")?"?diff":"")}else{item.remove()}};Actions.compare_del=function(e){e.preventDefault();cookie_set("compare","",-1);$("div.Compare").slideUp(400,function(){$("div.Compare ul li").remove()})};Actions.compare_diff=function(e,t){if($(t).is(":checked")){window.location="?diff"}else{window.location=window.location.href.replace("?diff","")}};Actions.gdpr_hide=function(e){e.preventDefault();Actions.gdpr_save();$("div.gdpr").slideUp(400,function(){$(this).remove()})};Actions.gdpr_save=function(){cookie_set("gdpr_hide","1",30);gtag("consent","update",{ad_storage:"granted",analytics_storage:"granted",ad_user_data:"granted",ad_personalization:"granted"})};Actions.item_queue=function(e,t){e.preventDefault();let o_id=parseInt($(t).find('input[name="queue"]').val());if(o_id){$.post($(t).attr("action"),{order_id:o_id},function(r){$(".Item .queue form").remove();if(r){$(".Item .queue .result span").text(r).parent().show()}else{$(".Item .queue .error").show()}},"json")}};Actions.overlay_close=function(e,t){e.preventDefault();$(t).closest(".Overlay").hide(0).remove();$(t).closest(".Overlay2").hide(0).remove();cookie_set("overlay","x")};Actions.chat=function(e,t){e.preventDefault();Overlay.dialog($(t).text(),'
    '+'"+'"+'"+''+"
    ")};Actions.chat_stock=function(e,t){e.preventDefault();Overlay.dialog($(t).text(),'
    '+'"+'"+''+"
    ")};Actions.chat_send=function(e,t){e.preventDefault();let form=$(t);let email=form.find('input[name="email"]');let phone=form.find('input[name="phone"]');if(!email.val().trim()&&!phone.val().trim()){email.closest("label").addClass("error");phone.closest("label").addClass("error")}else{email.closest("label").removeClass("error");phone.closest("label").removeClass("error")}let text=form.find("textarea");if(text.length){if(!text.val().trim()){text.closest("label").addClass("error")}else{text.closest("label").removeClass("error")}}if(!form.find("label.error").length){form.find('input[type="submit"]').attr("disabled","disabled");Api.call("chat",{},form.serialize(),function(){$(".Overlay .body").html("

    "+Terms.chat_sent+"

    ")})}};Actions.maillist=function(e,t){e.preventDefault();let form=$(t);let email=form.find('input[name="email"]');if(!email.val().trim()){email.closest("label").addClass("error")}else{email.closest("label").removeClass("error")}if(!form.find("label.error").length){form.find('input[type="submit"]').attr("disabled","disabled");Api.call("maillists",{},form.serialize(),function(){Overlay.dialog(Terms.maillist_sent,"")});form[0].reset()}};