var aFavorites={};var lbIndex=0;var lbWrapper;var fieldsets;var fieldsetsVisible;(function(){$('document').ready(function(){checkifGAOptOut();if($('.ta-ce-favorits').length){getFavorites(!0)}
$('.ta-toggler').on('click',function(e){var expanded=$(this).attr('aria-expanded');if(expanded==="true"){$(this).attr('aria-expanded',"false")}else{$(this).attr('aria-expanded',"true")}
var target=$(this).data('target');$(target).toggleClass('show')});var isCookieAccepted=localStorage.getItem('cookieAccepted');var isCookieDeclined=localStorage.getItem('cookieDeclined');if(!isCookieAccepted&&!isCookieDeclined){$('.ta-cookie-hint').show();console.log(isCookieAccepted);console.log(isCookieDeclined)}
$('a[href^="http"], a.blank').attr("target","_blank");$('.ta-main-nav a[href^="http"]').not(".navbar-brand").append('<em class="mdi mdi-open-in-new"></em>');$('a.navbar-brand, .ta-slider a').removeAttr("target");$('[data-toggle="tooltip"]').tooltip();$('a[data-toggle="tooltip"]').on('click',function(e){e.preventDefault()});$('.ta-slider').slick({lazyLoad:'ondemand',autoplay:!1,arrows:!0,dots:!0});$('.ta-ce-slider').slick({lazyLoad:'progressive',autoplay:!1,arrows:!0,dots:!1,adaptiveHeight:!0});$('.ta-product-slider').slick({lazyLoad:'ondemand',autoplay:!1,arrows:!0,dots:!1,adaptiveHeight:!1});$('.ta-slider, .ta-product-slider').imagesLoaded(function(){$('.ta-slider, .ta-product-slider').animate({opacity:1},700)});$('.ta-accept-cookies').on('click',function(e){e.preventDefault();sendEvent('Cookie','click','aktzeptiert','');$('.ta-cookie-hint').fadeOut();var cookieAccepted=!0;localStorage.setItem('cookieAccepted',cookieAccepted);console.log("accepted")});$('.ta-decline-cookies').on('click',function(e){e.preventDefault();sendEvent('Cookie','click','abgelehnt','');$('.ta-cookie-hint').fadeOut();var cookieDeclined=!0;localStorage.setItem('cookieDeclined',cookieDeclined);console.log("declined")});$('.ta-register-newsletter').submit(function(e){e.preventDefault();var email=$(this).find(".ta-register-newsletter-mail").val();var location=$(this).attr('action');sessionStorage.setItem("nl_mail",email);window.location.assign(location)});if($('#register-newsletter').length){if(sessionStorage.getItem("nl_mail")){$('#register-newsletter-mail').val(sessionStorage.getItem("nl_mail"))}
var url=new URL(window.location.href);var email=url.searchParams.get("email");if(email!==null){$('#register-newsletter-mail').val(email)}}
$('button#ta-register-seminar').on('click',function(e){$(this).prop("disabled",!0);$("form[name='registration']").submit()});$('.ta-ga-event, a[data-category]').click(function(){sendEvent($(this).data("category"),$(this).data("action"),$(this).data("label"),$(this).data("value"));if($(this).data("action")==="anruf"){goog_report_conversion(window.location)}});getLightboxImages();$('#jsFilterLibraries').click(function(){var dataArray=$('#ta-plugin-library-filter').serializeArray();$('.ta-plugin-library-item').addClass('temporary-hidden');resetFilter();for(var i=0;i<dataArray.length;i++){key=dataArray[i].name;value=dataArray[i].value;if(value||value==='0'){filerItems(key,value)}}
countFilterResults();$('.ta-plugin-library-item').removeClass('temporary-hidden')});$('#jsResetFilter').click(function(){resetFilter()});$('.ta-tag-filter-checkbox').change(function(){if($(this).is(":checked")){var value=$(this).val();$('.ta-tag-filter-checkbox').not($(this)).prop("checked",!1);$('.ta-plugin-product-list-item-wrap').removeClass('ta-filter-hide');$('.ta-plugin-product-list-item-wrap').not('[data-tag'+value+']').addClass('ta-filter-hide')}else{$('.ta-plugin-product-list-item-wrap').removeClass('ta-filter-hide')}});$('.ta-software-anchor').click(function(e){e.preventDefault();var target=$($(this).attr('href')).offset().top;$('html, body').animate({scrollTop:target-200+"px"})});$('input.ta-faq-search').keyup(function(){var searchFilter=$(this).val(),count=0;$('.ta-faq-item').each(function(){if($(this).text().search(new RegExp(searchFilter,'i'))<0){$(this).fadeOut('fast')}else{$(this).show();count++}})});$('.ta-add-favorites').on('click',function(){var e=$(this);var newFavorite={};newFavorite.publicUrl=e.data("url");newFavorite.filetype=e.data("filetype");newFavorite.uid=e.data("uid");if(e.data("title")){newFavorite.title=e.data("title")}else{newFavorite.title=e.data("name")}
addToFavorites(newFavorite);e.parent(".ta-download-file").addClass("is-favorite");sendEvent('favoriten','neu-anlegen',newFavorite.title,0)});$('.ta-download-file, .ta-ce-favorits').on('click','.ta-in-favorites',function(){var e=$(this);var uid=e.data("uid");removeFromFavorites(uid)});$('.ta-search-icon').click(function(){$('.ta-search-field').addClass('ta-show');$('.ta-search-wrapper input[type="text"].form-control').focus();sendEvent('Suche','Suchfeld öffnen','Metanav',0)});$('.ta-search-field .close').click(function(){$('.ta-search-field').removeClass('ta-show')});$('.ta-download-filter').keyup(function(){var val=$(this).val();if(val.length>2){filterDownloadElements(val)}else{resetDownloadElements()}});$('.ta-fairdates-header').click(function(){$(this).siblings('.ta-fairdates-body').toggleClass('visible')})});if($('form button#addProduct')){var form=$('form button#addProduct').parents('form');countHiddenRMAProducts(form);countRMAProducts(form);loadLSData(form);$('#powermail_field_savedata_1').change(function(){if($('#powermail_field_savedata_1:checked').length){saveDataToLS()}else{deleteLSData()}})}
$('form button#addProduct').click(function(){var form=$(this).parents('form');addRMAProduct(form)});$('form button#removeProduct').click(function(){var form=$(this).parents('form');hideRMAProduct(form)});$('#powermail_field_firmenname').change(function(){var value=$(this).val();if(value===""){if($('#powermail_field_uid').attr('required')){$('#powermail_field_uid').attr("required",!1);$('label[for="powermail_field_uid"] > span.mandatory').remove()}}else{$('#powermail_field_uid').attr("required",!0);$('label[for="powermail_field_uid"]').html(function(){var text=$(this).text();return text+'<span class="mandatory">*</span>'})}});$(window).resize(function(){});$(window).scroll(function(){var scrollPos=$(window).scrollTop();if(scrollPos>0){$('.ta-nav-wrapper').addClass('ta-fixed')}else{$('.ta-nav-wrapper').removeClass('ta-fixed')}})})();function addRMAProduct(form){var fieldset=fieldsets.first();fieldset.removeClass('layout4Hidden').addClass('layout4');var count=countHiddenRMAProducts(form);countRMAProducts(form);var index=4-count;$('#powermail_field_produktbezeichnung_0'+index).attr("required",!0);$('label[for="powermail_field_produktbezeichnung_0'+index+'"]').html(function(){var text=$(this).text();return text+'<span class="mandatory">*</span>'});$('#powermail_field_grundderruecksendung_0'+index).attr("required",!0);$('label[for="powermail_field_grundderruecksendung_0'+index+'"]').html(function(){var text=$(this).text();return text+'<span class="mandatory">*</span>'});$('#powermail_field_fehlertrittauf_0'+index).attr("required",!0);$('label[for="powermail_field_fehlertrittauf_0'+index+'"]').html(function(){var text=$(this).text();return text+'<span class="mandatory">*</span>'});$('#powermail_field_fehler_0'+index).attr("required",!0);$('label[for="powermail_field_fehler_0'+index+'"]').html(function(){var text=$(this).text();return text+'<span class="mandatory">*</span>'})}
function hideRMAProduct(form){var fieldset=fieldsetsVisible.last();fieldset.removeClass('layout4').addClass('layout4Hidden');countHiddenRMAProducts(form);var count=countRMAProducts(form);var index=count;$('#powermail_field_produktbezeichnung_0'+index).attr("required",!1).val("");$('label[for="powermail_field_produktbezeichnung_0'+index+'"] > span.mandatory').remove();$('#powermail_field_grundderruecksendung_0'+index).attr("required",!1);$('label[for="powermail_field_grundderruecksendung_0'+index+'"] > span.mandatory').remove();$('#powermail_field_fehlertrittauf_0'+index).attr("required",!1);$('label[for="powermail_field_fehlertrittauf_0'+index+'"] > span.mandatory').remove();$('#powermail_field_fehler_0'+index).attr("required",!1);$('label[for="powermail_field_fehler_0'+index+'"] > span.mandatory').remove()}
function countHiddenRMAProducts(form){fieldsets=form.children('.layout4Hidden');var count=fieldsets.length;if(count===0){$('form button#addProduct').hide()}
return count}
function countRMAProducts(form){fieldsetsVisible=form.children('.layout4');var count=fieldsetsVisible.length;return count}
function loadLSData(){var LSData=JSON.parse(localStorage.getItem('rmafields'));if(LSData!==null){var fields=Object.keys(LSData);fields.forEach(function(field){$('#powermail_field_'+field).val(LSData[field]);$('#powermail_field_savedata_1').prop('checked',!0)})}}
function saveDataToLS(){var index;var fields=['vorname','nachname','email','firmenname','kundennummer','uid','telefonnummer','strasse','plz','ort','land'];var LSData={};for(index=0;index<fields.length;++index){LSData[fields[index]]=$('#powermail_field_'+fields[index]).val()}
localStorage.setItem('rmafields',JSON.stringify(LSData))}
function deleteLSData(){localStorage.removeItem('rmafields')}
function filterDownloadElements(value){var needle=value.toLowerCase();$('.ta-ce-downloads > .ta-ce-accordion > .ta-accordion-item').each(function(){var hay=$(this).text();searchElementByArray($(this),hay,needle,!0)});$('.ta-ce-downloads').each(function(){if($(this).find('.visibleAfterFilter').length===0){$(this).find('.ta-ce-accordion, h2').hide()}})}
function resetDownloadElements(){$('.ta-ce-downloads').find('.ta-ce-accordion, .ta-accordion-item ,h2').show()}
function searchElementByText(element,hay,needle,checkChildren){var plain=hay;var plainLower=plain.toLowerCase();var noWhiteSpace=plainLower.replace(/\s+/g,'');if(noWhiteSpace.indexOf(needle)!==-1){element.show().addClass("visibleAfterFilter");element.children('.ta-accordion-body.collapse').collapse('show');if(checkChildren===!0){element.find('.ta-accordion-item').each(function(){searchElementByText($(this),$(this).find('.ta-accordion-body').text(),needle,!1)})}}else{element.children('.ta-accordion-body.collapse.show').collapse('hide');element.hide().removeClass("visibleAfterFilter")}}
function searchElementByArray(element,hay,needle,checkChildren){var plain=hay;var needles=needle.split(" ");var plainLower=plain.toLowerCase();var noWhiteSpace=plainLower.replace(/\s+/g,'');needles.forEach(function(needle){if(noWhiteSpace.indexOf(needle)!==-1){element.show().addClass("visibleAfterFilter");element.children('.ta-accordion-body.collapse').collapse('show');if(checkChildren===!0){element.find('.ta-accordion-item').each(function(){searchElementByText($(this),$(this).find('.ta-accordion-body').text(),needle,!1)})}}else{element.children('.ta-accordion-body.collapse.show').collapse('hide');element.hide().removeClass("visibleAfterFilter")}})}
function getLightboxImages(){bindSliderToLightbox();$('div.ta-ce img, div.ta-plugin img').not('.ta-nolightbox, .ta-variant-image, .ta-software-icon, .ta-product-icons img, .ta-icon, .ta-categories img').each(function(){var innerHtml=$(this).parents('figure').html();var fullHtml='<figure>'+innerHtml+'</figure>';$('.ta-lightbox-slider').slick('slickAdd',fullHtml);$(this).addClass('ta-js-lightbox').attr('data-lbindex',lbIndex++)});bindImagesToLightbox()}
function bindImagesToLightbox(){lbWrapper=$('#ta-lightbox-wrapper');$('main').on('click','.ta-js-lightbox',function(){lbWrapper.addClass('show');$(window).trigger('resize');$('.ta-lightbox-slider').slick('slickGoTo',$(this).data('lbindex'))});$('#ta-lightbox-wrapper .close').click(function(){lbWrapper.removeClass('show')})}
function bindSliderToLightbox(){$('.ta-lightbox-slider').slick({lazyLoad:'onDemand',infinite:!0,autoplay:!1,arrows:!0,dots:!1,adaptiveHeight:!1,slidesToShow:1})}
function sendEvent(category,action,label,value){ga('send','event',{eventCategory:category,eventAction:action,eventLabel:label,eventValue:value})}
function filerItems(key,value){$('.ta-plugin-library-item').each(function(){if($(this).data(key)!==parseInt(value)){$(this).addClass('hide-'+key)}})}
function resetFilter(){var keys=['device','loops','kettles','solar','type'];for(var i=0;i<keys.length;i++){$('.ta-plugin-library-item').removeClass('hide-'+keys[i])}
$('.singular, .plural, .ta-filter-result').css('display','none')}
function countFilterResults(){var filterResultCounter=0;$('.ta-plugin-library-item').not('[class*="hide-"]').each(function(){filterResultCounter++});$('.ta-result-number').text(filterResultCounter);$('.ta-filter-result').css('display','inline-block');if(filterResultCounter===1){$('.singular').css('display','inline-block')}else{$('.plural').css('display','inline-block')}}
function getFavorites(parseHtml){var favorites=JSON.parse(localStorage.getItem('favorites'));if(parseHtml===!0){if(favorites){updateFavoritesHtml(favorites)}}
return favorites}
function updateFavoritesHtml(favorites){$('.ta-download-file').removeClass('is-favorite');var html="";p=favorites;for(var key in p){if(p.hasOwnProperty(key)){html+='<div id="file-'+key+'" class="ta-favorite-file is-favorite">';html+='<a class="ta-ga-event" href="'+p[key].publicUrl+'"';html+='data-category="dokumente" data-action="download" data-label="'+p[key].title+'"';html+='download><span class="ta-filetype">'+p[key].filetype+'</span>'+p[key].title+'</a>';html+='<span class="ta-in-favorites" data-uid="'+key+'">';html+='<em class="mdi mdi-delete"></em>';html+='</span>';html+='</div>';$('div#file-'+key).addClass('is-favorite')}}
if(html!==""){$('.ta-favorites-text').hide();$('.ta-favorites').html(html).removeClass('hidden-xs-up')}else{$('.ta-favorites-text').show();$('.ta-favorites').html(html).addClass('hidden-xs-up')}}
function addToFavorites(newFavorite){var storedFavorites=getFavorites();if(storedFavorites){aFavorites=storedFavorites}
aFavorites[newFavorite.uid]=newFavorite;updateFavoritesHtml(aFavorites);localStorage.setItem('favorites',JSON.stringify(aFavorites))}
function removeFromFavorites(key){var storedFavorites=getFavorites();if(storedFavorites){aFavorites=storedFavorites}
if(aFavorites.hasOwnProperty(key)){delete aFavorites[key]}
updateFavoritesHtml(aFavorites);localStorage.setItem('favorites',JSON.stringify(aFavorites))}
function gaOptout(){window['ga-disable-UA-9221319-2']=!0;localStorage.setItem('gaOptout',"true")}
function checkifGAOptOut(){var hasOptedOut=localStorage.getItem('gaOptout');if(hasOptedOut==="true"){gaOptout()}}
var player;function onYouTubeIframeAPIReady(){player=new YT.Player('player',{autoplay:1,origin:"https://www.ta.co.at",rel:0,color:"white"})}(function(){$('document').ready(function(){$('.ta-close-video').click(function(){var ytid=$(this).data('ytid');player.stopVideo();$('#ytoverlay').hide()});$('.js-show-overlay').click(function(){var ytid=$(this).data('ytid');var $video=$('#ytoverlay');player.loadVideoById(ytid,0,"default");var videoPosY=calculateVideoPos();$video.css("top",videoPosY+"px").show();sendEvent('Video','klick',ytid)})});$(window).resize(function(){})})();function calculateVideoPos(){var scrollPos=$(window).scrollTop();var windowHeight=$(window).height();var height=($(window).width()*0.7)*0.5625;return(windowHeight-height)/2+scrollPos}