(function($){if(typeof(GoMapsExt)!=='undefined'){var conGoMapsExtMethods={setCountries:function(country){var gme=this.data,$element=this.element;$.each(this.markers,function(key,marker){marker.setVisible(!1);var matches=!1;$.each(marker.countries,function(keyM,c){if(c==country){matches=!0}});if(matches){marker.setVisible(!0);if($('#gme-address'+marker.uid).parent().is('del')){$('#gme-address'+marker.uid).unwrap()}}else{if(!$('#gme-address'+marker.uid).parent().is('del')){$('#gme-address'+marker.uid).wrap('<del></del>')}}});$('.gme-addresses').each(function(){if($(this).find('del').length==$(this).find('.google-maps-contact').length){$(this).parent().hide()}else{$(this).parent().show()}});if($element.markerCluster){$element.markerCluster.repaint()}},setCategories:function(selectedCats){var gme=this.data,$element=this.element;$('.gme-cat-wrapper').addClass('inactive');$.each(selectedCats,function(index,value){$('.gme-cat-wrapper-'+value).removeClass('inactive')});if($('.gme-cat-wrapper').length==$('.gme-cat-wrapper.inactive').length){$('.no-result-found').show()}else{$('.no-result-found').hide()}
$.each(this.markers,function(key,marker){marker.setVisible(!1);var matches=0;$.each(marker.categories,function(keyM,category){if($.inArray(category,selectedCats)!=-1){matches+=1}});var showMarker=(matches>0);if(gme.mapSettings.logicalAnd){showMarker=(matches==selectedCats.length)}
if(showMarker){marker.setVisible(!0);if($('#gme-address'+marker.uid).parent().is('del')){$('#gme-address'+marker.uid).unwrap()}}else{marker.setVisible(!1);if(!$('#gme-address'+marker.uid).parent().is('del')){$('#gme-address'+marker.uid).wrap('<del></del>')}}});$('.gme-addresses').each(function(){if($(this).find('del').length==$(this).find('.google-maps-contact').length){$(this).parent().hide()}else{$(this).parent().show()}});if($element.markerCluster){$element.markerCluster.repaint()}},_initializeFilterListener:function(){var _this=this;$('.countrySelector select').change(function(){_this.setCountries($(this).val())})},};$.extend(!0,GoMapsExtController.prototype,conGoMapsExtMethods)}})(jQuery);jQuery.fn.femanagerValidation=function(a){function e(e){d=new g({numRequest:e.find("*[data-validation]").length,element:e}),e.find("*[data-validation]").each(function(){n(a(this),!0)})}function n(e,n){if(e.prop("disabled"))return void(n&&d.addCallbackToQueue(!0));var o=e.closest("form"),c=o.data("femanager-plugin"),v="tx_"+o.data("femanager-plugin-name"),g=o.find("div:first").find('input[name="'+v+'[user][__identity]"]').val(),m=o.find("div:first").find('input[name="'+v+'[__referrer][@action]"]').val(),p=Femanager.getBaseUrl()+"?id="+a("#femanagerPid").val()+"&type=1548935210",h=a("#femanagerStoragePid").val(),b=e.attr("data-validation"),_=s(e),x=e.val();"checkbox"==e.prop("type")&&0==e.prop("checked")&&(x="");var y="";if(l(_,"sameAs")){var C=l(_,"sameAs"),k=f(C),T=a('input[name="'+v+"[user]["+k+']"]');y=T.val(),"checkbox"==T.prop("type")&&0==T.prop("checked")&&(y="")}var P={storagePid:h,L:a("#femanagerLanguage").val(),id:a("#femanagerPid").val()};P["tx_femanager_validation[validation]"]=b,P["tx_femanager_validation[value]"]=x,P["tx_femanager_validation[field]"]=t(e),P["tx_femanager_validation[user]"]=void 0!==g?g:"",P["tx_femanager_validation[additionalValue]"]=y?y:"",P["tx_femanager_validation[plugin]"]=c,P["tx_femanager_validation[pluginName]"]=v,P["tx_femanager_validation[referrerAction]"]=m,a.ajax({url:p,data:P,type:"POST",cache:!1,success:function(a){if(n&&d.addCallbackToQueue(!0),a)try{a.validate?r(e):i(e,a.message)}catch(t){e.before(data)}},error:function(){u()}})}function t(a){var e="",n=a.prop("name").split("[");return e=void 0!==n[2]?n[2].replace("]",""):n[1].replace("]","")}function i(e,n){r(e);var t=a(".femanager_validation_container").html().replace("###messages###",n);e.before(t),e.closest(".form-group").addClass("has-error"),e.addClass("error")}function r(a){a.closest(".form-group").removeClass("has-error"),a.siblings(".alert").remove(),a.removeClass("error")}function o(a){if(0==a.find(".error").length)v=!0,a.trigger("submit");else{const e=a.find(".error:first")[0];if(!e)return;e.scrollIntoView({behavior:"smooth"})}}function l(a,e){for(var n=0;n<a.length;n++)if(a[n].indexOf(e)!==-1)return a[n];return""}function s(a){return a.attr("data-validation").split(",")}function f(a){var e="";if(a.indexOf("(")!==-1){var n=a.split("(");e=n[1].substr(0,n[1].length-1)}return e}function u(){"object"==typeof console&&console.log("Error: The called url is not available - if you use TYPO3 in a subfolder, please use config.baseURL in TypoScript")}var d,c=a(this),v=!1;0==c.find("*[data-validation]").length&&(v=!0);var g=function(){var e,n,t;return function(i){i||(i={}),e=i.numRequest||0,n=i.requestsCompleted||0,c=i.element||0,t=[];var r=function(){a("body").css("cursor","default"),o(c);for(var e=0;e<t.length;e++)t[e]()};i.singleCallback&&t.push(i.singleCallback),this.addCallbackToQueue=function(a,i){a&&n++,i&&t.push(i),n==e&&r()},this.requestComplete=function(a){a&&n++,n==e&&r()},this.setCallback=function(a){t.push(callBack)}}}();a("*[data-validation]").on("blur",function(){n(a(this),!1)}),c.on("submit",function(n){a("body").css("cursor","wait"),v||(n.preventDefault(),e(a(this)))})};function createUploader(e){if(0!=e("#femanager_field_fine-uploader").length){var a={imageNames:{},getImageNames:function(){return e.map(this.imageNames,function(e){return e}).join(",")},addImageName:function(a,t){this.imageNames[a]=t,e("#femanager_field_image").val(this.getImageNames())},deleteImageName:function(a){delete this.imageNames[a],e("#femanager_field_image").val(this.getImageNames())}};new qq.FineUploader({element:document.getElementById("femanager_field_fine-uploader"),request:{endpoint:Femanager.getBaseUrl()+"index.php?eID=femanagerFileUpload&id="+e("#femanagerPid").val(),customHeaders:{Accept:"application/json"}},multiple:!0,template:e(".image_container_template:first").html(),fileTemplate:'<li><div class="qq-progress-bar"></div><span class="qq-upload-spinner"></span><span class="qq-upload-finished"></span><span class="qq-upload-file"></span><span class="qq-upload-size"></span><a class="qq-upload-cancel" href="#">{cancelButtonText}</a><a class="qq-upload-retry" href="#">{retryButtonText}</a><a class="qq-upload-delete icon-trash" href="#">{deleteButtonText}</a><span class="qq-upload-status-text">{statusText}</span></li>',deleteFile:{enabled:!0,forceConfirm:!0,endpoint:Femanager.getBaseUrl()+"index.php?eID=femanagerFileDelete&id="+e("#femanagerPid").val()},classes:{success:"alert alert-success",fail:"alert alert-error"},validation:{allowedExtensions:getValueFromField("#uploadFileExtension","jpeg, jpg, gif, png, bmp","array"),sizeLimit:getValueFromField("#uploadSize",25e6,"int"),itemLimit:getValueFromField("#uploadAmount",1,"int")},callbacks:{onComplete:function(t,n,i){if(i.success){var l=e("<img />").addClass("fileupload_image").prop("src",e("#uploadFolder").val()+"/"+i.uploadName).prop("alt",i.uploadName);l.appendTo(this.getItemByFileId(t)),a.addImageName(t,i.uploadName)}},onDeleteComplete:function(e,t,n){a.deleteImageName(e)}}});return a}}function getValueFromField(e,a,t){var n=a;return $(e).length&&(n=$(e).val()),void 0!==t&&("int"===t?n=parseInt(n):"array"===t&&(n=n.toString(),n=n.replace(/[\s,]+/g,","),n=n.split(","))),n}jQuery(document).ready(function(e){function a(e){e+="";var a=e.charAt(0).toLowerCase();return a+e.substr(1)}var t;t=null!=document.querySelector(".tx-femanager[data-labels]")?JSON.parse(document.querySelector(".tx-femanager[data-labels]").dataset.labels):[],e(".feManagerValidation").femanagerValidation(e);var n=createUploader(e);e("#femanager_field_image").length>0&&e.each(e("#femanager_field_image").val().split(","),function(e,a){a.trim().length>0&&n.addImageName(a,a)}),e("#femanager_field_preview-image").find(".qq-upload-delete").click(function(a){a.preventDefault();var t=e(a.target).parent();n.deleteImageName(t.find(".qq-upload-file").text()),t.fadeOut("",function(){e(this).remove()})}),e("*[data-confirm]").click(function(a){var t=e(this).attr("data-confirm");confirm(t)||a.preventDefault()}),document.querySelectorAll("[data-data-endpoint]").forEach(function(n){var i=function(i){var l=n.dataset.dataEndpoint,o={"tx_femanager_data[action]":l,"tx_femanager_data[controller]":"Data"};arguments=JSON.parse(JSON.stringify(n.dataset));for(var r in arguments)if(arguments.hasOwnProperty(r)&&r.match("arguments")){var s=document.getElementById(arguments[r]);if(s){var d=a(r.substr(9));o["tx_femanager_data["+d+"]"]=s.value}}var p=Femanager.getBaseUrl()+"index.php?id="+e("#femanagerPid").val()+"&type=1594138042",m=n.dataset.selectedValue;e.ajax({url:p,data:o,type:"POST",cache:!1,beforeSend:function(){n.disabled=1,n.options.length=0,n.options[0]=new Option(t.loading_states)},success:function(e){n.disabled=1,n.options.length=0,""===m||e.hasOwnProperty(m)||(n.options[n.options.length]=new Option(t.please_choose));for(var a in e)if(e.hasOwnProperty(a)){var i=a===m;n.options[n.options.length]=new Option(e[a],a,i,i),n.disabled=0}},error:function(){console.log("Error: The called url is not available - if you use TYPO3 in a subfolder, please use config.baseURL in TypoScript")}})},l=n.dataset.triggerFields;void 0!==l?l.split(",").forEach(function(e){var a=document.getElementById(e);void 0!==a&&a.addEventListener("change",i)}):n.addEventListener("change",i),i()})}),window.Femanager={},window.Femanager.getBaseUrl=function(){var e;if(jQuery("base").length>0)e=jQuery("base").prop("href");else if(window.location.hostname.indexOf("localhost")!==-1)e="";else{var a="";window.location.port.length>0&&(a=":"+window.location.port),e="https:"!==window.location.protocol?"http://"+window.location.hostname+a+"/":"https://"+window.location.hostname+a+"/"}return e};$.fn.ubStickyHeader=function(options){var settings=$.extend({changeHeight:!1,targetHeightMinus:20,breakPoint:990,callback:null},options);var mywindow=$(window);var myWidth=mywindow.innerWidth();var myHeader=$(this);var headerHeight=myHeader.outerHeight();var scrollHeaderHeight=headerHeight-settings.targetHeightMinus+'px';switch(!0){case(myWidth>settings.breakPoint):mywindow.scroll(function(){if($(this).scrollTop()>20){myHeader.addClass("sticky");$('body').addClass('stickyheader');if(settings.changeHeight===!0){myHeader.css('height',scrollHeaderHeight)}}else{myHeader.removeClass("sticky").css('height','');$('body').removeClass('stickyheader')}});break;case(myWidth<settings.breakPoint+1):mywindow.scroll(function(){myHeader.removeClass("sticky").css('height','');$('body').removeClass('stickyheader')});break}
return this};function goToByScroll(id){$('html,body').animate({scrollTop:$("#"+id).offset().top-$('.container-header').first().height()-10},'slow')}
function makeDropdown(classname){$('.'+classname+' > ul').each(function(){$(this).prev('a').addClass('dropdown-toggle')});$('.'+classname+' .dropdown-toggle').on('click',function(event){event.preventDefault();if(!$(this).parent().hasClass('show')){$('.'+classname).removeClass('show');$(this).parent().addClass('show')}else{$('.'+classname).removeClass('show')}})}
$(function(){var searchInputWidth;var isGoogleFont=function(element){if(element.href&&element.href.indexOf('https://fonts.googleapis.com')===0){return!0}
return!1}
if($('#page_6641').length){var head=$('head')[0];var insertBefore=head.insertBefore;head.insertBefore=function(newElement,referenceElement){if(!isGoogleFont(newElement)){insertBefore.call(head,newElement,referenceElement)}};var appendChild=head.appendChild;head.appendChild=function(textNode){if(!isGoogleFont($(textNode)[0])){appendChild.call(head,textNode)}}}
$('.fancybox').fancybox();if($('#powermail_field_countrylabel').length){$('#powermail_field_countryid').change(function(){var value=$(this).val();$('#powermail_field_countrylabel').val($('option[value="'+value+'"').text())})}
makeDropdown('breadcrumb-item');var mySwiper=new Swiper('.ce-stageimages',{loop:!0,speed:1000,effect:'fade',autoplay:{delay:6000,},navigation:{nextEl:'.swiper-button-next',prevEl:'.swiper-button-prev',},pagination:{el:'.swiper-pagination',clickable:!0,type:'bullets',}});mySwiper.on('click',function(){var link=$(mySwiper.clickedSlide).find('picture').data('link');if(link){window.location.href=link}});var boxSwiper=new Swiper(".boxSlider",{slidesPerView:3,spaceBetween:0,navigation:{nextEl:'.swiper-button-next',prevEl:'.swiper-button-prev',},breakpoints:{768:{slidesPerView:1,spaceBetween:0},992:{slidesPerView:2,spaceBetween:0}}});var $easyzoom=$('.easyzoom').easyZoom();var api1=$easyzoom.filter('.easyzoom--with-thumbnails').data('easyZoom');var lastClickedVideo=0;$('.thumbnails').on('click','a',function(e){var $this=$(this);$this.parent().parent().find('li a').removeClass('isactive');$this.addClass('isactive');e.preventDefault();var type=$(this).data('filetype');if(type=='video'){$('.easyzoom').hide();if(lastClickedVideo){$('#video-link-'+lastClickedVideo).append($('#video-'+lastClickedVideo))}
$('.video-container').show().append($('#video-'+$(this).data('uid')));lastClickedVideo=$(this).data('uid')}else{$('.video-container').hide();$('.easyzoom').show();api1.swap($this.data('standard'),$this.attr('href'))}});$(".tx-powermail form :input").each(function(index,elem){var eId=$(elem).attr("id");var label=null;if(eId&&(label=$("label[for="+eId+"]")).length==1){if($(elem).is(':radio')||$(elem).is(':checkbox')){}else{$(elem).attr("placeholder",$.trim($(label).text()));$(label).remove()}}});$(".tx-felogin-pi1 form :input").each(function(index,elem){var eId=$(elem).attr("id");var label=null;if(eId&&(label=$("label[for="+eId+"]")).length==1){if($(elem).is(':radio')||$(elem).is(':checkbox')){}else{$(elem).attr("placeholder",$(label).text());$(label).remove()}}});$('.fillWithAjaxContent').each(function(){var url=$(this).text();if($(this).data('url')){url=$(this).data('url')}
var container=$(this);if($(this).data('container')){container=$('#'+$(this).data('container'))}
var callback=$(this).data('callback');$.ajax({url:url,success:function(data){container.html(data).removeClass('fillWithAjaxContent');if(callback){eval(callback+'(container)')}}})});$('.maincontents thead').parent('table').responsiveTables();makeDropdown('category-tree-item');if($('.news-category-menu').length>0){if($('.container.news .article').length==0){$('.news-category-menu').hide()}else{$('.container.news .article').each(function(){var categories=$(this).data('categories')+',9999999';var given=categories.split(',');$('#category-0').addClass('visible');$.each(given,function(index,value){$('#category-'+value).addClass('visible')})});$('.category-tree-item.visible').each(function(){var parent=$(this).parent();while(!parent.is('div')){parent.addClass('visible');parent=parent.parent()}
$('.category-tree-item').addClass('hidden');$('.visible').removeClass('hidden')});$('.dropdown-menu .category-tree-item, #category-0').click(function(e){e.preventDefault();$(this).parent().parent().removeClass('show');var category=$(this).data('category');$('.container.news .article').each(function(){var categories=$(this).data('categories')+',9999999';var given=categories.split(',');if(category==0){var visible=!0}else{var visible=!1;$.each(given,function(index,value){if(value==category){visible=!0}})}
if(visible){$(this).parent().show()}else{$(this).parent().hide()}})})}}
var resizeId;var waitress=(function(){var timers={};return function(callback,ms,uniqueId){if(!uniqueId){uniqueId="Don't call this twice without a uniqueId"}
if(timers[uniqueId]){clearTimeout(timers[uniqueId])}
timers[uniqueId]=setTimeout(callback,ms)}})();$(window).resize(function(){waitress(doneResizing,500,'resized')});doneResizing();$('#printIt').click(function(){window.print()});function tabsDeepLink(hash){if($('.product-tabs.bgm-tabs').length>0){index=$(".product-tabs .ui-tabs-anchor").index($(".product-tabs a[href='#"+hash+"']"));if(index>=0){$(".product-tabs").tabs("option","active",index);$('html, body').animate({scrollTop:($('#'+hash).offset().top-70)},'slow')}}else if($('.product-tabs.bgm-accordion').length>0){index=$(".product-tabs .ui-accordion-content").index($("#"+hash));console.log(index);if(index>=0){$(".product-tabs").accordion("option","active",index)}}}
if($('.product-tabs').length>0){$(".maincontents a[href^='#']").not(".product-tabs a[href^='#']").on('click',function(e){e.preventDefault();linkHref=$(this).attr('href').slice(1);tabsDeepLink(linkHref)})}
if(window.location.hash){var hash=window.location.hash;tabsDeepLink(hash)}
if(jQuery().iFrameResize){$('#evalanche-subscription').iFrameResize({log:!1,checkOrigin:0})}
function doneResizing(){$('.bgm-tabs > div,.bgm-accordion > div').each(function(){$(this).before($(this).children('header').first())});$('.bgm-tabs:not(.bgm-accordion)').responsiveTabs();$('.bgm-accordion').accordion({heightStyle:"content",collapsible:!0,create:function(event,ui){$(this).find('.ui-accordion-header').first().trigger('click')}});$('.product-tabs').responsiveTabs({switchByBodyWidth:768})}
$('.video').parents('.ce-column,.ce-row,.ce-inner,.ce-outer').removeAttr('class');$('.shariff-button a').removeAttr('data-rel').attr('target','_blank');$('#modal-virtualization,#modal-aready').on('hidden.bs.modal',function(e){var video=this.querySelector('video');video.pause();video.currentTime=0})});if($(window).width()>990){$(window).on('load',function(){$('.main_wrapper_default #pageHeader').ubStickyHeader()})}
if(document.querySelector('.box-category-selector')){document.querySelectorAll('.box-category-selector').forEach((select)=>{select.value=0})}
if(document.querySelector('.product-list>.grid-3')&&document.querySelector(".orders")&&document.body.id.split('_')[1]==document.querySelector(".orders").dataset.orderpage){document.querySelector('.product-list>.grid-3').classList.remove('animatedParent');document.querySelector('.product-list>.grid-3').classList.remove('animateOnce');document.querySelectorAll('.product-list .fadeInDownShort').forEach((item)=>{item.classList.remove('fadeInDownShort')})}
document.querySelectorAll('.side-basket__close').forEach((closeButton)=>{closeButton.addEventListener('click',function(){const body=document.body;const scrollY=body.style.top;body.style.position='';body.style.top='';window.scrollTo(0,parseInt(scrollY||'0')*-1);sideBasket.classList.remove('open');document.querySelector('.side-basket__bg-layer').classList.remove('open');document.querySelectorAll('.box-category-selector').forEach((select)=>{select.value=0});location.reload()})});window.addEventListener('scroll',()=>{document.documentElement.style.setProperty('--scroll-y',`${window.scrollY}px`)});function getOptionText(sel){return sel.options[sel.selectedIndex].text}
function getOptionData(sel){return sel.options[sel.selectedIndex].dataset.partnumber}
const cartObject=getCookie('order')?JSON.parse(getCookie('order')):{};function getCookie(name){const value=`; ${document.cookie}`;const parts=value.split(`; ${name}=`);if(parts.length===2)return parts.pop().split(';').shift();}
function setOrderCookie(name,value,daysToLive){var cookie=name+"="+value;if(typeof daysToLive==="number"){cookie+="; max-age="+(daysToLive*24*60*60)+';SameSite=Lax;path=/';document.cookie=cookie}}
function cleanCookie(){let cookie=JSON.parse(getCookie('order'));for(let key in cookie){let accessoryCount=0;cookie[key].accessories.forEach((accessory)=>{if(accessory.quantity!=0){accessoryCount++}});if(cookie[key].quantity==0&&accessoryCount==0){delete cookie[key];location.reload()}};setOrderCookie("order",JSON.stringify(cookie),7)}
const submitOrder=document.querySelector('#side-basket__submit button');const submitOrderWithParts=document.querySelector('#submitRequestWithParts');const sideBasket=document.querySelector('.side-basket');window.orderItems={};if(submitOrder){submitOrder.addEventListener('click',(e)=>{e.preventDefault();saveOrders();updateCart()})}
if(submitOrderWithParts){submitOrderWithParts.addEventListener('click',(e)=>{e.preventDefault();saveOrders();updateCart()})}
if(sideBasket&&sideBasket.querySelector('.accessory-delete')){sideBasket.querySelectorAll('.accessory-delete').forEach((button)=>{button.addEventListener(('click'),()=>{const cookie=JSON.parse(getCookie('order'));if(sideBasket.dataset.variant){cookie[sideBasket.dataset.variant].accessories.forEach((accessory,index)=>{if(accessory.uid==button.dataset.uid){cookie[sideBasket.dataset.variant].accessories.splice(index,1);button.closest('.side-basket__selected-item').classList.add('hidden');const accessoryGroup=button.closest('.side-basket__selected-item').dataset.uid;document.querySelector(`.side-basket .productEcosystem__cat[data-uid="${accessoryGroup}"]`).classList.remove("hidden")}})}else{for(let key in cookie){if(cookie[key].variantUid==0){cookie[key].accessories.forEach((accessory,index)=>{if(accessory.uid==button.dataset.uid){cookie[key].accessories.splice(index,1);button.closest('.side-basket__selected-item').classList.add('hidden');const accessoryGroup=button.closest('.side-basket__selected-item').dataset.uid;document.querySelector(`.side-basket .productEcosystem__cat[data-uid="${accessoryGroup}"]`).classList.remove("hidden")}})}}}
setOrderCookie("order",JSON.stringify(cookie),7);cleanCookie();updateCart();if(document.querySelectorAll('.side-basket__selected-item:not(.hidden)').length==0&&document.querySelector('.side-basket__selected-parts')){document.querySelector('.side-basket__selected-parts').classList.add("hidden")}})})}
if(document.querySelector('.accessory__remove')){document.querySelectorAll('.accessory__remove').forEach((button)=>{button.addEventListener(('click'),()=>{const wrapper=button.closest('.product-form-header ');const cookie=JSON.parse(getCookie('order'));let key=button.dataset.variant!=0?button.dataset.variant:document.querySelector('.product-form-header').dataset.uid;cookie[key].accessories.forEach((accessory,index)=>{if(accessory.uid==button.dataset.uid){document.querySelector(`span[data-uid="${accessory.uid}"`).remove();cookie[key].accessories.splice(index,1);button.closest('.overview__accessory').remove()}});setOrderCookie("order",JSON.stringify(cookie),7);if(cookie[key].accessories.length==0&&cookie[key].quantity==0){wrapper.remove()}
if(cookie[key].accessories.length==0){if(document.querySelector('.orders__accessories')){document.querySelector('.orders__accessories').remove()}
if(wrapper.querySelector('.overview')){wrapper.querySelector('.overview').remove()}}
cleanCookie();countSideTotal();updateCart();refreshFormInfo()})})}
if(document.querySelector('.side-basket .box-category-selector')){document.querySelectorAll('.side-basket .box-category-selector').forEach((select)=>{select.addEventListener('change',()=>{const cookie=JSON.parse(getCookie('order'));if(select.value!=0){if(sideBasket.dataset.variant){cookie[sideBasket.dataset.variant].accessories.push({uid:select.value,quantity:1,title:getOptionText(select)+" (P/N "+getOptionData(select)+")"})}else{for(let key in cookie){if(cookie[key].variantUid==0){cookie[key].accessories.forEach((accessory,index)=>{console.log(accessory.uid,select.dataset.uid);if(accessory.uid==select.dataset.uid){cookie[key].accessories.push({uid:select.value,quantity:1,title:getOptionText(select)+" (P/N "+getOptionData(select)+")"})}})}}}
select.closest('.productEcosystem__cat').classList.add("hidden");document.querySelector('.side-basket__selected-parts').classList.remove("hidden");document.querySelector(`.side-basket__selected-item[data-uid="${select.dataset.uid}"]`).classList.remove('hidden');document.querySelector(`.side-basket__selected-item[data-uid="${select.dataset.uid}"] button`).dataset.uid=select.value;document.querySelector(`.side-basket__selected-item[data-uid="${select.dataset.uid}"] .accessory-title`).textContent=getOptionText(select);select.value=0}
setOrderCookie("order",JSON.stringify(cookie),7)})})}
const requestQuoteButton=document.querySelector('#requestQuote button[type="submit"]');const variantSelector=document.querySelector('select[name="tx_conproducts_pi5[dto][variant]"]');if(variantSelector){variantSelector.addEventListener('change',()=>{sideBasket.dataset.variant=variantSelector.value})}
if(requestQuoteButton){requestQuoteButton.addEventListener('click',(event)=>{event.preventDefault();saveOrders();updateCart()})}
let sideBasketTopText="";if(document.querySelector('.side-basket__top h2')){sideBasketTopText=document.querySelector('.side-basket__top h2').textContent}
function saveOrders(){document.querySelectorAll(`.side-basket__addings .card`).forEach((card)=>{card.classList.remove("hidden")});const orderObject=getCookie('order')?JSON.parse(getCookie('order')):{};const uid=document.querySelector('.side-basket').dataset.uid;let variantUid=0;let variantText="";const selectVariant=document.querySelector('select[name="tx_conproducts_pi5[dto][variant]"]');if(selectVariant&&selectVariant.value!=0){variantUid=selectVariant.value;variantText=getOptionText(selectVariant)+" (P/N "+getOptionData(selectVariant)+")"}
const addings=document.querySelector(".side-basket__selected-parts");const select=selectVariant;if(document.querySelector('.product-form-header__delete-main')){const id=select.value!=0?select.value:uid;document.querySelector('.product-form-header__delete-main').dataset.variant=id}
document.querySelector('.side-basket__variant').dataset.uid=select.value;document.querySelector('.side-basket__variant p').textContent=getOptionText(select);const scrollY=document.documentElement.style.getPropertyValue('--scroll-y');const body=document.body;body.style.width='100vw';body.style.position='fixed';body.style.top=`-${scrollY}`;document.querySelector('.side-basket__main-wrapper-inner').style.display="";document.querySelector('.side-basket__submit').style.display="";document.querySelector('.side-basket__top h2').textContent=sideBasketTopText;sideBasket.classList.add('open');document.querySelector('.side-basket__bg-layer').classList.add('open');if(document.querySelector('.variable-select select').value==0){document.querySelector(".side-basket__variant").classList.add("hidden")}
let accessories=[];if(variantUid==0){if(orderObject.hasOwnProperty(document.querySelector('.side-basket').dataset.uid)){orderObject[document.querySelector('.side-basket').dataset.uid].accessories.forEach((item)=>{accessories.push(item)})}}else{if(orderObject.hasOwnProperty(variantUid)){orderObject[variantUid].accessories.forEach((item)=>{accessories.push(item)})}}
document.querySelectorAll('.productEcosystem select').forEach((select)=>{if(select.value!=0){let hasAccessory=!1;let accessoryQuantity=parseInt(document.querySelector('input[name="quantity"]').value)
accessories.forEach((accessory)=>{if(accessory.uid==select.value){hasAccessory=!0;console.log(accessory.uid,accessoryQuantity);accessoryQuantity+=parseInt(accessory.quantity);accessory.quantity=accessoryQuantity}});if(!hasAccessory){accessories.push({uid:select.value,quantity:accessoryQuantity,title:getOptionText(select)+" (P/N "+getOptionData(select)+")"})}
const card=document.querySelector(`.side-basket__addings .card[data-uid="${select.dataset.uid}"]`);card.classList.add("hidden");const addedCard=document.querySelector(`.side-basket__selected-item[data-uid="${select.dataset.uid}"]`);addedCard.classList.remove("hidden");addedCard.querySelector(".accessory-title").textContent=getOptionText(select);addedCard.querySelector("button").dataset.uid=select.value;addedCard.querySelector('.accessory__quantity').value=accessoryQuantity}else{document.querySelector(`.side-basket__selected-item[data-uid="${select.dataset.uid}"]`).classList.add("hidden")}});if(accessories.length){addings.classList.remove('hidden')}else{addings.classList.remove('hidden')}
let currentQuantity=0;currentQuantity=document.querySelector('input[name="quantity"]').value;if(getOptionData(document.querySelector('select[name="tx_conproducts_pi5[dto][variant]"]'))){}
const objectKey=variantUid!=0?variantUid:document.querySelector('.side-basket').dataset.uid;orderObject[objectKey]={uid:document.querySelector('.side-basket').dataset.uid,variant:variantText,variantUid:variantUid,quantity:currentQuantity,accessories:accessories.slice(),};setOrderCookie("order",JSON.stringify(orderObject),7);updateCart()}
if(document.querySelector('.side-basket input[name="quantity"]')){document.querySelector('.side-basket input[name="quantity"]').addEventListener('change',function(){const orderObject=JSON.parse(getCookie('order'));const uid=document.querySelector('.side-basket').dataset.uid;const variant=document.querySelector('.side-basket__variant').dataset.uid;if(orderObject[variant]){orderObject[variant].quantity=this.value}
if(orderObject[uid]){orderObject[uid].quantity=this.value}
setOrderCookie("order",JSON.stringify(orderObject),7);updateCart()})}
if(document.querySelector('.product-form-header__top input[name="quantity"]')){document.querySelectorAll('.product-form-header__top input[name="quantity"]').forEach((input)=>{input.addEventListener('change',function(){console.log("change");const orderObject=JSON.parse(getCookie('order'));const variant=input.dataset.variant;if(orderObject[variant]){orderObject[variant].quantity=input.value}
setOrderCookie("order",JSON.stringify(orderObject),7);updateCart();document.querySelector('.overview-side .product-title[data-product="'+input.dataset.variant+'"] .overview-side__quantity').textContent=input.value+" pc";countSideTotal();refreshFormInfo()})})}
const updateCart=()=>{const cart=getCookie('order')?JSON.parse(getCookie('order')):{};const cartDot=document.querySelector('.metaheader__cart-quantity');let count=0;for(const[key,value]of Object.entries(cart)){count+=1}
if(count>0){cartDot.innerHTML=count;cartDot.classList.add('active')}else{cartDot.classList.remove('active');const title=document.querySelector('.orders__title');const emptyText=document.querySelector('.orders__empty-text-wrapper');if(title){title.textContent=title.dataset.empty}
if(emptyText){emptyText.classList.remove("hidden")}}
if(document.querySelectorAll('.side-basket__selected-item:not(.hidden)').length==0&&document.querySelector('.side-basket__selected-parts')){document.querySelector('.side-basket__selected-parts').classList.add("hidden")}
return count}
updateCart();const deleteAccessories=!0;const deleteMainPruductButtons=document.querySelectorAll('.product-form-header__delete-main');if(deleteMainPruductButtons.length){deleteMainPruductButtons.forEach((button)=>{button.addEventListener('click',()=>{const cart=JSON.parse(getCookie('order'));if(cart[button.dataset.variant].accessories.length==0){delete cart[button.dataset.variant];if(button.closest('.product-form-header')){button.closest('.product-form-header').remove()}}else{cart[button.dataset.variant].quantity=0;if(button.closest('.product-form-header__details')){button.closest('.product-form-header__details').remove()}}
setOrderCookie("order",JSON.stringify(cart),7);if(button.closest('.orders')){button.closest('.orders__input-group').classList.add("hidden")}else if(button.closest('.side-basket__main-wrapper')){}
if(button.closest('.orders')&&document.querySelectorAll('.product-form-header').length==0){const text=document.querySelector('.orders__title').dataset.empty;document.querySelector('.orders__title').textContent=text;document.querySelector('.orders .col-lg-2').remove();document.querySelector('.orders .side-basket__submit').remove()}
updateCart();if(!document.querySelector('.product-form-header')&&document.querySelector('.orders')){document.querySelector('.orders').classList.add('hidden');document.querySelector('.orders__title').textContent=document.querySelector('.orders__title').dataset.empty;document.querySelector('.orders__empty-text-wrapper').classList.remove('hidden')}
if(document.querySelector('.overview-side')){document.querySelector('.overview-side div[data-variant="'+button.dataset.variant+'"] .overview-side__quantity').textContent='0 pc'}
if(button.parentNode){button.parentNode.remove()}
if(document.querySelector('.side-basket__variant')){document.querySelector('.side-basket__variant').remove()}
countSideTotal();refreshFormInfo()})})}
refreshFormInfo();function refreshFormInfo(){if(document.querySelector('input[name="product_request_information"]')){const cart=getCookie('order')?JSON.parse(getCookie('order')):{};let text='';for(const[key,value]of Object.entries(cart)){let accessories='';if(value.accessories&&value.accessories.length){value.accessories.forEach((acc)=>{accessories+=`${acc.title} - quantity: ${acc.quantity} pc\n`})}
if(value.quantity){text+=`${value.variant} - quantity: ${value.quantity} pc`}
text+=`\n${accessories}\n------- \n`}
if(document.querySelector('input[name="product_request_information"]')){document.querySelector('input[name="product_request_information"]').value=text}}}
const randomLinks=document.querySelectorAll(".random-param");if(randomLinks){randomLinks.forEach((link)=>{const rnd=new Date().getTime();link.href+=`?date=${rnd}`})}
const accessoryQuantity=document.querySelectorAll('.accessory__quantity');if(accessoryQuantity.length){accessoryQuantity.forEach((item)=>{item.addEventListener('change',()=>{let cart=JSON.parse(getCookie('order'));let id=document.querySelector('.side-basket__variant').dataset.uid;const accessoryUid=item.parentNode.querySelector(".accessory-delete").dataset.uid;if(id==0){id=document.querySelector('.side-basket').dataset.uid}
cart[id].accessories.forEach((acc)=>{if(acc.uid==accessoryUid){acc.quantity=item.value}});setOrderCookie("order",JSON.stringify(cart),7)})})}
const accessoryQuantityCart=document.querySelectorAll('.accessory__quantity--cart');if(accessoryQuantityCart.length){accessoryQuantityCart.forEach((item)=>{item.addEventListener('change',function(){let cart=JSON.parse(getCookie('order'));let variantUid=item.closest('.product-form-header').dataset.variant;if(variantUid==0){variantUid=item.closest('.product-form-header').dataset.uid}
const accessoryUid=item.parentNode.querySelector(".accessory__remove").dataset.uid;cart[variantUid].accessories.forEach((acc)=>{if(acc.uid==accessoryUid){acc.quantity=item.value}});setOrderCookie("order",JSON.stringify(cart),7);document.querySelector('.overview-side .orders__accessory[data-uid="'+this.dataset.uid+'"] .overview-side__quantity').textContent=this.value+" pc";countSideTotal();refreshFormInfo()})})}
const countSideTotal=()=>{let total=0;document.querySelectorAll('.orders__input-group input').forEach((item)=>{total+=parseInt(item.value)});if(document.querySelector('.overview-side')){document.querySelector('.overview-side__total p').textContent=total+" pc"}
return total}
const inputMaxLength=function(){if(this.value.length>4){this.value=this.value.slice(0,4)}}
document.querySelectorAll('input[type="number"]').forEach((input)=>{input.addEventListener('input',function(){inputMaxLength.call(input)})});if(document.querySelector(".product-stage")){const queryString=window.location.search;const urlParams=new URLSearchParams(queryString);const variant=urlParams.get('variant');if(variant){document.querySelector(".variable-select select").value=variant;document.querySelector(".variable-select button").disabled=!1;document.querySelector(".variable-select button").removeAttribute('data-tooltip')}
console.log(cartObject);for(const key in cartObject){if(!cartObject.hasOwnProperty(key))continue;const obj=cartObject[key]}}
if(document.querySelector('.side-basket')){const height=document.documentElement.clientHeight-240;document.querySelector('.side-basket__main-wrapper').style.maxHeight=height+'px'}
document.addEventListener('DOMContentLoaded',function(){const scrollToTopButton=document.getElementById('scrollToTopButton');window.addEventListener('scroll',()=>{if(window.pageYOffset>400){scrollToTopButton.classList.add('-show')}else{scrollToTopButton.classList.remove('-show')}})})