PageSourceSearch

https://www.demetz-patrick.com/js/main.js

js demetz-patrick.com collected 2026-10-10 01:17:53 UTC 51,687 bytes, 1,913 lines download raw bytes

1// Globale Variablen
2var path = '/fileadmin/template/';
3// bei der Test-Version den Pfad anpassen
4if (window.location.href.split('10.1.1.1').length == 2 || window.location.href.split('M:').length == 2)
5{
6	path = '';
7}
8
9var breakpoint = 'desktop';
10var lastScrollTop = 0;
11
12// Close Menu on which breakpoint? (Smartphone menu)
13/*var closedmenu = {
14	smartphone:	true,
15	tablet:		true,
16	desktop:	false // <- auch CSS anpassen
17}*/
18
19// Definition der Texte
20var strings = {
21	more: {
22		de: 'weiter lesen',
23		it: 'continua',
24		en: 'read more',
25	},
26	less: {
27		de: 'schließen',
28		it: 'nascondi',
29		en: 'close',
30	},
31	delete: {
32		de: 'Bist du sicher, dass du dieses Produkt aus dem Warenkorb entfernen möchtest?',
33		it: 'Sei sicuro di voler rimuovere questo prodotto dal carrello?',
34		en: 'Are you sure you want to remove this product from the shopping cart?',
35	},
36	notavailable: {
37		de: 'Nicht verfügbar',
38		it: 'Non disponibile',
39		en: 'Not available',
40	},
41	noimage: {
42		de: 'Kein Bild vorhanden',
43		it: 'Nessuna immagine disponibile',
44		en: 'No picture available',
45	},
46	productalreadyexists: {
47		de: 'Produkt bereits im Warenkorb vorhanden!',
48		it: 'Prodotto già presente nel carrello!',
49		en: 'Product already in shopping cart!',
50	},
51	emailnotequal: {
52		de: 'Die eingegebenen Emailadressen stimmen nicht überein!',
53		it: 'Gli indirizzi e-mail inseriti non corrispondono!',
54		en: 'The entered email addresses does not match!',
55	},
56};
57
58
59// Iframe blocken
60if (top != self && top.location.host != self.location.host) {
61	top.location = self.location;
62}
63
64
65// Sprach-Mapping
66var languages = {
67	de: 'deu',
68	it: 'ita',
69	en: 'eng'
70};
71
72
73// Sprach-Mapping für Typo3
74var languages_typo3 = {
75	de: '0',
76	it:	'2',
77	en: '1'
78};
79
80
81// Sprache ermitteln
82if(!lang || lang.length !== 3) {
83	if(typeof la === 'undefined') {
84		var la = window.document.location.href.split('/');la = la[la.length-2];
85	}
86	var lang = languages[la];
87}
88else if (!la)
89{
90	for (var i in languages)
91	{
92		if (languages[i] === lang)
93		{
94			var la = i;
95		}
96	}
97}
98
99
100var preventFilterSubmit = false;
101
102
103// Funktion die beim initialisieren des Dokuments ausgeführt wird
104/*var lastmenuclick = null;*/
105function init() {
106	if(detectIE()) {
107		$('body').addClass('iebrowser');
108	}
109
110
111	// Breakpoint und Breite der Seite ermitteln
112	detect_breakpoint();
113
114
115	// Suchformular ausblende auf der Suche-Seite
116	if($('#searchform').length > 0) {
117		$('#header form.search').addClass('hide');
118	}
119
120
121	// Artikel auf Smartphone zuklappen
122	if(breakpoint === 'smartphone') {
123		$('.articlestandard .contentcontainer').each(function() {
124			if($(this).height() > 200) {
125				$(this).closest('.articlestandard').addClass('closed-xs');
126				$(this).append('<span class="readmore">'+strings.more[la]+'</span>');
127
128				$(this).find('.readmore').click(function() {
129					// $(this).closest('.articlestandard').find('.contentcontainer').css('max-height', $(window).height() * 1.5);
130					var elem = this;
131					var parentElem = $(this).closest('.articlestandard');
132
133					$('html, body').stop().animate({scrollTop: $(parentElem).offset().top - 20}, 500);
134					setTimeout(function () {
135						$(elem).closest('.articlestandard').removeClass('closed-xs');
136					}, 250);
137				});
138			}
139		});
140	}
141
142	// sticky auf smartphone
143	$('.sidebar, .productadvantages').each(function() {
144		$(this).closest('.col-md-4').addClass('show-sticky');
145		$(this).closest('.fullscreen').addClass('show-overflow');
146	});
147
148
149
150	$(document).on('click', 'body', function(event) {
151		if($('body').hasClass('submenuopen') === true && $(event.target).closest('#header').length === 0) {
152			event.preventDefault();
153			$('#mainmenu ul li.hover > a').click();
154		}
155	});
156
157	// Links im Menü für die Smartphone Version anpassen
158	$('#mainmenu > nav').click(function(event) {
159		if(event.target === $('#mainmenu > nav').get(0)) {
160			if(breakpoint === 'tablet' || breakpoint === 'smartphone') {
161				$('#mainmenu > nav > ul > li > a').click();
162				event.preventDefault();
163				return false;
164			}
165		}
166	});
167	$('#mainmenu > nav > ul > li > a').addClass('menunav').click(function() {
168		menuHeight();
169		if($(this).parent().attr('status') === 'open') {
170			$(this).parent().find('> ul').slideUp(500, function() {
171				$(this).parent().attr('status', 'closed');
172				// $(this).removeAttr('style');
173				$(this).css('display', '');
174			});
175			$('body').removeClass('menuopen');
176		} else {
177			$(this).parent().find('> ul').slideDown(500, function() {
178				// $(this).removeAttr('style');
179				$(this).css('display', '');
180			});
181			$(this).parent().attr('status', 'open');
182			$('body').addClass('menuopen');
183		}
184		menuHeight();
185		/*setTimeout(function() {
186			menuHeight();
187		}, 500);*/
188	});
189	$('#mainmenu > nav > ul > li > ul > li > a').click(function(event) {
190		menuHeight();
191		if($(this).parent().hasClass('hover') === true) {
192			$(this).parent().removeClass('hover');
193			$(this).parent().find('ul > li.back').remove();
194			$(this).parent().find('li.hover').removeClass('hover');
195			$('#mainmenu > nav > ul > li > ul').removeClass('hidemenu');
196			$('body').removeClass('submenuopen');
197			return false;
198		} else {
199			$('#mainmenu > nav > ul > li > ul > li.hover').removeClass('hover');
200			if($(this).parent().find('.submenu').length > 0) {
201				$(this).parent().find('.submenuinner > ul').prepend('<li class="back hidden-lg hidden-md">'+$(this).get(0).outerHTML+'</li>');
202				$(this).parent().addClass('hover');
203				$('#mainmenu > nav > ul > li > ul').addClass('hidemenu');
204				$('body').addClass('submenuopen');
205				event.preventDefault();
206				return false;
207			}
208			// else return true!
209		}
210		bLazy.revalidate();
211	});
212	$(document).on('click', '#mainmenu > nav > ul > li > ul > li ul li a', function(event) {
213		if($(this).parent().hasClass('back') === true) {
214			$(this).closest('ul').closest('li.hover').find('> a').click();
215			$(this).parent().remove();
216
217			event.preventDefault();
218			return false;
219		}
220		else if($(this).parent().find('> ul').length > 0 && breakpoint !== 'widescreen' && breakpoint !== 'desktop') {
221			// $(this).closest('.submenu').find('ul').addClass('hidemenu').scrollTop(0);
222			$(this).closest('nav').find('> ul > li ul').addClass('hidemenu').scrollTop(0);
223
224			if($(this).parent().hasClass('hover') === false) {
225				$(this).parent().addClass('hover');
226				$(this).parent().find('> ul').prepend('<li class="back hidden-lg hidden-md">'+$(this).get(0).outerHTML+'</li>');
227				$(this).parent().find('> ul').removeClass('hidemenu');
228			} else {
229				$(this).parent().removeClass('hover');
230				$(this).parent().find('ul > li.back').remove();
231				$(this).closest('li.hover').find('> ul, .submenuinner > ul').removeClass('hidemenu');
232			}
233
234			event.preventDefault();
235			return false;
236		}
237	});
238	$('#mainmenu > nav > ul > li > ul > li .submenu .submenuinner > ul > li > ul').each(function() {
239		if($(this).find('li:not(.hidden-lg)').length > 7) {
240			if($(this).find('li').first().find('.showall').length > 0) {
241				$(this).append('<li class="hidden-sm hidden-xs">'+$(this).find('li').first().html()+'</li>');
242			}
243			$(this).find('li:not(.hidden-lg)').each(function(k, v) {
244				if(k >= 6 && $(v).find('.showall').length === 0) {
245					$(this).addClass('hidden-lg hidden-md');
246				}
247			});
248		}
249	});
250
251	// search form
252	$('form.search .clearsearch').click(function() {
253		$('form.search input[type="text"]').val('').focus();
254	});
255
256
257	// html anpassung
258	$('.fullscreen .col-md-8 .articleslider').each(function() {
259		$(this).closest('.row').find('> .col-md-4 .sidebar').addClass('hideontablet');
260	});
261
262	// anpassung Smartphone
263	if($('body').hasClass('hideheader') === false) {
264		$('.articleinfo').each(function () {
265			if ($(this).closest('.fullscreen').find('.article').length === 1) {
266				$(this).closest('.fullscreen').addClass('hidden-xs');
267			}
268		});
269	}
270	$('.articledetailview .buyadvantages').clone().addClass('hidden-sm hidden-md hidden-lg').insertAfter($('.articledetailview .productadditionalinfos .pricelist'));
271	$('.articledetailview .questions').clone().addClass('hidden-sm hidden-md hidden-lg').insertAfter($('.articledetailview .productadditionalinfos .pricelist'));
272
273	// filter
274	$('.filter').each(function() {
275		$(this).closest('.fullscreen').addClass('hasfilter')
276	});
277	$('.filtertitle').click(function() {
278		if(breakpoint === 'smartphone') {
279			if($(this).attr('status') === 'open') {
280				$(this).attr('status', 'closed');
281				var filterItems = $(this).parent().find('.filteritem');
282				$(this).parent().find('.filteritem').slideUp(function() {
283					$(filterItems).removeAttr('style');
284				});
285			} else {
286				$(this).attr('status', 'open');
287				$(this).parent().find('.filteritem').slideDown();
288				$('html, body').animate({scrollTop: $('.filter').offset().top - 20}, 1000);
289			}
290		}
291	});
292
293	scroll();
294
295	// Anpassungen des Browser-Fensters vornehmen
296	resize(true);
297
298	// Debugging-Box erstellen
299	if (document.location.href.indexOf('debug') != -1)
300	{
301		$('<div id="pagesize"></div>').appendTo($('body'));
302	}
303}
304
305
306// Funktion die beim laden des Dokuments ausgeführt wird
307var bLazy;
308function load() {
309
310	// Breakpoint und Breite der Seite ermitteln
311	detect_breakpoint();
312
313	// video
314	$('.video').click(function(event) {
315		if($(this).find('iframe').length > 0) {
316			$(this).find('iframe').attr('src', $(this).find('iframe').attr('data-src'));
317			$(this).addClass('show');
318			$(this).find('iframe').removeAttr('data-src');
319
320			event.preventDefault();
321			return false;
322		}
323	});
324
325	// dropdowns
326	Dropdown.init();
327
328	$('.resetall').click(function() {
329		preventFilterSubmit = true;
330		Dropdown.reset($(this).closest('form').find('.dropdown'), true);
331		preventFilterSubmit = false;
332		$(this).closest('form').find('input').first().change();
333	});
334
335	// filter
336	$('.filter input').change(function() {
337		if(preventFilterSubmit === true) {
338			return;
339		}
340		$('.aiaxcontent').addClass('loading');
341
342		var form = $(this).closest('form');
343		var params = $(form).serialize();
344		var url = 'https://www.demetz-patrick.com/shop.php?'+params+'&compact=1';
345		$.get(url, function(data) {
346			$('.aiaxcontent').replaceWith(data);
347			bLazy.revalidate();
348		});
349	});
350
351
352	// radiobox
353	$('.radiobox').each(function() {
354		var elem = this;
355
356		// remove transparent gif
357		$(this).find('label').each(function() {
358			if($(this).find('img').length > 0 && $(this).find('img').attr('src') !== '' && $(this).find('img').attr('src').substr(-9) === 'trasp.gif') {
359				$(this).find('img').remove();
360				if($(this).prev('input').length > 0) {
361					$(this).append('<small>'+$(this).prev('input').attr('data-label')+'</small>');
362				}
363			}
364		});
365
366		$(this).find('input[type="radio"]').change(function() {
367			if($(this).prop('checked') === false) {
368				return;
369			}
370
371			var label = $(this).next('label').html();
372			if(typeof $(this).attr('data-label') !== 'undefined') {
373				label = $(this).attr('data-label');
374			}
375			$(elem).find('.placeholder').hide();
376			$(elem).find('.valuepreview').html(label);
377			$('.valuepreview.'+$(this).attr('name')).html(label);
378
379			if($(this).attr('name') === 'ausfuehrung') {
380				updateProductImage();
381			}
382		});
383	});
384
385	// login form
386	$('#billform').submit(function() {
387		if($('#email').val() !== $('#email2').val()) {
388			alert(strings.emailnotequal[la]);
389			$('#email').focus();
390			return false;
391		}
392	});
393
394	// detailseite form
395	getProductData();
396	$('form.addtocart').change(function() { // change
397		if(validateAddToCartForm(this) === true) {
398			var price = getProductPrice();
399			if(price !== false) {
400				$('.articledetailview .priceinfo .price, #modaladdtocart .price .big').html(price);
401				$(this).find('button[type="submit"]').removeClass('disabled');
402			} else {
403				$('.articledetailview .priceinfo .price, #modaladdtocart .price .big').html(strings.notavailable[la]);
404				$(this).find('button[type="submit"]').addClass('disabled');
405			}
406		} else {
407			$(this).find('button[type="submit"]').addClass('disabled');
408		}
409	}).submit(function(event) { // submit
410		if(validateAddToCartForm(this) === true) {
411			addToCart(this);
412		}
413
414		event.preventDefault();
415		return false;
416	});
417	$('form.addtocart').change();
418	$('.pricelist a.addtocart').click(function(event) {
419		var url = $(this).attr('href') + '&additionalparam=1';
420		var jqxhr = $.get(url, function() {
421			var groesse = gup('aid1', url);
422			var ausfuehrung = gup('aid2', url);
423
424			var groesseLabel = $('label[for="groese'+groesse+'"]').text();
425			$('#modaladdtocart .valuepreview.groese').html(groesseLabel);
426			var ausfuehrungLabel = $('#ausfuehrung'+ausfuehrung).attr('data-label');
427			$('#modaladdtocart .valuepreview.ausfuehrung').html(ausfuehrungLabel);
428			var price = getProductPrice(ausfuehrung, groesse);
429			$('#modaladdtocart .price .big').html(price);
430
431			addToCartShowModal();
432		}).fail(function() {
433			alert("error");
434		});
435
436		// addToCartShowModal();
437
438		event.preventDefault();
439		return false;
440	});
441
442	// detailseite
443	if($('.fotopreview .foto').length < 2) {
444		$('.fotopreview').hide();
445	}
446	$('.fotopreview .foto').mouseenter(function() {
447		var imageSrc = $(this).attr('data-image');
448		var imageSrcBig = $(this).attr('data-image-big');
449		if(typeof imageSrc !== 'undefined' && imageSrc !== '') {
450			// same image
451			if($(this).closest('.productfoto').find('.fotobig img').attr('src') === imageSrc || $(this).closest('.productfoto').find('.fotobig img').attr('src') === imageSrcBig) {
452				return;
453			}
454
455			var image = '<img class="b-lazy" src="data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 7 5\' width=\'7\' height=\'5\'></svg>" data-src="'+ imageSrc+'" alt="" />';
456			$(this).closest('.productfoto').find('.fotobig').attr('data-image-big', imageSrcBig).find('img').remove();
457			$(this).closest('.productfoto').find('.fotobig').prepend(image);
458			setTimeout(function() {
459				bLazy.revalidate();
460			}, 100);
461
462			$(this).closest('.fotopreview').find('.foto.active').removeClass('active');
463			$(this).addClass('active');
464		}
465	});
466	$('.fotopreview .foto').first().trigger('mouseenter');
467
468	$('.productfoto .fotobig').mouseenter(function() {
469		if(breakpoint === 'tablet' || breakpoint === 'smartphone') {
470			return;
471		}
472
473		$(this).addClass('loading');
474
475		var imageBigSrc = $(this).attr('data-image-big');
476		var elem = this;
477		if(typeof imageBigSrc !== 'undefined' && imageBigSrc !== '') {
478			loadImage($(this).find('img'), imageBigSrc, function(imgDom) {
479				$(elem).find('img').attr('src', imageBigSrc);
480				$(elem).removeAttr('data-image-big');
481
482				setTimeout(function() {
483					startZoom(elem);
484				}, 100);
485
486			});
487		}
488
489		// start zoom
490		else {
491			startZoom(this);
492		}
493
494	});
495	$('.productfoto .fotobig').mouseleave(function() {
496		if(breakpoint === 'tablet' || breakpoint === 'smartphone') {
497			return;
498		}
499
500		endZoom(this);
501	});
502	var lastPageX = 0;
503	var lastPageY = 0;
504	$('.productfoto .fotobig').mousemove(function(event) {
505		if(breakpoint === 'tablet' || breakpoint === 'smartphone') {
506			return;
507		}
508
509		if(typeof event.pageX === 'undefined') {
510			event.pageX = lastPageX;
511		}
512		if(typeof event.pageY === 'undefined') {
513			event.pageY = lastPageY;
514		}
515
516		var positionX = event.pageX - $(this).offset().left;
517		var positionY = event.pageY - $(this).offset().top;
518
519		var percentX = positionX * 100 / $(this).width();
520		var percentY = positionY * 100 / $(this).height();
521
522		percentX = $(this).find('> img').width() / 100 * percentX;
523		percentY = $(this).find('> img').height() / 100 * percentY;
524
525		percentX = percentX - positionX;
526		percentY = percentY - positionY;
527
528		if(percentX < 0) {
529			percentX = percentX * -1;
530		}
531		if(percentY < 0) {
532			percentY = percentY * -1;
533		}
534
535		moveZoom(this, percentX, percentY);
536
537		lastPageX = event.pageX;
538		lastPageY = event.pageY;
539	});
540
541	// cart form
542	$('.customdropdown input[type="number"]').change(function(event) {
543		event.stopImmediatePropagation();
544		event.preventDefault();
545
546		if($(this).parent().is('form') === true && $(this).val() !== $(this).attr('data-value')) {
547			$(this).parent().submit();
548		}
549	});
550
551	// productfoto smartphone
552	createProductSlider();
553
554	// cart
555	/* not needed, changes to number input
556	$('form.cart select[name="quantity"]').change(function() {
557		$(this).closest('form').submit();
558	});
559	*/
560
561	$('.cartlinks .delete').click(function() {
562		return confirm(strings.delete[la]);
563	});
564
565
566	// Lazyload bei Artikel
567	if(typeof(Blazy) != 'undefined') {
568		$('.b-lazy').parent().addClass('childLoading');
569		bLazy = new Blazy({
570			// selector: 'img', // all images
571			breakpoints: [
572			{
573				width: 420, // max-width
574				src: 'data-src-xsmall'
575			},
576			{
577				width: 640, // max-width
578				src: 'data-src-small'
579			},
580			{
581				width: 960, // max-width
582				src: 'data-src-medium'
583			}],
584			success: function(element){
585				setTimeout(function() {
586					$(element).removeClass('b-lazy').parent().removeClass('childLoading');
587				}, 200);
588			}
589		});
590	}
591
592
593	// Headerimage - Swiper 4.1.0
594	var loop = true;
595	if($('#headerimage .swiper-slide').length < 2) {
596		$('#headerimage .swiper-pagination').hide();
597		loop = false;
598	}
599	var swiper = new Swiper('#headerimage .swiper-container', {
600		effect: 'fade', // 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip'
601		fadeEffect: {
602			crossFade: true
603		},
604		loop: loop,
605		keyboard: true,
606		slidesPerView: 1,
607		speed: 1000,
608		autoplay: {
609			delay: 4000,
610		},
611		pagination: {
612			el: '#headerimage .swiper-pagination',
613			type: 'bullets',
614			clickable: true,
615			renderBullet: function (index, className) {
616				return '<span class="' + className + '">' + (index + 1) + '</span>';
617			},
618		},
619		breakpoints: {
620			1280: { // Desktop
621			},
622
623			960: { // Tablet
624			},
625
626			640: { // Smartphone
627			},
628		},
629		// Events
630		on: {
631			init: function () {
632			},
633			slideChange: function() {
634				// lazyload is enabled
635				if(typeof(bLazy) != 'undefined') {
636					bLazy.revalidate();
637				}
638			}
639		}
640    });
641
642
643	// Slider bei Artikel
644	$('.articleslider').each(function() {
645		var loop = true;
646		if($(this).find('.swiper-slide').length < 2) {
647			$(this).find('.swiper-pagination').hide();
648			loop = false;
649		}
650		var articleslider = new Swiper($(this).find('.swiper-container'), {
651			effect: 'fade', // 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip'
652			fadeEffect: {
653				crossFade: true
654			},
655			autoHeight: true,
656			loop: loop,
657			keyboard: false,
658			slidesPerView: 1,
659			speed: 1000,
660			autoplay: {
661				delay: 4000,
662			},
663			pagination: {
664				el: $(this).find('.swiper-pagination'),
665				type: 'bullets',
666				clickable: true,
667				renderBullet: function (index, className) {
668					return '<span class="' + className + '">' + (index + 1) + '</span>';
669				},
670			},
671			breakpoints: {
672				1280: { // Desktop
673				},
674
675				960: { // Tablet
676				},
677
678				640: { // Smartphone
679				},
680			},
681			// Events
682			on: {
683				init: function () {
684				},
685				slideChange: function() {
686					// lazyload is enabled
687					if(typeof(bLazy) != 'undefined') {
688						bLazy.revalidate();
689					}
690				}
691			}
692		});
693	});
694
695
696	// Heiligenkalender
697	$('.articleholycalendar').each(function() {
698		var elem = this;
699		var holycalendarbig = new Swiper($(this).find('.swiper-container.big'), {
700			effect: 'fade', // 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip'
701			fadeEffect: {
702				crossFade: true
703			},
704			loop: false,
705			slidesPerView: 1,
706			allowTouchMove: false,
707			speed: 1000,
708			/*navigation: {
709				nextEl: $(this).find('.swiper-button-next'),
710				prevEl: $(this).find('.swiper-button-prev'),
711			},*/
712			breakpoints: {
713				1280: { // Desktop
714				},
715
716				960: { // Tablet
717				},
718
719				640: { // Smartphone
720				},
721			},
722			// Events
723			on: {
724				init: function () {
725					setTimeout(function() {
726						var currentSwiper = $(elem).find('.swiper-container.big > .swiper-wrapper > .swiper-slide.swiper-slide-active').get(0).querySelector('.swiper-container').swiper;
727						currentSwiper.autoplay.start()
728					}, 100);
729				},
730				slideChange: function() {
731					// lazyload is enabled
732					if(typeof(bLazy) != 'undefined') {
733						bLazy.revalidate();
734					}
735
736					$(elem).find('.swiper-container.big > .swiper-wrapper > .swiper-slide').each(function() {
737						$(this).get(0).querySelector('.swiper-container').swiper.autoplay.stop();
738					});
739					setTimeout(function() {
740						var currentSwiper = $(elem).find('.swiper-container.big > .swiper-wrapper > .swiper-slide.swiper-slide-active').get(0).querySelector('.swiper-container').swiper;
741						currentSwiper.autoplay.start()
742					}, 100);
743				},
744			}
745		});
746		var holycalendar = new Swiper($(this).find('.swiper-container.small'), {
747			effect: 'slide', // 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip'
748			/*loop: false,*/
749			loop: true,
750			slidesPerView: 5,
751			allowTouchMove: false,
752			slideToClickedSlide: true,
753			speed: 1000,
754			navigation: {
755				nextEl: $(this).find('.swiper-button-next'),
756				prevEl: $(this).find('.swiper-button-prev'),
757			},
758			breakpoints: {
759				1280: { // Desktop
760					slidesPerView: 5,
761				},
762
763				960: { // Tablet
764					slidesPerView: 4,
765				},
766
767				640: { // Smartphone
768					slidesPerView: 3,
769				},
770
771				0: { // Smartphone
772					slidesPerView: 2,
773				},
774			},
775			// Events
776			on: {
777				init: function () {
778				},
779				slideChange: function() {
780					if(typeof holycalendar !== 'undefined') { // prevent on first call
781						var index = holycalendar.realIndex;
782						holycalendarbig.slideTo(index);
783					}
784
785					// lazyload is enabled
786					if(typeof(bLazy) != 'undefined') {
787						bLazy.revalidate();
788					}
789				},
790			}
791		});
792		$(this).find('.swiper-container.big .swiper-container').each(function() {
793			var loop = true;
794			if($(this).find('.swiper-slide').length < 2) {
795				loop = false;
796			}
797			var holycalendarbigsubslider = new Swiper($(this), {
798				effect: 'fade', // 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip'
799				fadeEffect: {
800					crossFade: true
801				},
802				loop: loop,
803				slidesPerView: 1,
804				allowTouchMove: true,
805				speed: 1000,
806				/*autoplay: {
807					delay: 3000,
808				},*/
809				breakpoints: {
810					1280: { // Desktop
811					},
812
813					960: { // Tablet
814					},
815
816					640: { // Smartphone
817					},
818				},
819				// Events
820				on: {
821					init: function() {
822						this.autoplay.stop();
823					},
824					slideChange: function() {
825						// lazyload is enabled
826						if(typeof(bLazy) != 'undefined') {
827							bLazy.revalidate();
828						}
829					},
830				}
831			});
832		});
833	});
834	// dont needed anymore
835	$(document).on('click', '.articleholycalendar .swiper-button-next.swiper-button-disabled, .articleholycalendar .swiper-button-prev.swiper-button-disabled', function(event) {
836		if($(this).hasClass('opencalendar') === true) {
837			event.preventDefault();
838			window.location.href = $('.fullcalendar').attr('href');
839		} else {
840			$(this).addClass('opencalendar');
841		}
842	});
843
844
845
846	// Slider bei Artikel
847	/* // zusätzlicher Slider z.B. bei einem Artikel
848	$('.articleslider').each(function() {
849		var articleslider = new Swiper($(this).find('.swiper-container'), {
850			effect: 'slide', // 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip'
851			loop: true,
852			keyboard: true,
853			slidesPerView: 1,
854			speed: 1000,
855			autoplay: {
856				delay: 4000,
857			},
858			navigation: {
859				nextEl: $(this).find('.swiper-button-next'),
860				prevEl: $(this).find('.swiper-button-prev'),
861			},
862			breakpoints: {
863				1280: { // Desktop
864				},
865
866				960: { // Tablet
867				},
868
869				640: { // Smartphone
870				},
871			},
872			// Events
873			on: {
874				init: function () {
875					// Slider Höhe anpassen
876					if(typeof($.fn.resizeToParent) != 'undefined') {
877						$(this).find('img').resizeToParent({delay: 10}); // , parent: '#headerimage'
878					}
879				},
880				slideChange: function() {
881					// lazyload is enabled
882					if(typeof(bLazy) != 'undefined') {
883						bLazy.revalidate();
884					}
885					if(typeof($.fn.resizeToParent) != 'undefined') { // quickfix
886						$(this).('img').resizeToParent('update');
887					}
888				}
889			}
890		});
891	});
892	*/
893
894
895	// Lightbox initialisieren (Fancybox)
896	if(typeof($().fancybox) != 'undefined') {
897		$().fancybox({
898			selector: '[data-fancybox]', //, [data-fancybox-trigger]
899			loop: true,
900			backFocus: false,
901			buttons : [
902				'zoom',
903				'close'
904			],
905			hash: false,
906			/*afterShow: function(instance, current) {
907				var ratio = $(instance.$lastFocus).attr('data-ratio');
908				if(typeof ratio !== 'undefined' && ratio.indexOf('x') !== -1) {
909					$('.fancybox-content').attr('data-ratio', ratio);
910					resize(true);
911				}
912			}*/
913			/* // falls das bLazy in der Lightbox verwendet wird
914			afterShow: function(instance, current) {
915				bLazy.revalidate();
916			},
917			*/
918		});
919
920		// 360° link
921		$().fancybox({
922			selector: '.a360',
923			buttons : [
924				'close'
925			],
926			hash: false,
927			defaultType: "iframe",
928			idleTime: false,
929			iframe: {
930				preload: true,
931				css: {
932					width: '100%',
933					height: '100%'
934				}
935			}
936		});
937	}
938
939
940	// popover
941	$('[data-toggle="popover"]').each(function() {
942		if(typeof $(this).attr('data-image') === 'undefined' || $(this).attr('data-image') === '' || $(this).attr('data-image').substr(-1) === '-') {
943			return;
944		}
945
946		var image = '<img src="'+$(this).attr('data-image')+'" alt="" />';
947		$(this).popover({
948			html: true,
949			trigger: 'hover',
950			content: image
951		});
952	});
953
954	// tooltip
955	$('[data-toggle="tooltip"]').tooltip();
956
957	// accordion
958	$('.accordion').each(function() {
959		$(this).addClass('open');
960		$(this).find('.accordion-title').click(function() {
961			if($(this).closest('.accordion').hasClass('open') === true) {
962				$(this).closest('.accordion').removeClass('open').find('.accordion-body').slide
962Up();
963			} else {
964				$(this).closest('.accordion').addClass('open').find('.accordion-body').slideDown();
965			}
966		});
967	});
968
969	// radiobox init default values (must be after images init)
970	$('.radiobox').each(function() {
971		if ($(this).find('input[type="radio"]').length === 1) {
972			$(this).find('input[type="radio"]').prop('checked', true).trigger('change');
973		}
974	});
975
976	if(typeof(build_datepicker) != 'undefined') {
977		build_datepicker('#period');
978	}
979
980	if($('#takeovermodal').length > 0) {
981		showTakeOverModal();
982	}
983
984	// html anpassungen
985	if($('body').hasClass('hideheader') === false) {
986		var html = '';
987		$('#footerbottom .flex > div').each(function() {
988			if($(this).hasClass('localpartner') === false && $(this).attr('id') !== 'editing') {
989				html += $(this).html();
990			}
991		});
992		$('#footer').prepend('<div class="container footer-xs hidden-lg hidden-md hidden-sm">'+html+'</div>');
993	}
994
995	$('body').addClass('menufixed');
996	scroll();
997
998	// Anpassungen des Browser-Fensters vornehmen
999	resize(false);
1000}
1001jQuery(document).ready(function(){load();});
1002
1003
1004// Auto scroll on hashtag - for request and booking page!
1005$(window).on('load', function(){
1006	if(location.hash != '' && $(location.hash).length > 0) {
1007		var offset = $(location.hash).offset().top;
1008		$('[data-formwidget="offset"]').each(function() {
1009			offset -= $(this).outerHeight();
1010		});
1011		$('html,body').animate({scrollTop: offset}, 1000);
1012	}
1013});
1014
1015
1016/* on scroll event (with passive support) */
1017var lastScrollPos = 0;
1018function scroll() {
1019	var currentScrollPos = $(window).scrollTop();
1020	var scrollDirection = 'down';
1021	if(currentScrollPos < lastScrollPos) {
1022		scrollDirection = 'up';
1023	}
1024
1025	if(breakpoint === 'tablet' || breakpoint === 'smartphone') {
1026		if(currentScrollPos < $('#headertop').height() + $('#headercontent').outerHeight()) {
1027			$('#headercontent').css('top', $('#headertop').height() - currentScrollPos);
1028			$('#headermenu').css('top', $('#headertop').height() - currentScrollPos + $('#headercontent').outerHeight());
1029			$('#headercontent, #headermenu').removeClass('fixed').addClass('removeanimation');
1030		}
1031		else {
1032			$('#headercontent, #headermenu').css('top', '');
1033			if(scrollDirection === 'up' && currentScrollPos > $(window).height() / 2) {
1034				$('#headercontent, #headermenu').addClass('fixed').removeClass('removeanimation');
1035			} else if(scrollDirection === 'down') {
1036				$('#headercontent, #headermenu').removeClass('fixed').removeClass('removeanimation');
1037			} else {
1038				$('#headercontent, #headermenu').removeClass('fixed');//.addClass('removeanimation');
1039			}
1040		}
1041	} else {
1042		$('#headercontent, #headermenu').css('top', '');
1043	}
1044
1045	/*if(scrollDirection === 'up' && currentScrollPos > $('#headertop').height()) {
1046		$('body').addClass('menufixed');
1047	} else {
1048		$('body').removeClass('menufixed');
1049	}*/
1050
1051
1052
1053	lastScrollPos = currentScrollPos;
1054}
1055// use passive for better performance
1056document.addEventListener('scroll', scroll, passiveSupport() ? {passive: true} : false);
1057
1058
1059// Funktion die beim resizen des Fensters ausgeführt wird
1060function resize(fullresize) {
1061	if(fullresize) {
1062		// Breakpoint und Breite der Seite ermitteln
1063		detect_breakpoint();
1064
1065		/*if (closedmenu[breakpoint] == true)
1066		{
1067			$('body').addClass('closedmenu');
1068		}
1069		else
1070		{
1071			$('body').removeClass('closedmenu');
1072			$('#mainmenu > nav > ul > li ul').attr('style', '');
1073			$('#mainmenu > nav > ul > li').attr('status', 'closed');
1074		}*/
1075
1076		// Anpassung Lightbox
1077		$('.fancybox-content').each(function() {
1078			var ratio = $(this).attr('data-ratio');
1079			if(typeof ratio == 'undefined') {
1080				return;
1081			}
1082
1083			ratio = ratio.split('x');
1084			var padding = ratio[1] * 100 / ratio[0];
1085			padding = parseInt($('.fancybox-content').width()) / 100 * padding;
1086			$('.fancybox-content').css('padding-bottom', padding);
1087		});
1088
1089		if(breakpoint === 'smartphone') {
1090			$('.info-tooltip').attr('data-placement', 'bottom');
1091		} else {
1092			$('.info-tooltip').attr('data-placement', 'top');
1093		}
1094
1095		scroll();
1096	}
1097
1098
1099	// adapt menu height
1100	menuHeight();
1101
1102
1103	// Debugging-Informationen aktualisieren
1104	if (document.location.href.indexOf('debug') != -1)
1105	{
1106		$('#pagesize').html(window.innerWidth+'x'+$(window).height()+'px<br />'+breakpoint);
1107	}
1108}
1109var window_width = 0;
1110$(window).resize(function() {
1111
1112	// Breite wurde verändert
1113	if (window_width != window.innerWidth) {
1114		window_width = window.innerWidth;
1115		resize(true);
1116	}
1117	else { // Nur Höhe wurde verändert
1118		resize(false);
1119	}
1120});
1121
1122
1123// Custom dropdown
1124var Dropdown = {
1125	init: function() {
1126		$('.dropdown').each(function() {
1127			var dropdown = this;
1128			var input = $(dropdown).attr('data-input');
1129
1130			$(this).on('show.bs.dropdown', function () {
1131				Dropdown.openCallback(this);
1132			});
1133			$(this).on('hide.bs.dropdown', function () {
1134				Dropdown.closeCallback(this);
1135			});
1136
1137			// click event
1138			$(this).find('.dropdown-menu a').click(function(event) {
1139				// save dropdown value
1140				if($(this).hasClass('save') === true) {
1141					Dropdown.save(dropdown);
1142				}
1143				// reset dropdown
1144				else if($(this).hasClass('reset') === true) {
1145					Dropdown.reset(dropdown);
1146				}
1147				// simple a click
1148				else {
1149					Dropdown.preselectValue(dropdown, $(this).attr('data-value'));
1150					Dropdown.save(dropdown);
1151				}
1152
1153				if (!$(this).closest('.topnav').length) {
1154					event.preventDefault();
1155					return false;
1156				}
1157			});
1158
1159			// reset when click on x
1160			$(this).find('> button .reset').click(function(event) {
1161				if($(this).closest('.dropdown').hasClass('active') === true) {
1162					Dropdown.reset($(this).closest('.dropdown'), true);
1163
1164					event.preventDefault();
1165					return false;
1166				}
1167			});
1168
1169			// detect changes on input
1170			$(this).closest('form').find('input[name="'+input+'"]').change(function() {
1171				var inputName = $(this).attr('name');
1172				if($(this).val() !== '') {
1173					Dropdown.setActive($('.dropdown[data-input="'+inputName+'"]'), $(this).val());
1174				} else {
1175					Dropdown.setNotActive($('.dropdown[data-input="'+inputName+'"]'));
1176				}
1177			});
1178			$(this).closest('form').find('input[name="'+input+'"]').trigger('change');
1179		});
1180
1181	},
1182
1183	openCallback: function(elem) {
1184	},
1185
1186	close: function(elem) {
1187		if(typeof restore === 'undefined') {
1188			restore = true;
1189		}
1190
1191		if($(elem).hasClass('open') === true) {
1192			$(elem).removeClass('open');
1193			$(elem).find('.dropdown-backdrop').remove();
1194		}
1195
1196		Dropdown.closeCallback(elem);
1197	},
1198
1199	closeCallback: function(elem) {
1200		$(elem).removeClass('saveable');
1201
1202		var input = $(elem).attr('data-input');
1203		var inputValue = $(elem).closest('form').find(input).val();
1204
1205		if($(elem).attr('data-value') !== inputValue) {
1206			// $(elem).closest('form').find('input[name="'+input+'"]').trigger('change');
1207		}
1208	},
1209
1210	reset: function(elem, clearInput) {
1211		if(typeof clearInput === 'undefined') {
1212			clearInput = false;
1213		}
1214
1215		$(elem).each(function() {
1216			$(this).attr('data-value', '').removeClass('active');
1217			Dropdown.setText(this, '');
1218
1219			if($(this).hasClass('open') === true) {
1220				$(this).addClass('saveable');
1221			}
1222
1223			if(clearInput === true) {
1224				var input = $(this).attr('data-input');
1225				$(this).closest('form').find('input[name="'+input+'"]').val('').trigger('change');
1226			}
1227		});
1228	},
1229
1230	save: function(elem) {
1231		var input = $(elem).attr('data-input');
1232		var value = $(elem).attr('data-value');
1233
1234		if(typeof value !== 'undefined') { //  && value !== ''
1235			$('input[name="'+input+'"]').val(value).trigger('change');
1236			$(elem).attr('data-value', '');
1237			Dropdown.close(elem);
1238		}
1239	},
1240
1241	setText: function(elem, text) {
1242		$(elem).find('> button span.selected').html(text);
1243	},
1244
1245	preselectValue: function(elem, value) {
1246		$(elem).attr('data-value', value);
1247		$(elem).addClass('saveable');
1248	},
1249
1250	setActive: function(elem, value) {
1251		var selectedValue = $(elem).find('.dropdown-menu li a[data-value="'+value+'"]');
1252		var selectedLabel = $(selectedValue).text();
1253		if(typeof $(selectedValue).attr('data-label') !== 'undefined') {
1254			selectedLabel = $(selectedValue).attr('data-label');
1255		}
1256
1257		Dropdown.setStatus(elem, true);
1258		Dropdown.setText(elem, selectedLabel);
1259	},
1260
1261	setNotActive: function(elem) {
1262		Dropdown.setStatus(elem, false);
1263		Dropdown.setText(elem, '');
1264	},
1265
1266	setStatus: function(elem, active) {
1267		if(active === true) {
1268			$(elem).addClass('active');
1269		} else {
1270			$(elem).removeClass('active');
1271		}
1272	},
1273
1274	resize: function() {
1275	}
1276};
1277
1278
1279// datepicker init
1280var datepicker = {};
1281function build_datepicker(selector, box) {
1282	$(selector, box).each(function(k, v) {
1283		var input = $(v).get(0);
1284		if(input === null) {
1285			return;
1286		}
1287
1288		var settings = {
1289			format: 'YYYY-MM-DD',
1290			selectForward: true,
1291			moveBothMonths: true,
1292			autoClose: true,
1293			closeOnClick: false,
1294			animationSpeed: '0',
1295			hoveringTooltip: function() {}, // Datepicker Tooltip überschreiben
1296			nextText: '<span class="icon-more"></span>',
1297			prevText: '<span class="icon-more-reverse"></span>',
1298
1299			/*noCheckInDates: [
1300				'2019-05-26',
1301				'2019-06-02'
1302			],
1303			noCheckOutDates: [
1304				'2019-05-29',
1305				'2019-06-07'
1306			],*/
1307			tooltips: [
1308				{
1309					from: '2019-10-01',
1310					to: '2019-10-13',
1311					color: 'green',
1312					text: 'test...', // strings.bestarrivalday[la]
1313				},
1314				{
1315					dayOfWeek: 0, // 0=Sunday, 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday
1316					color: '#ef114c',
1317					text: 'test2',
1318				},
1319			],
1320
1321			startOfWeek: 'monday',
1322			onSelectRange: function() {
1323				var dateRange = this.getValue();
1324				if(dateRange.indexOf(' - ') !== -1) {
1325					dateRange = dateRange.split(' - ');
1326					$('input[name="enable-stay"]').val('1');
1327					$('input[name="stay[from]"]').val(dateRange[0]);
1328					$('input[name="stay[until]"]').val(dateRange[1]);
1329
1330					var startDate = fecha.format(Date.parse(dateRange[0]), 'DD. MMM');
1331					var endDate = fecha.format(Date.parse(dateRange[1]), 'DD. MMM');
1332
1333					var startDateYear = fecha.format(Date.parse(dateRange[0]), 'YYYY');
1334					var endDateYear = fecha.format(Date.parse(dateRange[1]), 'YYYY');
1335					if(fecha.format(new Date(), 'YYYY') !== endDateYear) {
1336						endDate += ' ' + endDateYear;
1337						startDate += ' ' + startDateYear;
1338					}
1339
1340					Dropdown.setAutoSearch($(input).parents('.customdropdown'), true);
1341					Dropdown.setText($(input).closest('.customdropdown'), startDate + ' - ' + endDate);
1342
1343					$(selector).parents('.datepickerwrapper').parent().find('.datepickererror').slideUp(function() {
1344						$(this).remove();
1345					});
1346				}
1347			},
1348			onMonthChange: function() {
1349				// Performance issue (and not needed):
1350				// $('.datepicker .datepicker__month-day').tooltip('destroy');
1351
1352				$('.datepicker .datepicker__month-day[title]').tooltip({
1353					// container: '.datepicker',
1354					container: 'body',
1355					placement: 'top',
1356					// trigger: 'click' // only for testing
1357				});
1358			}
1359		};
1360
1361
1362		// create info under calendar
1363		/*if(settings.tooltips !== false && typeof settings.tooltips === 'object') {
1364			if($(input).parents('.datepickerwrapper').next().hasClass('tooltipdescriptions') === false) {
1365				var tooltipdescriptions = '';
1366				$.each(settings.tooltips, function(index, tooltip) {
1367					var color = '';
1368					if(typeof tooltip.color !== 'undefined') {
1369						color = 'style="background-color: '+tooltip.color+';"';
1370					}
1371
1372					var range = '';
1373					if(typeof tooltip.from !== 'undefined' && typeof tooltip.to !== 'undefined') {
1374						var from = fecha.parse(tooltip.from, 'YYYY-MM-DD');
1375						var to = fecha.parse(tooltip.to, 'YYYY-MM-DD');
1376						range = ' ('+fecha.format(from, 'DD.MM.YYYY')+' - '+fecha.format(to, 'DD.MM.YYYY')+')';
1377					}
1378
1379					tooltipdescriptions += '<div class="tooltipdescription"><span class="tooltipcolor" '+color+'></span>'+tooltip.text+range+'</div>';
1380				});
1381				$('<div class="tooltipdescriptions">
1381'+tooltipdescriptions+'</div>').insertAfter($(input).parents('.datepickerwrapper'));
1382			}
1383		}*/
1384
1385
1386		// Sprachen
1387		if(la === 'de') {
1388			settings.i18n = {
1389				selected: 'Dein Aufenthalt:',
1390				night: 'Nacht',
1391				nights: 'Nächte',
1392				button: 'Schließen',
1393				'checkin-disabled': 'Check-in nicht möglich',
1394				'checkout-disabled': 'Check-out nicht möglich',
1395				// 'day-names-short': ['Son', 'Mon', 'Die', 'Mit', 'Don', 'Fre', 'Sam'],
1396				'day-names-short': ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
1397				'day-names': ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
1398				'month-names-short': ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
1399				'month-names': ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
1400				'error-less': 'Sie müssen mindestens eine Übernachtung auswählen',
1401				'error-less-plural': 'Sie müssen mindestens %d Übernachtungen auswählen',
1402				'info-default': 'Bitte die Nächtigungen auswählen'
1403			};
1404		} else if(la === 'it') {
1405			settings.i18n = {
1406				selected: 'Il tuo soggiorno:',
1407				night: 'Notte',
1408				nights: 'Notti',
1409				button: 'Chiudi',
1410				'checkin-disabled': 'Check-in disabilitato',
1411				'checkout-disabled': 'Check-out disabilitato',
1412				// 'day-names-short': ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'],
1413				'day-names-short': ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
1414				'day-names': ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
1415				'month-names-short': ['Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'],
1416				'month-names': ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
1417				'error-more': 'L\'intervallo di date non deve avere più di 1 notte',
1418				'error-more-plural': 'L\'intervallo di date non deve avere più di %d notti',
1419				'error-less': 'L\'intervallo di date non deve avere meno di 1 notte',
1420				'error-less-plural': 'L\'intervallo di date non deve avere meno di %d notti',
1421				'info-more': 'Per favore seleziona un intervallo di date maggiore di 1 notte',
1422				'info-more-plural': 'Per favore seleziona un intervallo di date maggiore di %d notti',
1423				'info-range': 'Per favore seleziona un intervallo di date tra %d e %d notti',
1424				'info-default': 'Per favore seleziona un intervallo di date'
1425			};
1426		} else if(la === 'en') {
1427			settings.i18n = {
1428				// 'day-names-short': ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1429				'day-names-short': ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1430			}
1431		}
1432
1433		var tmpDatepicker = new HotelDatepicker(input, settings);
1434		// tmpDatepicker.open();
1435		var id = tmpDatepicker.getDatepickerId();
1436		datepicker[id] = tmpDatepicker;
1437	});
1438}
1439
1440
1441// Funktion zum ermitteln des Breakpoints
1442function detect_breakpoint() {
1443	if ($('body > span.visible-lg').css('display') != 'none') {
1444		breakpoint = 'widescreen';
1445	}
1446	else if ($('body > span.visible-md').css('display') != 'none') {
1447		breakpoint = 'desktop';
1448	}
1449	else if ($('body > span.visible-sm').css('display') != 'none') {
1450		breakpoint = 'tablet';
1451	}
1452	else if ($('body > span.visible-xs').css('display') != 'none') {
1453		breakpoint = 'smartphone';
1454	}
1455
1456	// Klasse dem Body hinzufügen
1457	if (!$('body').hasClass(breakpoint)) {
1458		$('body').removeClass('smartphone tablet desktop widescreen').addClass(breakpoint);
1459	}
1460}
1461
1462
1463function urldecode(val) {
1464	val = val.replace(/\+/g, '%20');
1465	var str = val.split("%");
1466	var cval = str[0];
1467	for (var i = 1; i < str.length; i += 1)
1468	{
1469		cval += String.fromCharCode(parseInt(str[i].substring(0, 2), 16)) + str[i].substring(2);
1470	}
1471	return cval;
1472}
1473
1474// Test via a getter in the options object to see if the passive property is accessed
1475function passiveSupport() {
1476	var supportsPassive = false;
1477	try {
1478		var opts = Object.defineProperty({}, 'passive', {
1479			get: function() {
1480				supportsPassive = true;
1481			}
1482		});
1483		window.addEventListener("testPassive", null, opts);
1484		window.removeEventListener("testPassive", null, opts);
1485	} catch (e) {}
1486
1487	return supportsPassive;
1488}
1489
1490
1491function startZoom(elem) {
1492	// start zoom
1493	var width = $(elem).find('img').width();
1494	var height = $(elem).find('img').height();
1495	var containerWidth = $(elem).width();
1496	var containerHeight = $(elem).height();
1497	var widthPercent = width * 100 / containerWidth;
1498	var heightPercent = height * 100 / containerHeight;
1499	$(elem).find('img').attr('data-width', width).attr('data-height', height);
1500
1501	var scale = widthPercent / 100;
1502	/*if(widthPercent < heightPercent) {
1503		scale = heightPercent / 100;
1504	} else {
1505		scale = widthPercent / 100;
1506	}*/
1507	$(elem).find('img').attr('data-scale', scale); // .css('transform', 'scale('+scale+')')
1508
1509	$(elem).addClass('zoom');
1510
1511	// trigger event
1512	/*var event = $.Event('mousemove');
1513	// coordinates
1514	event.pageX = 100;
1515	event.pageY = 100;
1516
1517// trigger event
1518	$(document).trigger(event);*/
1519	$(elem).trigger('mousemove');
1520}
1521
1522
1523function endZoom(elem) {
1524	$(elem).removeClass('zoom loading').find('img').removeAttr('style').removeAttr('data-width').removeAttr('data-height').removeAttr('data-scale');
1525}
1526
1527
1528function moveZoom(elem, x, y) {
1529	if($(elem).hasClass('zoom') === false) {
1530		return;
1531	}
1532	$(elem).removeClass('loading');
1533
1534	var img = $(elem).find('> img');
1535	// var scale = $(img).attr('data-scale');
1536
1537	if(x > 0) {
1538		x = x * -1;
1539	}
1540	if(y > 0) {
1541		y = y * -1;
1542	}
1543
1544	if($(elem).width() > $(elem).find('> img').width()) {
1545		x = ($(elem).width() - $(elem).find('> img').width()) / 2;
1546	}
1547	if($(elem).height() > $(elem).find('> img').height()) {
1548		y = ($(elem).height() - $(elem).find('> img').height()) / 2;
1549	}
1550
1551	$(img).css('transform', 'translate('+x+'px, '+y+'px)'); // scale('+scale+')
1552}
1553
1554
1555function menuHeight() {
1556	if(breakpoint === 'widescreen' || breakpoint === 'desktop') {
1557		$('.menuhorizontal > nav > ul > li > ul').css('height', 'auto');
1558	} else {
1559		if($('#headermenu').length === 0) {me
1560			return;
1561		}
1562		/*var offset = $('#headercontent').outerHeight();
1563		if($('body').hasClass('menufixed') === false) {
1564			offset += $('#headertop').height();
1565		}*/
1566		var height = $(window).height() - $('#headermenu').position().top;
1567		if(height < 400 && breakpoint !== 'smartphone') {
1568			height = 400;
1569		}
1570		$('.menuhorizontal > nav > ul > li > ul').css('height', height);
1571	}
1572}
1573
1574
1575// lazyload images
1576function loadImage(imgDom, src, callback) {
1577	// var img = document.getElementById('id1');
1578
1579	var newImg = new Image;
1580	newImg.onload = function() {
1581		imgDom.src = this.src;
1582
1583		if(typeof callback === 'function') {
1584			callback(imgDom);
1585		}
1586	};
1587	newImg.src = src;
1588}
1589
1590
1591// create slider for smartphone
1592function createProductSlider() {
1593	destroyProductSlider();
1594
1595	$('.productfoto').append('<div class="productslider-xs hidden-lg hidden-md hidden-sm"><div class="swiper-container"><div class="swiper-wrapper"></div><div class="swiper-pagination"></div></div></div>');
1596	$('.productfoto .fotopreview .foto').each(function() {
1597		var image = '';
1598		var imageZoom = 'href="javascript:;"';
1599		if(typeof $(this).attr('data-image-big') !== 'undefined') {
1600			image = $(this).attr('data-image-big');
1601		}
1602		else if(typeof $(this).attr('data-image') !== 'undefined') {
1603			image = $(this).attr('data-image');
1604		}
1605		else {
1606			return;
1607		}
1608		if(typeof $(this).attr('data-image-zoom') !== 'undefined') {
1609			imageZoom = 'href="'+ $(this).attr('data-image-zoom')+'" data-fancybox="detailzoom"';
1610		}
1611
1612		$('.productfoto .productslider-xs .swiper-wrapper').append('<div class="swiper-slide"><div class="foto"><a '+imageZoom+'><img class="b-lazy" src="data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 252 177\' width=\'252\' height=\'177\'></svg>" data-src="'+image+'" alt="" width="252" height="177" /></a></div></div>');
1613	});
1614	$('.productfoto .fotobig .a360').clone().insertAfter($('.productfoto .productslider-xs .swiper-container'));
1615
1616
1617	// Slider detailseite
1618	$('.productslider-xs').each(function() {
1619		var detailpageslider = new Swiper($(this).find('.swiper-container'), {
1620			effect: 'slide', // 'slide' | 'fade' | 'cube' | 'coverflow' | 'flip'
1621			loop: false,
1622			keyboard: false,
1623			slidesPerView: 1,
1624			speed: 1000,
1625			/*autoplay: {
1626				delay: 4000,
1627			},*/
1628			pagination: {
1629				el: $(this).find('.swiper-pagination'),
1630				type: 'fraction',
1631				renderFraction: function (currentClass, totalClass) {
1632					return '<span class="icon-pager"></span><span class="' + currentClass + '"></span>' +
1633						'/' +
1634						'<span class="' + totalClass + '"></span>';
1635				}
1636			},
1637			breakpoints: {
1638				1280: { // Desktop
1639				},
1640
1641				960: { // Tablet
1642				},
1643
1644				640: { // Smartphone
1645				},
1646			},
1647			// Events
1648			on: {
1649				init: function () {
1650				},
1651				slideChange: function() {
1652					// lazyload is enabled
1653					if(typeof(bLazy) != 'undefined') {
1654						bLazy.revalidate();
1655					}
1656				}
1657			}
1658		});
1659	});
1660}
1661
1662function destroyProductSlider() {
1663	$('.productfoto .productslider-xs').remove();
1664}
1665
1666
1667function validateAddToCartForm(form) {
1668	var required = [];
1669	var result = true;
1670
1671	$(form).find('input[type="radio"]').each(function() {
1672		if(required.indexOf($(this).attr('name')) === -1) {
1673			required[required.length] = $(this).attr('name');
1674		}
1675	});
1676
1677	$.each(required, function(k, v) {
1678		if($('input[name="'+v+'"]').length === 0 || $('input[name="'+v+'"]:checked').length === 0) {
1679			result = false;
1680			return false;
1681		}
1682	});
1683
1684	return result;
1685}
1686
1687
1688var productData = null;
1689function getProductData() {
1690	if(typeof data === 'undefined') {
1691		return false;
1692	}
1693
1694	try {
1695		productData = JSON.parse(data);
1696	} catch (e) {
1697		console.log(e);
1698	}
1699}
1700
1701function getProductImage() {
1702	if(productData === null) {
1703		return;
1704	}
1705
1706	var ausfuehrung = $('form.addtocart input[name="ausfuehrung"]:checked').val();
1707
1708	if(typeof productData.images === 'undefined' || typeof productData.images[ausfuehrung] === 'undefined' || productData.images[ausfuehrung] === '-') {
1709		return false;
1710	} else {
1711		return productData.images[ausfuehrung];
1712	}
1713}
1714
1715function updateProductImage() {
1716	var images = getProductImage();
1717
1718	// no image
1719	if(images === false) {
1720		// todo: evtl. auf lasiert ändern?
1721		$('.articledetailview .fotobig').addClass('noimage');
1722		if($('.articledetailview .fotobig .noimagelabel').length === 0) {
1723			$('.articledetailview .fotobig').append('<span class="noimagelabel">'+strings.noimage[la]+'</span>');
1724		}
1725
1726		return;
1727	}
1728
1729
1730	if(typeof images === 'string') {
1731		images = [images];
1732	}
1733
1734	// reset images
1735	$('.articledetailview .fotobig').removeClass('noimage zoom').find('.noimagelabel').remove();
1736	$('.articledetailview .fotopreview .foto').each(function() {
1737		$(this).css('display', 'none');
1738		$(this).removeAttr('data-image data-image-big data-image-zoom');
1739	});
1740
1741	// set new images
1742	$.each(images, function(k, image) {
1743		var elem = $('.articledetailview .fotopreview .foto').get(k);
1744
1745		if(location.protocol === 'file:') {
1746			image = 'https://www.demetz-patrick.com' + image;
1747		}
1748
1749		// todo: loop + image small
1750		$(elem).html('<img class="b-lazy" src="data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 100 100\' width=\'100\' height=\'100\'></svg>" data-src="'+image+'" width="100" height="100" alt="" />');
1751
1752		// todo: small image
1753		$(elem).attr('data-image', image).attr('data-image-big', image).attr('data-image-zoom', image);
1754
1755		if(images.length > 1) {
1756			$(elem).removeAttr('style');
1757		}
1758	});
1759
1760	// hide right bar
1761	if(images.length <= 1) {
1762		$('.articledetailview .fotopreview').hide();
1763	} else {
1764		$('.articledetailview .fotopreview').removeAttr('style');
1765	}
1766
1767	$('.articledetailview .fotopreview .foto').first().trigger('mouseenter');
1768	bLazy.revalidate();
1769
1770	// update productfoto on smartphone
1771	createProductSlider();
1772}
1773
1774function getProductPrice(ausfuehrung, groese) {
1775	if(productData === null) {
1776		return false;
1777	}
1778
1779	if(typeof ausfuehrung === 'undefined') {
1780		ausfuehrung = $('form.addtocart input[name="ausfuehrung"]:checked').val();
1781	}
1782	if(typeof groese === 'undefined') {
1783		groese = $('form.addtocart input[name="groese"]:checked').val();
1784	}
1785
1786	if(typeof productData.prices === 'undefined' || typeof productData.prices[groese] === 'undefined' || typeof productData.prices[groese][ausfuehrung] === 'undefined') {
1787		return false;
1788	} else if(productData.prices[groese][ausfuehrung] == '0') {
1789		return false;
1790	} else {
1791		return productData.prices[groese][ausfuehrung];
1792	}
1793}
1794
1795// not used...
1796/*function checkProductData() {
1797	if(productData === null) {
1798		return;
1799	}
1800}*/
1801
1802
1803function addToCart(form) {
1804	var pid = $('input[name="pid"]', form).val();
1805	var aid1 = $('input[name="groese"]:checked', form).val();
1806	var aid2 = $('input[name="ausfuehrung"]:checked', form).val();
1807
1808	var url = 'https://www.demetz-patrick.com/cart2.php?pid='+pid+'&aid1='+aid1+'&aid2='+aid2+'&quant=1&lang='+la+'&compact=1';
1809	var jqxhr = $.get(url, function(data) {
1810		if(data == '1') {
1811			addToCartShowModal();
1812		} else if(data == '-1') {
1813			alert(strings.productalreadyexists[la]);
1814		}
1815	}).fail(function() {
1816		alert('error');
1817	});
1818
1819	// addToCartShowModal();
1820}
1821
1822function addToCartShowModal() {
1823	$('#modaladdtocart .foto').html($('.fotopreview .foto').first().html());
1824	$('#modaladdtocart').modal('show');
1825	$('#modaladdtocart').on('shown.bs.modal', function() {
1826		bLazy.revalidate();
1827	});
1828	updateCartCounter();
1829}
1830
1831
1832function updateCartCounter() {
1833	// /cart/shopcartwidget2.php?lang=de
1834	$.get('/cart/shopcartwidget2.php?lang='+la, function(data) {
1835		$('.cartbutton').find('> *:not(.icon-cart)').remove();
1836		$('.cartbutton').append(data);
1837	});
1838}
1839
1840
1841function gup(name, url) {
1842	if(!url) url = location.href;
1843	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
1844	var regexS = "[\\?&]"+name+"=([^&#]*)";
1845	var regex = new RegExp( regexS );
1846	var results = regex.exec( url );
1847	return results == null ? null : results[1];
1848}
1849
1850
1851function detectIE() {
1852	var ua = window.navigator.userAgent;
1853	var result = false;
1854	var msie = ua.indexOf('MSIE ');
1855	if (msie > 0) {
1856		// IE 10 or older => return version number
1857		result = true;
1858	}
1859
1860	var trident = ua.indexOf('Trident/');
1861	if (trident > 0) {
1862		// IE 11 => return version number
1863		var rv = ua.indexOf('rv:');
1864		result = true;
1865	}
1866
1867	return result;
1868}
1869
1870
1871function showTakeOverModal() {
1872	if(getCookie('popupshow') === '1') {
1873		return;
1874	}
1875
1876	let modal = $('#takeovermodal');
1877	modal.on('hide.bs.modal', function (e) {
1878		setCookie('popupshow', '1', 7);
1879	});
1880	modal.modal('show');
1881}
1882
1883
1884function setCookie(name,value,days) {
1885	var expires = "";
1886	if (days) {
1887		var date = new Date();
1888		date.setTime(date.getTime() + (days*24*60*60*1000));
1889		expires = "; expires=" + date.toUTCString();
1890	}
1891	document.cookie = name + "=" + (value || "")  + expires + "; path=/";
1892}
1893
1894
1895function getCookie(name) {
1896	var nameEQ = name + "=";
1897	var ca = document.cookie.split(';');
1898	for(var i=0;i < ca.length;i++) {
1899		var c = ca[i];
1900		while (c.charAt(0)==' ') c = c.substring(1,c.length);
1901		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
1902	}
1903	return null;
1904}
1905
1906
1907function eraseCookie(name) {
1908	document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
1909}
1910
1911
1912
1913init();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.