window.isiOS=!1;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){window.isiOS=!0}
window.isiOSVersion='';if(window.isiOS){var version=(navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);if(version!==null){window.isiOSVersion=[parseInt(version[1],10),parseInt(version[2],10),parseInt(version[3]||0,10)]}}
function t_throttle(fn,threshhold,scope){var last;var deferTimer;threshhold||(threshhold=250);return function(){var context=scope||this;var now=+new Date();var args=arguments;if(last&&now<last+threshhold){clearTimeout(deferTimer);deferTimer=setTimeout(function(){last=now;fn.apply(context,args)},threshhold)}else{last=now;fn.apply(context,args)}}}
function t958_init(recId){var rec=document.getElementById('rec'+recId);if(!rec)return;var container=rec.querySelector('.t958');if(!container)return;var sliderContainer=rec.querySelector('.t958__slidecontainer');var items=rec.querySelectorAll('.t958__item');var cards=rec.querySelectorAll('.t958__card');var totalSlides=items.length;if(!totalSlides){return}
var sliderWidth=parseFloat(getComputedStyle(items[0],null).width.replace('px',''));t958_checkSize(rec);sliderContainer.style.width=(sliderWidth*totalSlides)+'px';window.addEventListener('resize',t_throttle(function(){t958_findVisibleCards(rec);t958_initPopup(rec);t958_checkSize(rec);sliderWidth=parseFloat(getComputedStyle(items[0],null).width.replace('px',''));sliderContainer.style.width=(sliderWidth*totalSlides)+'px';var matrix=(getComputedStyle(sliderContainer,null).transform||'').replace(/[^0-9\-.,]/g,'').split(',');var x=matrix[12]||matrix[4];if(-((totalSlides-1)*sliderWidth)>x){sliderContainer.style.transform='translate(-'+(totalSlides-1)*sliderWidth+'px, 0)'}}));if(typeof jQuery!=='undefined'){$(container).bind('displayChanged',function(){sliderContainer.style.width='100%';setTimeout(function(){sliderWidth=parseFloat(getComputedStyle(items[0],null).width.replace('px',''));sliderContainer.style.width=(sliderWidth*totalSlides)+'px';t958_checkSize(rec);t958_findVisibleCards(rec);t958_initPopup(rec)},300)})}else{container.addEventListener('displayChanged',function(){sliderContainer.style.width='100%';setTimeout(function(){sliderWidth=parseFloat(getComputedStyle(items[0],null).width.replace('px',''));sliderContainer.style.width=(sliderWidth*totalSlides)+'px';t958_checkSize(rec);t958_findVisibleCards(rec);t958_initPopup(rec)},300)})}
rec.querySelector('.t958__next').addEventListener('click',function(){t958_slide(rec,'right')});rec.querySelector('.t958__previous').addEventListener('click',function(){t958_slide(rec,'left')});if(window.innerWidth>640){t958_findVisibleCards(rec)}else{t_onFuncLoad('Hammer',function(){t958_initSliderSwipe(rec)});for(var i=0;i<cards.length;i++){cards[i].classList.add('t958__card-visible')}}
t958_initPopup(rec);var isiOS=/iPhone|iPad|iPod/i.test(navigator.userAgent)||(navigator.userAgent.indexOf('Macintosh')&&'ontouchend' in document);if(isiOS){var activeIndex;var activeSlide;if(document.readyState==='complete'){activeIndex=container.getAttribute('data-slide-pos');if(activeIndex)activeIndex=parseInt(activeIndex,10);activeSlide=typeof activeIndex==='number'?items[activeIndex]:null;if(activeSlide)t958__hideMobileSlides(activeSlide)}else{window.addEventListener('load',function(){activeIndex=container.getAttribute('data-slide-pos');if(activeIndex)activeIndex=parseInt(activeIndex,10);activeSlide=typeof activeIndex==='number'?items[activeIndex]:null;activeSlide=items[activeIndex];if(activeSlide)t958__hideMobileSlides(activeSlide)})}}}
function t958_checkSize(rec){var cards=rec.querySelectorAll('.t958__card_preview');var mores=rec.querySelectorAll('.t958__more-wrapper');var blockHeight=rec.querySelector('.t958__height');var maxWidth=parseFloat(getComputedStyle(blockHeight,null).width.replace('px',''));var windowMargin=80;var windowWidth=window.innerWidth;var cardMaxWidth=windowWidth-windowMargin;if(maxWidth>windowWidth){for(var i=0;i<cards.length;i++){cards[i].style.maxWidth=cardMaxWidth+'px'}
for(var i=0;i<mores.length;i++){mores[i].style.maxWidth=cardMaxWidth+'px'}}else{for(var i=0;i<cards.length;i++){cards[i].style.maxWidth=''}
for(var i=0;i<mores.length;i++){mores[i].style.maxWidth=''}}
for(var i=0;i<cards.length;i++){var card=cards[i];var cardStyle=getComputedStyle(card,null);var cardPaddingTop=parseInt(cardStyle.paddingTop)||0;var cardPaddingBottom=parseInt(cardStyle.paddingBottom)||0;var cardHeight=card.clientHeight-(cardPaddingTop+cardPaddingBottom);var cardInner=card.querySelector('.t958__card-inner');var cardInnerHeight=cardInner.offsetHeight;if(cardHeight<=cardInnerHeight){card.classList.add('t958__card_fade')}else{card.classList.remove('t958__card_fade')}}}
function t958_initSliderSwipe(rec){var sliderWrapper=rec.querySelector('.t958__gallery');var totalSlides=rec.querySelectorAll('.t958__item').length;var timeout;var isScrolling=!1;if(typeof Hammer!=='undefined'){delete Hammer.defaults.cssProps.userSelect;var hammer=new Hammer(sliderWrapper,{domEvents:!0,inputClass:Hammer.TouchInput,recognizers:[[Hammer.Swipe,{direction:Hammer.DIRECTION_HORIZONTAL}]]});window.addEventListener('scroll',function(){isScrolling=!0;clearTimeout(timeout);timeout=setTimeout(function(){isScrolling=!1},250)});if(totalSlides==1)return!1;hammer.on('swipeleft',function(event){if(isScrolling)return!1;sliderWrapper.setAttribute('data-slider-touch','yes');if(event.isFinal){t958_slide(rec,'right');sliderWrapper.setAttribute('data-slider-touch','')}});hammer.on('swiperight',function(event){if(isScrolling)return!1;sliderWrapper.setAttribute('data-slider-touch','yes');if(event.isFinal){t958_slide(rec,'left');sliderWrapper.setAttribute('data-slider-touch','')}})}}
function t958_slide(rec,direction){var allrecords=document.getElementById('allrecords');var container=rec.querySelector('.t958__slidecontainer');var items=rec.querySelectorAll('.t958__item');var totalSlides=items.length;var sliderWidth=parseFloat(getComputedStyle(items[0],null).width.replace('px',''));var position=parseInt(container.getAttribute('data-slide-pos'),10);var isiOS=/iPhone|iPad|iPod/i.test(navigator.userAgent)||(navigator.userAgent.indexOf('Macintosh')&&'ontouchend' in document);if(direction==='right'){container.setAttribute('data-slide-pos',++position);if(position>=totalSlides){position=0;container.setAttribute('data-slide-pos',position)}}else{container.setAttribute('data-slide-pos',--position);if(position<=-1){position=totalSlides-1;container.setAttribute('data-slide-pos',position)}}
container.style.transform='translate(-'+sliderWidth*position+'px, 0)';container.style.transitionDuration='.3s';setTimeout(function(){t958_findVisibleCards(rec);if(isiOS){var activeIndex=container.getAttribute('data-slide-pos');if(activeIndex)activeIndex=parseInt(activeIndex,10);var activeSlide=typeof activeIndex==='number'?items[activeIndex]:null;if(activeSlide)t958__hideMobileSlides(activeSlide)}},350);if(window.lazy==='y'||allrecords.getAttribute('data-tilda-lazy')==='yes'){t_onFuncLoad('t_lazyload_update',function(){t_lazyload_update()})}}
function t958_findVisibleCards(rec){var cards=rec.querySelectorAll('.t958__card');var prevControl=rec.querySelector('.t958__previous');var nextControl=rec.querySelector('.t958__next');for(var i=0;i<cards.length;i++){var card=cards[i];card.classList.remove('t958__card-left');card.classList.remove('t958__card-right');card.classList.remove('t958__card-visible');var windowWidth=window.innerWidth;var cardLeftPos=card.getBoundingClientRect().left;var cardRightPos=cardLeftPos+parseFloat(getComputedStyle(card,null).width.replace('px',''));if(cardLeftPos<=0&&cardRightPos>=0){card.classList.add('t958__card-left')}else if(cardLeftPos<=windowWidth&&cardRightPos>=windowWidth){card.classList.add('t958__card-right')}else if(cardLeftPos>=0&&cardRightPos<=windowWidth){card.classList.add('t958__card-visible')}}
var leftCard=rec.querySelector('.t958__card-left');var rightCard=rec.querySelector('.t958__card-right');if(leftCard){var leftCardRect=leftCard.getBoundingClientRect().left;var leftCardWidth=parseFloat(getComputedStyle(leftCard,null).width.replace('px',''));var leftCardOffset=leftCardWidth-Math.abs(leftCardRect);if(leftCardOffset>=30){prevControl.style.width=leftCardOffset+'px'}else{prevControl.style.width=100+'px'}}
if(rightCard){var rightCardRect=rightCard.getBoundingClientRect().left;var rightCardStyle=getComputedStyle(rightCard,null);var paddingLeft=parseInt(rightCardStyle.paddingLeft)||0;var paddingRight=parseInt(rightCardStyle.paddingRight)||0;var rightCardWidth=rightCard.clientWidth-(paddingLeft+paddingRight);var rightCardOffset=rightCardWidth-(rightCardRect+rightCardWidth-window.innerWidth);if(rightCardOffset>=30){nextControl.style.width=rightCardOffset+'px'}else{nextControl.style.width=100+'px'}}}
function t958_initPopup(rec){if(rec.querySelector('.t958').classList.contains('t958_preview'))return;var fadeCards=rec.querySelectorAll('.t958__card_fade[data-review-block^="review"]');for(var i=0;i<fadeCards.length;i++){fadeCards[i].addEventListener('click',function(){var card=this;if(card.classList.contains('t958__card-visible')){t958_showPopup(rec);var popup=rec.querySelector('.t-popup');var reviewId=card.getAttribute('data-review-block').replace('review','');var reviewPopup=popup.querySelector('.t958__popup-item[data-review-index="'+reviewId+'"]');var popupItems=popup.querySelectorAll('.t958__popup-item');for(var i=0;i<popupItems.length;i++){popupItems[i].style.display='none'}
reviewPopup.style.display='block'}})}}
function t958_checkPopupSize(rec){var popupContainer=rec.querySelector('.t-popup__container');var popupHeight=parseFloat(getComputedStyle(popupContainer,null).height.replace('px',''));var windowMargin=120;var windowHeight=window.innerHeight-windowMargin;if(popupHeight>windowHeight){popupContainer.classList.add('t-popup__container-static')}else{popupContainer.classList.remove('t-popup__container-static')}}
function t958_showPopup(rec){var allrecords=document.getElementById('allrecords');var popup=rec.querySelector('.t-popup');var popupContainer=rec.querySelector('.t-popup__container');var popupClose=rec.querySelector('.t-popup__close');popup.style.display='block';setTimeout(function(){popupContainer.classList.add('t-popup__container-animated');popup.classList.add('t-popup_show');t958_checkPopupSize(rec);if(window.lazy==='y'||allrecords.getAttribute('data-tilda-lazy')==='yes'){t_onFuncLoad('t_lazyload_update',function(){t_lazyload_update()})}},50);if(typeof t_triggerEvent==='function')t_triggerEvent(document.body,'popupShowed');document.body.classList.add('t-body_popupshowed');popup.removeEventListener('mousedown',t958_mousedownEvent);popup.addEventListener('mousedown',t958_mousedownEvent);popupClose.removeEventListener('click',t958_closePopup);popupClose.addEventListener('click',t958_closePopup);document.removeEventListener('keydown',t958_keydownEvent);document.addEventListener('keydown',t958_keydownEvent)}
function t958_mousedownEvent(event){var windowWidth=window.innerWidth;var maxScrollBarWidth=17;var windowWithoutScrollBar=windowWidth-maxScrollBarWidth;if(event.clientX>windowWithoutScrollBar)return;if(event.target==this)t958_closePopup()}
function t958_keydownEvent(event){if(event.keyCode==27)t958_closePopup()}
function t958_closePopup(){var popupShow=document.querySelector('.t-popup.t-popup_show');if(popupShow){if(typeof t_triggerEvent==='function')t_triggerEvent(document.body,'popupHidden');document.body.classList.remove('t-body_popupshowed');popupShow.classList.remove('t-popup_show');setTimeout(function(){var popups=document.querySelectorAll('.t-popup:not(.t-popup_show)');document.body.scrollTop=0;for(var i=0;i<popups.length;i++){popups[i].style.display='none'}},300)}}
function t958__hideMobileSlides(activeSlide){if(!activeSlide)return;var slideWrapper=activeSlide.closest('.t958__slidecontainer');var slides=Array.prototype.slice.call(slideWrapper.querySelectorAll('.t-slds__item:not(.t-slds__item_dummy):not([aria-hidden="true"])'));var slideWidth=getComputedStyle(activeSlide).width;var maxSlidesViewed=document.documentElement.clientWidth>960?5:3;if(slides.length<=maxSlidesViewed*2)return;var activeSlideIndex=activeSlide.getAttribute('data-slide-index');activeSlideIndex=parseInt(activeSlideIndex,10);var activeIndexList=[activeSlideIndex];for(var i=1;i<maxSlidesViewed;i++){if(activeSlideIndex+i<=slides.length){activeIndexList.push(activeSlideIndex+i)}else{activeIndexList.push(i)}
if(activeSlideIndex-i>0){activeIndexList.push(activeSlideIndex-i)}else{activeIndexList.push(slides.length+1-i)}}
var innactiveClass='t-slds__item-innactive';slides.forEach(function(slide){var isActiveIndexSlide=activeIndexList.some(function(index){return parseInt(slide.getAttribute('data-slide-index'),10)===index});isActiveIndexSlide?slide.classList.remove(innactiveClass):slide.classList.add(innactiveClass);slide.style.width=slideWidth&&!isActiveIndexSlide?slideWidth:''})}
function t868_initPopup(recid){var rec=document.getElementById('rec'+recid);if(!rec)return;rec.setAttribute('data-animationappear','off');rec.style.opacity='1';var popup=rec.querySelector('.t-popup');if(!popup)return;var hook=popup.getAttribute('data-tooltip-hook');if(!hook)return;var analitics=popup.getAttribute('data-track-popup');var customCodeHTML=t868__readCustomCode(rec);var recBlocks=document.querySelectorAll('.r');for(var i=0;i<recBlocks.length;i++){recBlocks[i].addEventListener('click',function(event){var target=event.target;var href=target.closest('a[href$="'+hook+'"]')?target:!1;if(!href)return;event.preventDefault();t868_showPopup(rec,customCodeHTML);t_onFuncLoad('t_popup__resizePopup',function(){t_popup__resizePopup(recid)});if(hook.substring(0,7)==='#popup:'&&analitics&&window.Tilda){var virtTitle=hook;virtTitle=virtTitle.substring(7);Tilda.sendEventToStatistics(analitics,virtTitle)}})}
if(!popup.getAttribute('data-popup-inited')&&'MutationObserver' in window){popup.setAttribute('data-popup-inited','yes');var stores=document.querySelectorAll('body .t-store');Array.prototype.forEach.call(stores,function(store){new MutationObserver(function(mutationsList){for(var mutation in mutationsList){var event=mutationsList[mutation];if(event.type==='attributes'){if(event.target.className.indexOf('t-popup_show')!==-1){popup.style.zIndex='99999999';t868_initPopup(recid);}}}}).observe(store,{attributes:!0,attributeFilter:['class'],subtree:!0,})})}}
function t868__readCustomCode(rec){var codeWrap=rec.querySelector('.t868 .t868__code-wrap');if(!codeWrap)return;var customCode=codeWrap.innerHTML;return customCode}
function t868_showPopup(rec){var popup=rec.querySelector('.t-popup');if(!popup)return;var popupContainer=popup.querySelector('.t-popup__container');if(!popupContainer)return;var codeWrap=popup.querySelector('.t868__code-wrap');if(!codeWrap)return;var windowWidth=window.innerWidth;var screenMin=rec.getAttribute('data-screen-min');var screenMax=rec.getAttribute('data-screen-max');if(screenMin&&windowWidth<parseInt(screenMin,10))return;if(screenMax&&windowWidth>parseInt(screenMax,10))return;popup.style.display='block';codeWrap.style.display='block';t868_setHeight(rec);setTimeout(function(){popupContainer.classList.add('t-popup__container-animated');popup.classList.add('t-popup_show')},100);if(typeof t_triggerEvent==='function')t_triggerEvent(document.body,'popupShowed');document.body.classList.add('t-body_popupshowed');popup.addEventListener('click',function(event){var container=event.target.closest('.t-popup__container');if(!container)t868_closePopup(rec)});var closeButton=rec.querySelector('.t-popup__close');if(closeButton){closeButton.addEventListener('click',function(){t868_closePopup(rec)})}
var buttons=rec.querySelectorAll('a[href*="#"]');Array.prototype.forEach.call(buttons,function(button){button.addEventListener('click',function(){var url=button.getAttribute('href');if(url.indexOf('#order')!==-1){var popupContainer=rec.querySelector('.t-popup__container');setTimeout(function(){while(popupContainer.firstChild){popupContainer.removeChild(popupContainer.firstChild)}},600)}
if(!url||url.substring(0,7)!=='#price:'){t868_closePopup(rec);if(!url||url.substring(0,7)==='#popup:'){setTimeout(function(){if(typeof t_triggerEvent==='function')t_triggerEvent(document.body,'popupShowed');document.body.classList.add('t-body_popupshowed')},300)}}})});document.addEventListener('keydown',function(event){if(event.keyCode===27){t868_closePopup(rec)}})}
function t868_closePopup(rec){var popup=rec.querySelector('.t-popup');var codeWrap=rec.querySelector('.t868 .t868__code-wrap');if(typeof t_triggerEvent==='function')t_triggerEvent(document.body,'popupHidden');document.body.classList.remove('t-body_popupshowed');popup.classList.remove('t-popup_show');setTimeout(function(){if(!popup.classList.contains('.t-popup_show')){popup.style.display='none';if(codeWrap){codeWrap.style.display='none'}}},300)}
function t868_setHeight(rec){var videoCarier=rec.querySelector('.t868__video-carier');if(!videoCarier)return;var paddingLeft=parseInt(videoCarier.style.paddingLeft,10)||0;var paddingRight=parseInt(videoCarier.style.paddingRight,10)||0;var height=(videoCarier.clientWidth-(paddingLeft+paddingRight))/(16/9);videoCarier.style.height=height;Array.prototype.forEach.call(videoCarier.closest,function(parent){parent.style.height=height})}
if(!Element.prototype.matches){Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.oMatchesSelector}
if(!Element.prototype.closest){Element.prototype.closest=function(s){var el=this;while(el&&el.nodeType===1){if(Element.prototype.matches.call(el,s)){return el}
el=el.parentElement||el.parentNode}
return null}}