PageSourceSearch

https://www.thehoteljune.com/malibu/wp-content/themes/thehoteljune/assets/js/common.js

js thehoteljune.com collected 2026-09-25 14:26:45 UTC 154,831 bytes, 5,572 lines download raw bytes

1function picture($src, $orientation, $max_size, $cropped, $lazy_load, $class) {
2	
3	function get_max_size_index() {
4		var index = false;
5		for (var i=0; i<$sizes.length; i++) {
6			if ($sizes[i].size == $max_size) index = i;
7		}
8		return index;
9	}
10
11	var $orientations = {
12		// 'portrait': 'portrait',
13		'landscape': 'landscape',
14		// 'square': 'square'
15	};
16
17	var $sizes = [
18		{size: 'xs', width: 320, height: 180},
19		// {size: 'small', width: 640, height: 360},
20		// {size: 'medium', width: 1024, height: 576},
21		{size: 'large', width: 1280, height: 720},
22		// {size: 'xl', width: 1366, height: 768},
23		{size: 'xxl', width: 1440, height: 900},
24		{size: 'xxxl', width: 1920, height: 1080},
25	];
26
27	if ( typeof $max_size === 'undefined' ) var $max_size = 'xxxl';
28	if ( typeof $cropped === 'undefined' ) var $cropped = false;
29	if ( typeof $lazy_load === 'undefined' ) var $lazy_load = false;
30	if ( typeof $class === 'undefined' ) var $class = '';
31
32	var $srcset = '';
33
34	var $new_sizes_index = get_max_size_index();
35	var $new_sizes = ($new_sizes_index !== false) ? $sizes.slice(0, $new_sizes_index+1) : $sizes.slice(0, 7);
36
37	for (var i=0; i<$new_sizes.length; i++) {
38
39		var $size = $new_sizes[i];
40		var $image;
41
42		// get the correct $src for the given image size
43		// do failsafe if $src is returning false
44		if (
45			$size['size'] == 'xs' ||
46			$size['size'] == 'small'
47		) {
48
49			$image = $src['mobile'];
50			if (!$image) $image = $src['tablet'];
51			if (!$image) $image = $src['desktop'];
52
53		} else if (
54			$size['size'] == 'medium' ||
55			$size['size'] == 'large'
56		) {
57
58			$image = $src['tablet'];
59			if (!$image) $image = $src['desktop'];
60
61		} else {
62
63			$image = $src['desktop'];
64
65		}
66
67		if ($orientation === 'portrait') {
68			if ($cropped) {
69				if ($size['size'] === $max_size) {
70					$srcset += '<source media="(max-width: ' + $size['width'] + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] + '">';
71					$srcset += '<source media="(min-width: ' + ($size['width']+1) + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] + '">';
72				} else {
73					$srcset += '<source media="(max-width: ' + $size['width'] + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] + '">';
74				}
75			} else {
76				if ($size['size'] === $max_size) {
77					$srcset += '<source media="(max-width: ' + $size['width'] + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size']] + '">';
78					$srcset += '<source media="(min-width: ' + ($size['width']+1) + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size']] + '">';
79				} else {
80					$srcset += '<source media="(max-width: ' + $size['width'] + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size']] + '">';
81				}
82			}
83		} else {
84			if ($cropped) {
85				if ($size['size'] === $max_size) {
86					$srcset += '<source media="(max-width: ' + $size['width'] + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] + '">';
87					$srcset += '<source media="(min-width: ' + ($size['width']+1) + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] + '">';
88				} else {
89					$srcset += '<source media="(max-width: ' + $size['width'] + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] + '">';
90				}
91			} else {
92				if ($size['size'] === $max_size) {
93					$srcset += '<source media="(max-width: ' + $size['width'] + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size']] + '">';
94					$srcset += '<source media="(min-width: ' + ($size['width']+1) + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size']] + '">';
95				} else {
96					$srcset += '<source media="(max-width: ' + $size['width'] + 'px)" srcset="' + $image['sizes'][$orientations[$orientation] + '-' + $size['size']] + '">';
97				}
98			}
99		}
100	}
101
102	if ($class)
103		$class = 'class="' + $class + '"';
104	else
105		$class = '';
106
107	var $data = [];
108	$data.push('data-iesrc="' + $image['sizes'][$orientations[$orientation] + '-' + 'large'] + '"');
109	$data.push('data-src="' + $image['sizes'][$orientations[$orientation] + '-' + 'large'] + '"');
110	$data.push('data-alt="' + $image['alt'] + '"');
111
112	return '' +
113		'<picture class="' + (($lazy_load) ? 'lozad': '') + '" ' + (($lazy_load) ? 'style="display: block; min-height: 1rem"': '') + ' ' + $data.join(' ') + '>' +
114		$srcset + (($lazy_load) ? '' : '<img src="' + $image['sizes'][$orientations[$orientation] + '-' + 'xs'] + '" alt="' + $image['alt'] + '" ' + $class + ' />') +
115		'</picture>';
116}
117
118function responsive_background_image($src, $orientation, $target_class, $max_size, $cropped, $lazy_load) {
119	
120	function get_max_size_index() {
121		var index = false;
122		for (var i=0; i<$sizes.length; i++) {
123			if ($sizes[i].size == $max_size) index = i;
124		}
125		return index;
126	}
127
128	var $orientations = {
129		// 'portrait': 'portrait',
130		'landscape': 'landscape',
131		// 'square': 'square'
132	};
133
134	var $sizes = [
135		{size: 'xs', width: 320, height: 180},
136		// {size: 'small', width: 640, height: 360},
137		// {size: 'medium', width: 1024, height: 576},
138		{size: 'large', width: 1280, height: 720},
139		// {size: 'xl', width: 1366, height: 768},
140		{size: 'xxl', width: 1440, height: 900},
141		{size: 'xxxl', width: 1920, height: 1080},
142	];
143
144	if ( typeof $max_size === 'undefined' ) var $max_size = 'xxxl';
145	if ( typeof $cropped === 'undefined' ) var $cropped = false;
146	if ( typeof $lazy_load === 'undefined' ) var $lazy_load = false;
147	if ( typeof $class === 'undefined' ) var $class = '';
148
149	$srcset = '';
150
151	var $new_sizes_index = get_max_size_index();
152	var $new_sizes = ($new_sizes_index !== false) ? $sizes.slice(0, $new_sizes_index+1) : $sizes.slice(0, 7);
153
154	for (var i=0; i<$new_sizes.length; i++) {
155
156		var $size = $new_sizes[i];
157		var $image;
158
159		// get the correct $src for the given image size
160		// do failsafe if $src is returning false
161		if (
162			$size['size'] == 'xs' ||
163			$size['size'] == 'small'
164		) {
165
166			$image = $src['mobile'];
167			if (!$image) $image = $src['tablet'];
168			if (!$image) $image = $src['desktop'];
169
170		} else if (
171			$size['size'] == 'medium' ||
172			$size['size'] == 'large'
173		) {
174
175			$image = $src['tablet'];
176			if (!$image) $image = $src['desktop'];
177
178		} else {
179
180			$image = $src['desktop'];
181
182		}
183
184		if($orientation === 'portrait') {
185			if($cropped) {
186				if($size['size'] === $max_size) {
187					$srcset += '@media only screen and (max-width: '+ $size['width'] +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] +'\'); } }';
188					$srcset += '@media only screen and (min-width: '+ ($size['width']+1) +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] +'\'); } }';
189				} else {
190					$srcset += '@media only screen and (max-width: '+ $size['width'] +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] +'\'); } }';
191				}
192			} else {
193				if($size['size'] === $max_size) {
194					$srcset += '@media only screen and (max-width: '+ $size['width'] +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size']] +'\'); } }';
195					$srcset += '@media only screen and (min-width: '+ ($size['width']+1) +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size']] +'\'); } }';
196				} else {
197					$srcset += '@media only screen and (max-width: '+ $size['width'] +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size']] +'\'); } }';
198				}
199			}
200		} else {
201			if($cropped) {
202				if($size['size'] === $max_size) {
203					$srcset += '@media only screen and (max-width: '+ $size['width'] +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] +'\'); } }';
204					$srcset += '@media only screen and (min-width: '+ ($size['width']+1) +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] +'\'); } }';
205				} else {
206					$srcset += '@media only screen and (max-width: '+ $size['width'] +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size'] + '-cropped'] +'\'); } }';
207				}
208			} else {
209				if($size['size'] === $max_size) {
210					$srcset += '@media only screen and (max-width: '+ $size['width'] +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size']] +'\'); } }';
211					$srcset += '@media only screen and (min-width: '+ ($size['width']+1) +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size']] +'\'); } }';
212				} else {
213					$srcset += '@media only screen and (max-width: '+ $size['width'] +'px) { .'+ $target_class +'{ background-image:url(\''+ $image['sizes'][$orientations[$orientation] + '-' + $size['size']] +'\'); } }';
214				}
215			}
216		}
217	}
218
219	return '<style>' + $srcset + '</style>';
220}
221
222function module_eventCol(el, json) {
223	var $ = jQuery;
224	var $window = $(window);
225
226	var OBJ = {
227		eventCol: {
228			el: $(el),
229			item: [],
230			$item: [],
231			contentArea: [],
232			contentDescExcerpt: [],
233			contentButtons: []
234		},
235		data: {
236			windowWidth: 0,
237			isDesktop: false,
238			isMobile: false,
239			isTablet: false,
240			isPhone: false,
241			lastBreakpoint: 'desktop',
242			currentBreakpoint: 'desktop',
243			updateDotdotdot: false,
244			itemGroup2: [],
245			itemGroup3: []
246		},
247		dotdotdot: []
248	};
249
250	var UPDATE = {
251		eventCol: {
252			contentArea: function() {
253				OBJ.eventCol.contentArea = OBJ.eventCol.el.find('.event-col__content-area');
254			},
255			contentDescExcerpt: function() {
256				OBJ.eventCol.contentDescExcerpt = OBJ.eventCol.el.find('.event-col__content-desc--excerpt');
257			},
258			contentButtons: function() {
259				OBJ.eventCol.contentButtons = OBJ.eventCol.el.find('.event-col__content-buttons');
260			},
261			item: function() {
262				OBJ.eventCol.item = OBJ.eventCol.el.find('.event-col__item');
263			},
264			$item: function() {
265				OBJ.eventCol.$item = [];
266				for (var i=0; i<OBJ.eventCol.item.length; i++) {
267					var $item = $(OBJ.eventCol.item[i]);
268					OBJ.eventCol.$item.push({
269						$el: $item,
270						$contentArea: $item.find('.event-col__content-area'),
271						$contentButtons: $item.find('.event-col__content-buttons')
272					});
273				}
274			}
275		},
276		data: {
277			windowWidth: function() {
278				OBJ.data.windowWidth = $window.width();
279			},
280			isDesktop: function() {
281				OBJ.data.isDesktop = (OBJ.data.windowWidth > 1024);
282			},
283			isMobile: function() {
284				OBJ.data.isMobile = (OBJ.data.windowWidth <= 1024);
285			},
286			isTablet: function() {
287				OBJ.data.isTablet = (OBJ.data.windowWidth <= 1024 && OBJ.data.windowWidth >= 768);
288			},
289			isPhone: function() {
290				OBJ.data.isPhone = (OBJ.data.windowWidth <= 767);
291			},
292			currentBreakpoint: function() {
293				if (OBJ.data.isTablet) OBJ.data.currentBreakpoint = 'tablet';
294				else if (OBJ.data.isPhone) OBJ.data.currentBreakpoint = 'phone';
295				else OBJ.data.currentBreakpoint = 'desktop';
296			},
297			lastBreakpoint: function() {
298				OBJ.data.lastBreakpoint = OBJ.data.currentBreakpoint;
299			},
300			updateDotdotdot: function() {
301				// update Dotdotdot if currentBreakpoint and lastBreakpoint are not matching
302				// prevents calling Dotdotdot function again on every resize
303				OBJ.data.updateDotdotdot = (OBJ.data.currentBreakpoint !== OBJ.data.lastBreakpoint);
304			}
305		},
306		dotdotdot: []
307	};
308
309	var months = [
310		'January',
311		'February',
312		'March',
313		'April',
314		'May',
315		'June',
316		'July',
317		'August',
318		'September',
319		'October',
320		'November',
321		'December'
322	];
323
324	function groupItemsTo(num) {
325		var filteredItems = [];
326		var itemGroup = [];
327		var indexGroup = 0;
328	
329		// loop all items (x)
330		// get filtered items first
331		for (var x=0; x<OBJ.eventCol.$item.length; x++) {
332			var $item = OBJ.eventCol.$item[x];
333
334			if (
335				$item.$el.hasClass(json.filter.month) &&
336				$item.$el.hasClass(json.filter.eventType)
337			) {
338				filteredItems.push($item);
339			}
340		}
341
342		// loop all filtered items (x)
343		// and place each item (x) in a group set (indexGroup)
344		for (var x=0; x<filteredItems.length; x++) {
345			var $item = filteredItems[x];
346	
347			// create a group in itemGroup
348			if (typeof itemGroup[indexGroup] === 'undefined') itemGroup[indexGroup] = [];
349	
350			// if: $item is a content item, add $item to group in itemGroup
351			if ($item.$el.hasClass('event-col__item--content')) {
352				itemGroup[indexGroup].push($item);
353			}
354	
355			// move to next group when x is divisible with num
356			// some groups will have at least 1 item due to some items are .event-col__item--month
357			if ((x+1) % num === 0) {
358				indexGroup++;
359			}
360		}
361		
362		return itemGroup;
363	}
364	
365	function equalizeItemHeight() {
366		function loop($items) {
367			var names = [
368				'contentArea',
369				'contentButtons'
370			];
371	
372			var maxHeights = {
373				contentArea: 0,
374				contentButtons: 0
375			};
376	
377			var heights = {
378				contentArea: 0,
379				contentButtons: 0
380			};
381	
382			// content: get max height of all items
383			for (var x=0; x<$items.length; x++) {
384				var $item = $items[x];
385	
386				for (var y=0; y<names.length; y++) {
387					var name = names[y];
388					heights[name] = $item['$'+name].height();
389					
390					if (maxHeights[name] < heights[name]) maxHeights[name] = heights[name];
391				}
392			}
393	
394			// content: use max height and apply accordingly
395			for (var x=0; x<$items.length; x++) {
396				var $item = $items[x];
397	
398				for (var y=0; y<names.length; y++) {
399					var name = names[y];
400					heights[name] = $item['$'+name].height();
401	
402					if (maxHeights[name] > heights[name]) $item['$'+name].css('height', maxHeights[name]);
403				}
404			}
405		}
406	
407		// execute
408		if (OBJ.data.isDesktop || OBJ.data.isTablet) {
409			// var itemGroup = [];
410			// if (OBJ.data.isDesktop) itemGroup = OBJ.data.itemGroup3;
411			// if (OBJ.data.isTablet) itemGroup = OBJ.data.itemGroup2;
412	
413			// for (var i=0; i<itemGroup.length; i++) {
414			// 	loop(itemGroup[i]);
415			// }
416
417			loop(OBJ.eventCol.$item);
418		}
419	}
420	
421	function equalizeItemHeight_unset() {
422		OBJ.eventCol.contentArea.css('height', '');
423		OBJ.eventCol.contentButtons.css('height', '');
424	}
425
426	function createDotdotdot() {
427		OBJ.dotdotdot = []; // force clear
428
429		for (var i=0; i<OBJ.eventCol.contentDescExcerpt.length; i++) {
430			OBJ.dotdotdot.push(new Dotdotdot(OBJ.eventCol.contentDescExcerpt[i], {
431				height: (!OBJ.data.isMobile) ? 145 : 145,
432				keep: '.read-more'
433			}))
434		}
435	}
436
437	function destroyDotdotdot() {
438		for (var i=0; i<OBJ.dotdotdot.length; i++) {
439			var item = OBJ.dotdotdot[i];
440			item.API.destroy();
441		}
442
443		OBJ.dotdotdot = []; // clear
444	}
445
446	function getRandomInt(min, max) {
447		min = Math.ceil(min);
448		max = Math.floor(max);
449		return Math.floor(Math.random() * (max - min + 1)) + min;
450	}
451
452	function month_numToName(i) {
453		return months[i-1];
454	}
455
456	function month_nameToNum(monthName) {
457    var month = months.indexOf(monthName);
458    return month ? month+1 : 0;
459	}
460
461	function template_itemMonth(year, monthNum) {
462		var monthName = month_numToName(monthNum);
463		var imgUrl = php_vars.get_stylesheet_directory_uri + '/assets/images/offer-view-blurb-' + getRandomInt(1, 3) + '.png'
464
465		var monthClassModifier = [
466			'event-col__month--img-' + ['small', 'normal'][getRandomInt(0, 1)], // imgSize
467			'event-col__month--img-' + ['top', 'mid', 'bottom'][getRandomInt(0, 2)], // imgPositionY
468			'event-col__month--img-' + ['left', 'center', 'right'][getRandomInt(0, 2)], // imgPositionX
469			'event-col__month--text-' + ['top', 'mid', 'bottom'][getRandomInt(1, 1)], // textPositionY - FORCE MID
470			'event-col__month--text-' + ['left', 'center', 'right'][getRandomInt(0, 2)] // textPositionX
471		];
472
473		return '' +
474			'<div class="event-col__item event-col__item--month cell all-month all-event-type ' + monthName.toLowerCase() + '">' +
475				'<div class="event-col__month ' + monthClassModifier.join(' ') + '">' +
476					'<div class="event-col__month-img">' +
477						'<img src="' + imgUrl + '" alt="' + monthName + ' Blurb" />' +
478					'</div>' +
479					'<div class="event-col__month-text">' + monthName + '</div>' +
480				'</div>' +
481			'</div>';
482	}
483
484	function template_itemContent(post) {
485		var monthName = month_numToName(post.monthNum);
486		var contentEmphasisClass = (post.excerptEmphasis == '') ? 'event-col__content-desc--emphasis-no-margin-bottom' : '';
487
488		return '' +
489			'<div class="event-col__item event-col__item--content cell all-month all-event-type ' + monthName.toLowerCase() + ' ' + post.eventCategorySlugsClass + '">' +
490			'<div class="event-col__item-container">' +
491				'<div class="event-col__content">' +
492					'<div class="event-col__content-date">' +
493						'<span class="event-col__content-date-text">' +
494							post.day +
495						'</span>' +
496					'</div>' +
497					'<div class="event-col__content-area">' +
498						'<h3 class="event-col__content-title">' +
499							post.title +
500						'</h3>' +
501						'<div class="event-col__content-info">' +
502							'<p>' + post.contentInfo + '</p>' +
503						'</div>' +
504						'<div class="event-col__content-desc event-col__content-desc--excerpt">' +
505								post.excerptReadMore +
506						'</div>' +
507						'<div class="event-col__content-desc event-col__content-desc--emphasis ' + contentEmphasisClass + '">' +
508								post.excerptEmphasis +
509						'</div>' +
510					'</div>' +
511					'<div class="event-col__content-buttons">' +
512						'<a ' + post.button.target + ' class="btn-button btn-button--yellow-to-green" href="' + post.button.url + '">' +
513							post.button.text +
514						'</a>' +
515					'</div>' +
516				'</div>' +
517			'</div>' +
518			'</div>';
519	}
520
521	function showFilteredItems() {
522		var month = json.filter.month;
523		var eventType = json.filter.eventType;
524
525		console.log(OBJ.eventCol.$item);
526		console.log(json.posts);
527
528		for (i=0; i<OBJ.eventCol.$item.length; i++) {
529			var $item = OBJ.eventCol.$item[i].$el;
530
531			if ($item.hasClass(month) && $item.hasClass(eventType)) {
532				$item.removeClass('inactive');
533				$item.addClass('active');
534			} else {
535				$item.removeClass('active');
536				$item.addClass('inactive');
537			}
538		}
539	}
540
541	function initButtons() {
542
543
544		/**
545		 * Sanitized to allow only alphanumeric characters, dashes, and underscores.
546		 * Handle URL parameters and hash fragments to extract a filter value for event listings.
547		 * Prioritize the 'topic' query parameter over the hash value in the URL.
548		 * If a hash value is used and no 'topic' parameter exists, update the URL to include the 'topic' parameter.
549		 * Apply the filter to the event list by updating the DOM elements accordingly.
550		 */
551
552		function sanitizeFilterValue(value) {
553
554			if (!value) return null;
555			let cleanValue = value.split('?')[0].split('#')[0];
556			cleanValue = cleanValue.toLowerCase().replace(/[^a-z0-9-_]/g, '');
557
558			return cleanValue || null;
559		}
560
561		var urlParams = new URLSearchParams(window.location.search);
562		var topicParam = sanitizeFilterValue(urlParams.get('topic'));
563
564		var rawHash = window.location.hash.substring(1);
565		var hashValue = rawHash.split('&')[0].split('?')[0];
566		var hashName = sanitizeFilterValue(hashValue);
567
568		var filterValue;
569
570		if (topicParam) {
571			filterValue = topicParam;
572		} else if (hashName) {
573			filterValue = hashName;
574
575			var currentUrl = window.location.href;
576			var hashIndex = currentUrl.indexOf('#');
577			var questionMarkAfterHashIndex = currentUrl.indexOf('?', hashIndex);
578			var ampersandAfterHashIndex = currentUrl.indexOf('&', hashIndex);
579
580			if (questionMarkAfterHashIndex !== -1) {
581				// Case: #hash?params
582				var paramsAfterHash = currentUrl.substring(questionMarkAfterHashIndex);
583				var newUrl = currentUrl.substring(0, hashIndex) + '?topic=' + hashName + paramsAfterHash;
584				window.history.replaceState({}, '', newUrl);
585			} else if (ampersandAfterHashIndex !== -1) {
586				// Case: #hash&params
587				var paramsAfterHash = currentUrl.substring(ampersandAfterHashIndex);
588				var newUrl = currentUrl.substring(0, hashIndex) + '?topic=' + hashName + paramsAfterHash;
589				window.history.replaceState({}, '', newUrl);
590			} else {
591				// Case: simple #hash
592				var newUrl = currentUrl.substring(0, hashIndex) + '?topic=' + hashName;
593				window.history.replaceState({}, '', newUrl);
594			}
595		}
596
597		if (filterValue) {
598			var $this = $('.event-col__filter button[data-value="' + filterValue + '"]');
599
600			var $filterList = $this.closest('.event-col__filter-list');
601			var data = {
602				value: filterValue,
603			};
604
605			$filterList.find('li').removeClass('active');
606
607			$this.closest('li').addClass('active');
608
609			OBJ.eventCol.item.removeClass('active');
610
611			if (OBJ.eventCol.item.hasClass('event-col__item--month')) json.filter.month = data.value;
612			if (OBJ.eventCol.item.hasClass('event-col__item--content')) json.filter.eventType = data.value;
613
614			showFilteredItems();
615			destroyDotdotdot();
616			createDotdotdot();
617
618			equalizeItemHeight_unset();
619			equalizeItemHeight();
620		}
621
622		OBJ.eventCol.el.find('.event-col__filter button').click(function () {
623			var $this = $(this);
624			var $filterList = $this.closest('.event-col__filter-list');
625			var data = {
626				value: $this.attr('data-value'),
627			};
628
629			var currentUrl = new URL(window.location.href);
630			var existingParams = new URLSearchParams(currentUrl.search);
631
632			var newParams = new URLSearchParams();
633			newParams.append('topic', data.value);
634
635			existingParams.forEach((value, key) => {
636				if (key !== 'topic') {
637					newParams.append(key, value);
638				}
639			});
640
641			currentUrl.search = newParams.toString();
642			window.history.pushState({}, '', currentUrl.toString().split('#')[0]); 
643
644			$filterList.find('li').removeClass('active');
645
646			$this.closest('li').addClass('active');
647
648			OBJ.eventCol.item.removeClass('active');
649
650			if (OBJ.eventCol.item.hasClass('event-col__item--month')) json.filter.month = data.value;
651			if (OBJ.eventCol.item.hasClass('event-col__item--content')) json.filter.eventType = data.value;
652
653			showFilteredItems();
654
655			destroyDotdotdot();
656			createDotdotdot();
657
658			equalizeItemHeight_unset();
659			equalizeItemHeight();
660		});
661
662		OBJ.eventCol.el.find('.event-col__more button').click(function() {
663			var $this = $(this);
664			var $more = $(this).parent();
665			var html = [];
666			var loopCount;
667			var numPostsShown = 9;
668
669			if (!$more.hasClass('disabled') && !$more.hasClass('force-disabled')) {
670				$more.addClass('disabled');
671
672				// if: there are posts left in the json
673				if (numPostsShown < json.posts.length) {
674					var postsRemaining = json.posts.length - numPostsShown;
675
676					// if: 9 or more posts left, set loopCount to get only 9 posts
677					// else: get the remaining num of posts and hide more button
678					if (postsRemaining >= 9) {
679						loopCount = 9;
680
681						// 9 posts left in loop, hide more button
682						if (postsRemaining == 9) $more.addClass('force-disabled');
683					} else {
684						loopCount = postsRemaining;
685						$more.addClass('force-disabled');
686					}
687				}
688
689				for (i=0; i<loopCount; i++) {
690					var post = json.posts[numPostsShown+i];
691
692					// if: create item content if loopMonthNum matches
693					// else: create item month, item content, set loopMonthNum to current month
694
695					if (post.monthNum == json.data.loopMonthNum) {
696						html.push(template_itemContent(post));
697					} else {
698						html.push(template_itemMonth(post.year, post.monthNum));
699						html.push(template_itemContent(post));
700						json.data.loopMonthNum = post.monthNum;
701					}
702
703					// increment json numPostsShown
704					json.data.numPostsShown++;
705				}
706
707				// append new items to grid
708				OBJ.eventCol.el.find('.event-col__grid-wrap')[0].insertAdjacentHTML('beforeend', html.join(''));
709
710				// update
711				UPDATE.eventCol.item();
712				UPDATE.eventCol.$item();
713				UPDATE.eventCol.contentArea();
714				UPDATE.eventCol.contentDescExcerpt();
715				UPDATE.eventCol.contentButtons();
716
717				// added delay for showFilteredItems() animation to take effect
718				setTimeout(function() {
719					// show filtered items
720					showFilteredItems();
721
722					// recreate dotdotdot items
723					destroyDotdotdot();
724					createDotdotdot();
725
726					// regroup $item
727					// OBJ.data.itemGroup2 = groupItemsTo(2);
728					// OBJ.data.itemGroup3 = groupItemsTo(3);
729
730					// equalizeHeight
731					equalizeItemHeight_unset();
732					equalizeItemHeight();
733				}, 200);
734
735				// enable user to click the load more button
736				setTimeout(function() {
737					$more.removeClass('disabled');
738				}, 500);
739			}
740		});
741	}
742
743	UPDATE.data.windowWidth();
744	UPDATE.data.isDesktop();
745	UPDATE.data.isMobile();
746	UPDATE.data.isTablet();
747	UPDATE.data.isPhone();
748	UPDATE.data.currentBreakpoint();
749	UPDATE.data.lastBreakpoint();
750
751	UPDATE.eventCol.contentArea();
752	UPDATE.eventCol.contentDescExcerpt();
753	UPDATE.eventCol.contentButtons();
754
755	UPDATE.eventCol.item();
756	UPDATE.eventCol.$item();
757
758	OBJ.data.itemGroup2 = groupItemsTo(2);
759	OBJ.data.itemGroup3 = groupItemsTo(3);
760
761	initButtons();
762	equalizeItemHeight();
763
764	$window.on('load', function() {
765		UPDATE.data.windowWidth();
766		UPDATE.data.isMobile();
767		UPDATE.data.isTablet();
768		UPDATE.data.isPhone();
769		UPDATE.data.currentBreakpoint();
770		UPDATE.data.lastBreakpoint();
771
772		equalizeItemHeight_unset();
773
774		createDotdotdot();
775
776		equalizeItemHeight();
777	});
778
779	$window.on('resize', function() {
780		UPDATE.data.windowWidth();
781		UPDATE.data.isMobile();
782		UPDATE.data.isTablet();
783		UPDATE.data.isPhone();
784		UPDATE.data.currentBreakpoint();
785		UPDATE.data.updateDotdotdot();
786
787		equalizeItemHeight_unset();
788
789		if (OBJ.data.updateDotdotdot) {
790			destroyDotdotdot();
791			createDotdotdot();
792		}
793
794		equalizeItemHeight();
795
796		UPDATE.data.lastBreakpoint();
797	});
798}
799
800function module_journalList(el, json) {
801	var $ = jQuery;
802	var $el = $(el);
803	var $items = $el.find('.journal-list__item');
804	var $gridWrap = $el.find('.journal-list__grid-wrap');
805	var $isotope = $gridWrap.isotope({
806		itemSelector: '.journal-list__item',
807		layoutMode: 'masonry'
808	});
809
810	// relayout isotope items after images loaded
811	$isotope.imagesLoaded().progress(function() {
812		$isotope.isotope('layout');
813	});
814
815	function template_item(post, postCount) {
816		var itemClass = [];
817		itemClass.push('journal-list__item--img-' + ((postCount % 9) + 1));
818
819		var RBI_name = 'jl-img-' + Math.floor(Math.random() * 10000);
820
821		return '' +
822			'<div class="journal-list__item ' + itemClass.join('') + ' ' + post.categoryClass + '">' +
823				'<div class="journal-list__space"></div>' +
824				'<div class="journal-list__onhover">' +
825					'<div class="journal-list__imgbox ' + RBI_name + '">' +
826						responsive_background_image(post.image, 'landscape', RBI_name, 'xxl', false, false) +
827						'<div class="journal-list__img ' + RBI_name + '">' +
828							'<a href="' + post.permalink + '">' +
829								picture(post.image, 'landscape', 'xxl', false, false) +
830							'</a>' +
831						'</div>' +
832					'</div>' +
833					'<div class="journal-list__contentbox">' +
834						'<div class="journal-list__meta">' +
835
836						/*
837							((post.categories) ?
838								'<span class="journal-list__meta-cat">' +
839									post.categories +
840								'</span>' +
841								'<span class="journal-list__meta-sep">|</span>'
842							: '') +
843						*/
844
845							((post.tags) ?
846								'<span class="journal-list__meta-cat">' +
847									post.tags +
848								'</span>' +
849								'<span class="journal-list__meta-sep">|</span>'
850							: '') +
851
852
853
854
855							'<span class="journal-list__meta-date">' +
856								post.publishDate +
857							'</span>' +
858						'</div>' +
859						'<h2 class="journal-list__title">' +
860							'<a href="' + post.permalink + '">' +
861								post.title +
862							'</a>' +
863						'</h2>' +
864						'<div class="journal-list__content">' +
865							post.content +
866						'</div>' +
867						'<div class="journal-list__btnbox">' +
868							'<a class="btn-arrow btn-arrow--yellow" href="' + post.permalink + '">' +
869								'<span>Read More</span>' +
870								'<span class="btn-arrow__icon">' +
871									'<span class="btn-arrow__icon-default"></span>' +
872									'<span class="btn-arrow__icon-hover"></span>' +
873								'</span>' +
874							'</a>' +
875						'</div>' +
876					'</div>' +
877				'</div>' +
878			'</div>';
879	}
880
881
882	$(window).scroll(function (event) {
883		var scroll = $(window).scrollTop();
884		var happening = $('.event-slider.event-slider--theme-journal').offset();
885		console.log(scroll + ' - ' + happening.top);
886
887		if(scroll > (happening.top - 200) )
888		{
889			$('.journal-filter').css('visibility', 'hidden');
890		}
891		else
892		{
893			$('.journal-filter').css('visibility','visible');
894		}
895	});
896
897	function loadJournalPosts(loadMoreSelector) {
898
899		var $more = loadMoreSelector.parent();
900		var html = [];
901		var loopCount;
902		var numPostsShown = json.data.numPostsShown;
903
904		// if: there are posts left in the json
905		if (numPostsShown < json.posts.length) {
906			var postsRemaining = json.posts.length - numPostsShown;
907
908			// if: 9 or more posts left, set loopCount to get only 9 posts
909			// else: get the remaining num of posts and hide more button
910			if (postsRemaining >= 9) {
911				loopCount = 9;
912
913				// 9 posts left in loop, hide more button
914				if (postsRemaining == 9) $more.addClass('force-disabled');
915			} else {
916				loopCount = postsRemaining;
917				$more.addClass('force-disabled');
918			}
919		}
920
921		for (p=0; p<loopCount; p++) {
922			var post = json.posts[numPostsShown+p];
923
924			// create journal item
925			html.push(template_item(post, numPostsShown+p));
926
927			// increment json numPostsShown
928			json.data.numPostsShown++;
929		}
930
931		// convert html array to jQuery
932		$html = $(html.join());
933
934		// append new items to grid
935		$isotope.append($html).isotope('appended', $html);
936
937		// update $items
938		$items = $el.find('.journal-list__item');
939
940		// relayout isotope items after images loaded
941		$isotope.imagesLoaded().progress(function() {
942			// slow internet bugfix: delay relayout of items
943			for ($i=1; $i<4; $i++) {
944				setTimeout(function() {
945					$isotope.isotope('layout');	
946				}, $i*1000);
947			}
948		});
949
950		// enable user to click the load more button
951		setTimeout(function() {
952			$more.removeClass('disabled');
953		}, 1000);
954	}
955
956	function initJournalFilter() {
957
958		var hashName = window.location.hash.substring(1);
959		if(hashName) {
960			var $this = $('#' + $el.attr('data-journal-filter-id') + ' button[data-value='+hashName+']');
961			var $li = $this.closest('li');
962			var data = {
963				value: hashName
964			};
965
966			if (!$li.hasClass('active')) {
967				// reset active
968				$this.closest('.journal-filter').find('li').removeClass('active');
969
970				// set selected button to active
971				$li.addClass('active');
972
973				// add add-space class to first and third item
974				var j = 0;
975
976				for (var i=0; i<$items.length; i++) {
977					var $item = $($items[i]);
978
979					// remove add-space first
980					$item.removeClass('journal-list__item--add-space');
981
982					if (j < 3) {
983						if ($item.hasClass(data.value)) {
984							j++;
985
986							if (j != 2) {
987								$item.addClass('journal-list__item--add-space');
988							}
989						}
990					}
991				}
992
993				// filter items
994				$isotope.isotope({
995					'filter': '.'+data.value
996				});
997			}
998		};
999
1000
1001		$('#' + $el.attr('data-journal-filter-id') + ' button').click(function() {
1002			var $this = $(this);
1003			var $li = $this.closest('li');
1004			var data = {
1005				value: $this.attr('data-value')
1006			};
1007
1008			if (!$li.hasClass('active')) {
1009				// reset active
1010				$this.closest('.journal-filter').find('li').removeClass('active');
1011
1012				// set selected button to active
1013				$li.addClass('active');
1014
1015				// add add-space class to first and third item
1016				var j = 0;
1017
1018				for (var i=0; i<$items.length; i++) {
1019					var $item = $($items[i]);
1020
1021					// remove add-space first
1022					$item.removeClass('journal-list__item--add-space');
1023
1024					if (j < 3) {
1025						if ($item.hasClass(data.value)) {
1026							j++;
1027
1028							if (j != 2) {
1029								$item.addClass('journal-list__item--add-space');
1030							}
1031						}
1032					}
1033				}
1034
1035				loadJournalPosts($el.find('.journal-list__more button'));
1036
1037				// filter items
1038				$isotope.isotope({
1039					'filter': '.'+data.value
1040				});
1041		}
1042		});
1043	}
1044
1045	function initButtons() {
1046		$el.find('.journal-list__more button').click(function() {
1047			loadJournalPosts($(this));
1048		});
1049	}
1050
1051	initButtons();
1052	initJournalFilter();
1053}
1054
1055function module_pressList(el, json) {
1056	var $ = jQuery;
1057	var $el = $(el);
1058	var $window = $(window);
1059
1060	var OBJ = {
1061		data: {
1062			windowWidth: 0,
1063			isMobile: false,
1064		},
1065	};
1066
1067	var UPDATE = {
1068		data: {
1069			windowWidth: function() {
1070				OBJ.data.windowWidth = $window.width();
1071			},
1072			isMobile: function() {
1073				OBJ.data.isMobile = (OBJ.data.windowWidth <= 1024);
1074			},
1075		}
1076	};
1077
1078	function template_item(post) {
1079		return '' +
1080			'<li class="press-list__item">' +
1081				'<div class="press-list__content">' +
1082					'<a target="' + post.target + '" href="' + post.url + '">' +
1083						post.title +
1084					'</a>' +
1085				'</div>' +
1086			'</li>';
1087	}
1088
1089	function initButtons() {
1090		// var firstLoadMoreClick = true; // check if load more button has been clicked for the first time
1091		var maxLoopCount = 9;
1092
1093		$el.find('.press-list__more button').click(function() {
1094			// var $this = $(this);
1095			var $more = $(this).parent();
1096			var html = [];
1097			var loopCount;
1098			var numPostsShown = json.data.numPostsShown;
1099
1100			if (!$more.hasClass('disabled') && !$more.hasClass('force-disabled')) {
1101				$more.addClass('disabled');
1102
1103				// set maxLoopCount
1104				// if: mobile - set loopCount to 6
1105				// else: set loopCount to 9
1106
1107				if (OBJ.data.isMobile) {
1108					maxLoopCount = 6;
1109				} else {
1110					maxLoopCount = 9;
1111				}
1112
1113				// if: there are posts left in the json
1114				if (numPostsShown < json.posts.length) {
1115					var postsRemaining = json.posts.length - numPostsShown;
1116
1117					// if: (maxLoopCount) or more posts left, set loopCount to get only (maxLoopCount) posts
1118					// else: get the remaining num of posts and hide more button
1119					if (postsRemaining >= maxLoopCount) {
1120						loopCount = maxLoopCount;
1121
1122						// (maxLoopCount) posts left in loop, hide more button
1123						if (postsRemaining == maxLoopCount) $more.addClass('force-disabled');
1124					} else {
1125						loopCount = postsRemaining;
1126						$more.addClass('force-disabled');
1127					}
1128				}
1129
1130				for (i=0; i<loopCount; i++) {
1131					var post = json.posts[numPostsShown+i];
1132
1133					// create press item
1134					html.push(template_item(post));
1135
1136					// increment json numPostsShown
1137					json.data.numPostsShown++;
1138				}
1139
1140				// append new items to list
1141				$el.find('.press-list__list')[0].insertAdjacentHTML('beforeend', html.join(''));
1142
1143				// enable user to click the load more button
1144				setTimeout(function() {
1145					$more.removeClass('disabled');
1146				}, 500);
1147			}
1148		});
1149	}
1150
1151	initButtons();
1152
1153	UPDATE.data.windowWidth();
1154	UPDATE.data.isMobile();
1155
1156	$window.on('resize', function() {
1157		UPDATE.data.windowWidth();
1158		UPDATE.data.isMobile();
1159	});
1160}
1161
1162function module_accolades(el, json) {
1163	var $ = jQuery;
1164	var $el = $(el);
1165
1166	function template_item(post) {
1167		return '' +
1168			'<li class="accolades__item">' +
1169				'<a target="' + post.link.target + '" href="' + post.link.url + '">' +
1170					'<img src="' + post.image.desktop.url + '" alt="' + post.image.desktop.alt + '" style="width: ' + post.imageWidth + 'px;" />' +
1171				'</a>' +
1172			'</li>';
1173	}
1174
1175	function template_itemDivider(num) {
1176		return '' +
1177			'<li class="accolades__item accolades__item--divider-' + num + '">' +
1178			'</li>';
1179	}
1180
1181	function initButtons() {
1182		var maxLoopCount = 3;
1183
1184		$el.find('.accolades__more button').click(function() {
1185			// var $this = $(this);
1186			var $more = $(this).parent();
1187			var html = [];
1188			var loopCount;
1189			var numPostsShown = json.data.numPostsShown;
1190
1191			if (!$more.hasClass('disabled') && !$more.hasClass('force-disabled')) {
1192				$more.addClass('disabled');
1193
1194				// if: there are posts left in the json
1195				if (numPostsShown < json.posts.length) {
1196					var postsRemaining = json.posts.length - numPostsShown;
1197
1198					// if: (maxLoopCount) or more posts left, set loopCount to get only (maxLoopCount) posts
1199					// else: get the remaining num of posts and hide more button
1200					if (postsRemaining >= maxLoopCount) {
1201						loopCount = maxLoopCount;
1202
1203						// (maxLoopCount) posts left in loop, hide more button
1204						if (postsRemaining == maxLoopCount) $more.addClass('force-disabled');
1205					} else {
1206						loopCount = postsRemaining;
1207						$more.addClass('force-disabled');
1208					}
1209				}
1210
1211				for (i=0; i<loopCount; i++) {
1212					var post = json.posts[numPostsShown+i];
1213					var itemCount = numPostsShown+i+1;
1214
1215					// create press item
1216					html.push(template_item(post));
1217
1218					// add divider after second/third item
1219					if (itemCount % 2 == 0) html.push(template_itemDivider(2));
1220					if (itemCount % 3 == 0) html.push(template_itemDivider(3));
1221
1222					// increment json numPostsShown
1223					json.data.numPostsShown++;
1224				}
1225
1226				// append new items to list
1227				$el.find('.accolades__list')[0].insertAdjacentHTML('beforeend', html.join(''));
1228
1229				// enable user to click the load more button
1230				setTimeout(function() {
1231					$more.removeClass('disabled');
1232				}, 500);
1233			}
1234		});
1235	}
1236
1237	initButtons();
1238}
1239
1240(function($) {
1241
1242	var $document = $(document);
1243	var $window = $(window);
1244	var $body = $('body');
1245	var $html = $('html');
1246
1247	function SWIPER_addClass_disabled(swSlider, minSlides, breakpoint) {
1248		// minSlides: 1st index is used for desktop, 2nd index is for breakpoint[0], 3rd index for breakpoint[1], etc
1249		
1250		var windowWidth = $window.width();
1251		var minSlidesUsed = -1;
1252	
1253		if (typeof breakpoint === 'undefined') breakpoint = [1024,767];
1254		if (typeof minSlides === 'undefined') minSlides = [1,1,1];
1255
1256		// get minSlides
1257		for (var i=0; i<breakpoint.length; i++) {
1258			var currentBreakpoint = breakpoint[i];
1259
1260			// if: not last breakpoint in array
1261			// else: last breakpoint in array
1262			if (i+1 != breakpoint.length) var nextBreakpoint = breakpoint[i+1];
1263			else var nextBreakpoint = 0;
1264
1265			// breakpoint matched, use minSlides according to breakpoint
1266			if (
1267				windowWidth <= currentBreakpoint &&
1268				windowWidth >= nextBreakpoint
1269			) {
1270				minSlidesUsed = minSlides[i+1]
1271			}
1272		}
1273
1274		// for loop fails, use desktop
1275		if (minSlidesUsed === -1) minSlidesUsed = minSlides[0];
1276	
1277		for (var i=0; i<swSlider.length; i++) {
1278			var swContainer = swSlider.find('> .swiper-container');
1279			var swSlide = swSlider.find('> .swiper-container > .swiper-wrapper > .swiper-slide');
1280			if (swSlide.length <= minSlidesUsed) {
1281				swContainer.addClass('disabled');
1282			} else {
1283				swContainer.removeClass('disabled');
1284			}
1285		}
1286	}
1287
1288	function userAgentBodyClass() {
1289		var parser = new UAParser().getResult();
1290
1291		// add to body class
1292		// OS name
1293		// Browser name
1294		$body.addClass('body-os-' + parser.os.name.replace(' ', '-').toLowerCase());
1295		$body.addClass('body-browser-' + parser.browser.name.replace(' ', '-').toLowerCase());
1296	}
1297
1298	function animation() {
1299
1300		$('.has-fade-in').each(function() {
1301			var offset = $(this).attr('data-animation-offset');
1302			if (typeof offset === 'undefined') offset = '80%';
1303			if (offset == '') offset = '80%';
1304
1305			new Waypoint({
1306				element: this,
1307				handler: function(direction) {
1308					$(this.element).addClass('fade-in');
1309				},
1310				offset: offset
1311			});
1312		});
1313
1314		$('.has-fade-right').each(function() {
1315			var offset = $(this).attr('data-animation-offset');
1316			if (typeof offset === 'undefined') offset = '80%';
1317			if (offset == '') offset = '80%';
1318
1319			new Waypoint({
1320				element: this,
1321				handler: function(direction) {
1322					$(this.element).addClass('fade-right');
1323				},
1324				offset: offset
1325			});
1326		});
1327
1328		$('.has-fade-left').each(function() {
1329			var offset = $(this).attr('data-animation-offset');
1330			if (typeof offset === 'undefined') offset = '80%';
1331			if (offset == '') offset = '80%';
1332
1333			new Waypoint({
1334				element: this,
1335				handler: function(direction) {
1336					$(this.element).addClass('fade-left');
1337				},
1338				offset: offset
1339			});
1340		});
1341
1342		$('.has-fade-down').each(function() {
1343			var offset = $(this).attr('data-animation-offset');
1344			if (typeof offset === 'undefined') offset = '80%';
1345			if (offset == '') offset = '80%';
1346
1347			new Waypoint({
1348				element: this,
1349				handler: function(direction) {
1350					$(this.element).addClass('fade-down');
1351				},
1352				offset: offset
1353			});
1354		});
1355
1356		$('.has-fade-up').each(function() {
1357			var offset = $(this).attr('data-animation-offset');
1358			if (typeof offset === 'undefined') offset = '80%';
1359			if (offset == '') offset = '80%';
1360
1361			new Waypoint({
1362				element: this,
1363				handler: function(direction) {
1364					var $el = $(this.element);
1365
1366					$el.addClass('fade-up');
1367					if ($el.hasClass("landing-page__photoform-line")) animLine.play();
1368					if ($el.hasClass("landing-page__photocon-btn")) animCircle.play();
1369				},
1370				offset: offset
1371			});
1372		});
1373
1374		// refresh all waypoint on load
1375		// fix: footer not showing up due to dotdotdot truncating content making the waypoint position different and prevent from triggering
1376		for (var i=0; i<5; i++) {
1377			setTimeout(function() {
1378				Waypoint.refreshAll();
1379			}, i*800);
1380		}
1381
1382		// refresh all waypoint on resize
1383		// same issue
1384		$window.on('resize', function() {
1385			setTimeout(function() {
1386				Waypoint.refreshAll();
1387			}, 2000);
1388		});
1389	}
1390
1391	function marqueeJS() {
1392		var OBJ = {
1393			scrollingMsg: {
1394				el: $('.scrolling-msg'),
1395				content: $('.scrolling-msg__content')
1396			},
1397			data: {
1398				windowWidth: 0,
1399				isMobile: false,
1400				isTablet: false,
1401				isPhone: false,
1402				lastBreakpoint: 'desktop',
1403				currentBreakpoint: 'desktop',
1404				updateMarquee: false
1405			},
1406		};
1407
1408		OBJ.data.scrollDuration = parseInt(OBJ.scrollingMsg.el.attr('data-scroll-duration'));
1409		OBJ.data.scrollDurationMobile = parseInt(OBJ.scrollingMsg.el.attr('data-scroll-duration-mobile'));
1410
1411		var UPDATE = {
1412			data: {
1413				windowWidth: function() {
1414					OBJ.data.windowWidth = $window.width();
1415				},
1416				isMobile: function() {
1417					OBJ.data.isMobile = (OBJ.data.windowWidth <= 1024);
1418				},
1419				isTablet: function() {
1420					OBJ.data.isTablet = (OBJ.data.windowWidth <= 1024 && OBJ.data.windowWidth >= 768);
1421				},
1422				isPhone: function() {
1423					OBJ.data.isPhone = (OBJ.data.windowWidth <= 767);
1424				},
1425				currentBreakpoint: function() {
1426					if (OBJ.data.isTablet) OBJ.data.currentBreakpoint = 'tablet';
1427					else if (OBJ.data.isPhone) OBJ.data.currentBreakpoint = 'phone';
1428					else OBJ.data.currentBreakpoint = 'desktop';
1429				},
1430				lastBreakpoint: function() {
1431					OBJ.data.lastBreakpoint = OBJ.data.currentBreakpoint;
1432				},
1433				updateMarquee: function() {
1434					// update marquee if currentBreakpoint and lastBreakpoint are not matching
1435					// prevents calling marquee function again on every resize
1436					OBJ.data.updateMarquee = (OBJ.data.currentBreakpoint !== OBJ.data.lastBreakpoint);
1437				}
1438			}
1439		};
1440
1441		function runMarquee() {
1442			if (OBJ.scrollingMsg.content.length > 0) {
1443				$body.addClass('body-scrolling-msg');
1444
1445				OBJ.scrollingMsg.content.marquee({
1446					duration: (!OBJ.data.isPhone) ? OBJ.data.scrollDuration : OBJ.data.scrollDurationMobile,
1447					gap: (OBJ.data.isPhone) ? 50 : 150,
1448					direction: 'right',
1449					duplicated: true,
1450					allowCss3Support: true,
1451					css3easing: 'linear',
1452					startVisible: true,
1453				});
1454			}
1455		}
1456
1457		function destroyMarquee() {
1458			if (OBJ.scrollingMsg.content.length > 0) {
1459				OBJ.scrollingMsg.content.marquee('destroy');
1460			}
1461		}
1462
1463		UPDATE.data.windowWidth();
1464		UPDATE.data.isMobile();
1465		UPDATE.data.isTablet();
1466		UPDATE.data.isPhone();
1467		UPDATE.data.currentBreakpoint();
1468		UPDATE.data.lastBreakpoint();
1469
1470		runMarquee();
1471
1472		$window.on('resize', function() {
1473			UPDATE.data.windowWidth();
1474			UPDATE.data.isMobile();
1475			UPDATE.data.isTablet();
1476			UPDATE.data.isPhone();
1477			UPDATE.data.currentBreakpoint();
1478			UPDATE.data.updateMarquee();
1479
1480			if (OBJ.data.updateMarquee) {
1481				destroyMarquee();
1482
1483				// added setTimeout
1484				// fix for desktop scrolling-msg is not scrolling
1485				var duration = (OBJ.data.currentBreakpoint == 'desktop') ? 500 : 0;
1486
1487				setTimeout(function() {
1488					runMarquee();
1489				}, duration);
1490			}
1491
1492			UPDATE.data.lastBreakpoint();
1493		});
1494	}
1495
1496	function navspace() {
1497		var OBJ = {
1498			navspace: {
1499				el: $('.navspace')
1500			},
1501			navScroll: {
1502				el: $('.nav-scroll')
1503			},
1504			navHamMobile: {
1505				el: $('.nav-ham-mobile')
1506			},
1507			data: {
1508				windowWidth: 0,
1509				isHome: false,
1510				hasWhiteBar: false,
1511				isMobile: false,
1512				isPhone: false
1513			}
1514		};
1515
1516		var UPDATE = {
1517			data: {
1518				windowWidth: function() {
1519					OBJ.data.windowWidth = $window.width();
1520				},
1521				isHome: function() {
1522					OBJ.data.isHome = $body.hasClass('home');
1523				},
1524				hasWhiteBar: function() {
1525					OBJ.data.hasWhiteBar = $body.hasClass('show-whitebar');
1526				},
1527				isMobile: function() {
1528					OBJ.data.isMobile = OBJ.data.windowWidth <= 1024;
1529				},
1530				isPhone: function() {
1531					OBJ.data.isPhone = OBJ.data.windowWidth <= 767;
1532				},
1533			}
1534		}
1535
1536		function addNavspaceHeight() {
1537			var height = 0;
1538
1539			// get the height to be used for .navspace
1540			if (!OBJ.data.isMobile) {
1541				if (OBJ.navScroll.el.length > 0) {
1542					height = OBJ.navScroll.el.height();
1543				}
1544			} else {
1545				if (OBJ.data.isHome || !OBJ.data.hasWhiteBar) {
1546					height = 0;
1547				} else if (OBJ.navHamMobile.el.length > 0) {
1548					height = OBJ.navHamMobile.el.height();
1549				}
1550			}
1551
1552			// apply height to navspace
1553			if (OBJ.data.isHome || !OBJ.data.hasWhiteBar) {
1554				if (OBJ.data.isPhone) {
1555					OBJ.navspace.el.css({'height': height + 'px'});
1556				}
1557			} else {
1558				OBJ.navspace.el.css({'height': height + 'px'});
1559			}
1560
1561		}
1562
1563		function addNavspaceHeight_unset() {
1564			OBJ.navspace.el.css({'height': ''});
1565		}
1566
1567		UPDATE.data.windowWidth();
1568		UPDATE.data.isHome();
1569		UPDATE.data.isMobile();
1570		UPDATE.data.hasWhiteBar();
1571		UPDATE.data.isPhone();
1572
1573		addNavspaceHeight();
1574
1575		$window.on('resize', function() {
1576			UPDATE.data.windowWidth();
1577			UPDATE.data.isMobile();
1578			UPDATE.data.isPhone();
1579
1580			addNavspaceHeight_unset();
1581			addNavspaceHeight();
1582		});
1583	}
1584
1585	function navMobile() {
1586		$('.nav-mobile__menu > ul > li.menu-item-has-children > a').click(function(e) {
1587			e.preventDefault();
1588
1589			var $this = $(this);
1590			var $this_li = $this.parent();
1591			var li = $this.closest('ul').find('li');
1592			
1593			if (!$this_li.hasClass('active')) {
1594				li.removeClass('active');
1595				li.find('.sub-menu').slideUp();
1596				$this_li.addClass('active');
1597				$this_li.find('.sub-menu').slideDown();
1598			} else {
1599				$this_li.removeClass('active');
1600				$this_li.find('.sub-menu').slideUp();
1601			}
1602		});
1603	}
1604
1605	function adjustBannerPadding() {
1606		var OBJ = {
1607			banner: {
1608				container: $('.banner__container')
1609			},
1610			onfold: {
1611				container: $('.onfold__container'),
1612				sticky: $('.onfold__sticky')
1613			},
1614			navRibbon: {
1615				el: $('.nav-ribbon')
1616			},
1617			navScroll: {
1618				el: $('.nav-scroll')
1619			},
1620			navHamMobile: {
1621				el: $('.nav-ham-mobile')
1622			},
1623			data: {
1624				windowWidth: 0,
1625				isMobile: false,
1626				is768Down: false,
1627			}
1628		};
1629	
1630		var UPDATE = {
1631			data: {
1632				windowWidth: function() {
1633					OBJ.data.windowWidth = $window.width();
1634				},
1635				isMobile: function() {
1636					OBJ.data.isMobile = OBJ.data.windowWidth <= 1024;
1637				},
1638				is768Down: function() {
1639					OBJ.data.is768Down = OBJ.data.windowWidth <= 768;
1640				}
1641			}
1642		}
1643
1644		function setStickyKit() {
1645			var offset = 0;
1646
1647			if (OBJ.data.windowWidth > 1024) {
1648				var offset = OBJ.navScroll.el.height();
1649			} else {
1650				var offset = OBJ.navHamMobile.el.height();
1651			}
1652
1653			OBJ.onfold.sticky.stick_in_parent({
1654				parent: 'main',
1655				sticky_class: 'is-stuck',
1656				offset_top: offset
1657			});
1658		}
1659	
1660		function adjustPadding() {
1661			// reset
1662			OBJ.banner.container.css('padding-bottom', '');
1663			OBJ.banner.container.css('padding-top', '');
1664	
1665			// onfold: adjust banner padding-bottom if desktop
1666			if (!OBJ.data.isMobile && OBJ.onfold.container.length > 0) OBJ.banner.container.css('padding-bottom', OBJ.onfold.container.height());
1667
1668			// nav-ribbon: adjust banner padding-top on phone screens
1669			if (OBJ.data.is768Down && OBJ.navRibbon.el.length > 0) OBJ.banner.container.css('padding-top', OBJ.navRibbon.el.height());
1670		}
1671	
1672		if (OBJ.onfold.container.length > 0) {
1673			UPDATE.data.windowWidth();
1674			UPDATE.data.isMobile();
1675			UPDATE.data.is768Down();
1676			adjustPadding();
1677
1678			setStickyKit();
1679	
1680			$window.on('resize', function() {
1681				UPDATE.data.windowWidth();
1682				UPDATE.data.isMobile();
1683				UPDATE.data.is768Down();
1684				adjustPadding();
1685
1686				OBJ.onfold.sticky.trigger("sticky_kit:detach");
1687				setStickyKit();
1688			});
1689		}
1690	}
1691
1692	function bodyOnScroll() {
1693		var scrollTop = 0;
1694		var scrollBottom = 0;
1695	
1696		var OBJ = {
1697			navFold: {
1698				el: $('.nav-fold')
1699			},
1700			banner: {
1701				el: $('.banner')
1702			},
1703			window: {
1704				scrollTop: 0
1705			}
1706		};
1707	
1708		var UPDATE = {
1709			navFold: function() {
1710				OBJ.navFold.offset = OBJ.navFold.el.offset();
1711				OBJ.navFold.height = OBJ.navFold.el.height();
1712			},
1713			banner: function() {
1714				OBJ.banner.offset = OBJ.banner.el.offset();
1715				OBJ.banner.height = OBJ.banner.el.height();
1716			},
1717			window: {
1718				scrollTop: function() {
1719					OBJ.window.scrollTop = $window.scrollTop();
1720				}
1721			}
1722		}
1723
1724		function do_bodyOnScroll() {
1725			if (OBJ.navFold.el.length > 0) {
1726				scrollTop = OBJ.navFold.offset.top;
1727				scrollBottom = scrollTop + OBJ.navFold.height;
1728			} else if (OBJ.banner.el.length > 0) {
1729				scrollTop = OBJ.banner.offset.top;
1730				scrollBottom = scrollTop + OBJ.banner.height;
1731				scrollTop = 0;
1732				scrollBottom = 0;
1733			} else {
1734				scrollTop = 0;
1735				scrollBottom = 0;
1736			}
1737	
1738			if (OBJ.window.scrollTop > scrollBottom) {
1739				$body.addClass('body-onscroll');
1740			} else {
1741				if($(window).width() > 700) {
1742					$body.removeClass('body-onscroll');
1743				} else {
1744					$body.addClass('body-onscroll');
1745				}
1746				
1747			}
1748		}
1749	
1750		if (OBJ.navFold.el.length > 0) UPDATE.navFold();
1751		if (OBJ.banner.el.length > 0) UPDATE.banner();
1752		UPDATE.window.scrollTop();
1753		do_bodyOnScroll();
1754	
1755		$window.on('scroll', function() {
1756			if (OBJ.navFold.el.length > 0 || OBJ.banner.el.length > 0) {
1757				UPDATE.window.scrollTop();
1758				do_bodyOnScroll();
1759			}
1760		});
1761	
1762		$window.on('resize', function() {
1763			if (OBJ.navFold.el.length > 0 || OBJ.banner.el.length > 0) {
1764				if (OBJ.navFold.el.length > 0) UPDATE.navFold();
1765				if (OBJ.banner.el.length > 0) UPDATE.banner();
1766				UPDATE.window.scrollTop();
1767				do_bodyOnScroll();
1768			}
1769		});		
1770	}
1771
1772	function allButtons() {
1773		var OBJ = {
1774			bookingWidget: {
1775				el: $('.booking-widget')
1776			},
1777			eventCol: {
1778				filterListButton: $('.event-col__filter-list button'),
1779				moreButton: $('.event-col__more button'),
1780			},
1781			popupModal: {
1782				el: $('.popup-modal')
1783			}
1784		};
1785
1786		var BTN = {
1787			navMobile: {
1788				open: $('.btn-open-nav-mobile'),
1789				close: $('.btn-close-nav-mobile'),
1790				toggle: $('.btn-toggle-nav-mobile'),
1791			},
1792			bookingWidget: {
1793				open: $('.btn-open-booking-widget'),
1794				close: $('.btn-close-booking-widget')
1795			},
1796			popupModal: {
1797				open: $('.btn-open-popup-modal'),
1798				close: $('.btn-close-popup-modal')
1799			}
1800		};
1801
1802		function BTN_navMobile() {
1803			BTN.navMobile.open.click(function() {
1804				$html.addClass('overflow-hidden');
1805				$body.addClass('body-nav-mobile overflow-hidden');
1806			});
1807	
1808			BTN.navMobile.close.click(function() {
1809				$html.removeClass('overflow-hidden');
1810				$body.removeClass('body-nav-mobile overflow-hidden');
1811			});
1812	
1813			BTN.navMobile.toggle.click(function() {
1814				if (!$body.hasClass('body-nav-mobile')) {
1815					$html.addClass('overflow-hidden');
1816					$body.addClass('body-nav-mobile overflow-hidden');
1817				} else {
1818					$html.removeClass('overflow-hidden');
1819					$body.removeClass('body-nav-mobile overflow-hidden');
1820				}
1821			});
1822		}
1823
1824		function BTN_bookingWidget() {
1825			var lastActiveElement = null;
1826
1827			BTN.bookingWidget.open.click(function() {
1828				lastActiveElement = document.activeElement;
1829				$body.removeClass('body-nav-mobile');
1830				OBJ.bookingWidget.el.addClass('active').attr('aria-hidden', 'false');
1831				
1832				// Announce opening via aria-live
1833				var ann = $('#booking-widget-announcement');
1834				if (ann.length > 0) {
1835					ann.text('Booking panel opened. Use tab to navigate.');
1836				}
1837				
1838				// Move focus into panel on open
1839				setTimeout(function() {
1840					OBJ.bookingWidget.el.focus();
1841				}, 100);
1842			});
1843	
1844			BTN.bookingWidget.close.click(function() {
1845				$html.removeClass('overflow-hidden');
1846				$body.removeClass('overflow-hidden');
1847				OBJ.bookingWidget.el.removeClass('active').attr('aria-hidden', 'true');
1848				
1849				// Clear announcement
1850				$('#booking-widget-announcement').text('');
1851				
1852				// Restore focus
1853				if (lastActiveElement) {
1854					lastActiveElement.focus();
1855				}
1856			});
1857
1858			// Trap Tab within booking widget
1859			$(document).on('keydown', function(e) {
1860				if (!OBJ.bookingWidget.el.hasClass('active')) return;
1861
1862				if (e.key === 'Tab' || e.keyCode === 9) {
1863					var focusableElements = OBJ.bookingWidget.el.find('button, [href], input, select, textarea, [tabindex]:not
1863([tabindex="-1"])').filter(':visible');
1864					if (focusableElements.length === 0) return;
1865					var firstElement = focusableElements[0];
1866					var lastElement = focusableElements[focusableElements.length - 1];
1867
1868					if (e.shiftKey) { // Shift + Tab
1869						if (document.activeElement === firstElement || document.activeElement === OBJ.bookingWidget.el[0]) {
1870							lastElement.focus();
1871							e.preventDefault();
1872						}
1873					} else { // Tab
1874						if (document.activeElement === lastElement) {
1875							firstElement.focus();
1876							e.preventDefault();
1877						}
1878					}
1879				}
1880
1881				// Escape key to close
1882				if (e.key === 'Escape' || e.keyCode === 27) {
1883					$html.removeClass('overflow-hidden');
1884					$body.removeClass('overflow-hidden');
1885					OBJ.bookingWidget.el.removeClass('active').attr('aria-hidden', 'true');
1886					$('#booking-widget-announcement').text('');
1887					if (lastActiveElement) {
1888						lastActiveElement.focus();
1889					}
1890				}
1891			});
1892		}
1893
1894		function BTN_popupModal() {
1895			BTN.popupModal.open.click(function(e) {
1896				e.preventDefault();
1897	
1898				var $this = $(this);
1899				var id = $this.attr('data-popup-modal-id');
1900				var selected = OBJ.popupModal.el.find('#'+id);
1901	
1902				if (selected.length > 0) {
1903					var selectedModal = selected.closest('.popup-modal');
1904
1905					$html.addClass('overflow-hidden');
1906					$body.addClass('overflow-hidden');
1907					selectedModal.addClass('active');
1908		
1909					// hide all modals
1910					selectedModal.find('.table-child > *').css('display', 'none');
1911		
1912					// show modal
1913					selected.css('display', '');
1914				} else {
1915					console.log('Modal Error: cannot find #'+id);
1916				}
1917			});
1918	
1919			BTN.popupModal.close.click(function() {
1920				$html.removeClass('overflow-hidden');
1921				$body.removeClass('overflow-hidden');
1922				OBJ.popupModal.el.removeClass('active');
1923			});
1924		}
1925
1926		function BTN_popupModal_rebinder() {
1927			// unbind popup modal click event
1928			BTN.popupModal.open.unbind('click');
1929			BTN.popupModal.close.unbind('click');
1930
1931			// get new values
1932			BTN.popupModal.open = $('.btn-open-popup-modal');
1933			BTN.popupModal.close = $('.btn-close-popup-modal');
1934
1935			// rebind popup modal click event
1936			BTN_popupModal();
1937		}
1938
1939		BTN_navMobile();
1940		BTN_bookingWidget();
1941		BTN_popupModal();
1942
1943		// event-col__filter-list button has been clicked
1944		OBJ.eventCol.filterListButton.click(function() {
1945			setTimeout(function() {
1946				BTN_popupModal_rebinder();
1947			}, 1000);
1948		});
1949
1950		// event-col__more button has been clicked
1951		OBJ.eventCol.moreButton.click(function() {
1952			setTimeout(function() {
1953				BTN_popupModal_rebinder();
1954			}, 1000);
1955		});
1956
1957		// rebind popup modal items
1958		// dotdotdot removes bind for .read-more selectors
1959		$window.on('load', function() {
1960			setTimeout(function() {
1961				BTN_popupModal_rebinder();
1962			}, 2000);
1963		});
1964
1965		$window.on('resize', function() {
1966			setTimeout(function() {
1967				BTN_popupModal_rebinder();
1968			}, 500);
1969		});
1970	}
1971
1972	function videoInline() {
1973		var $vides = $('.video-inline__vide');
1974
1975		for (i=0; i<$vides.length; i++) {
1976			var $vide = $($vides[i]);
1977			var instance = $vide.data('vide');
1978
1979			$vide.closest('.video-inline').find('.video-inline__btn').click(function() {
1980				var $this = $(this);
1981
1982				if (!$this.hasClass('active')) {
1983					$this.addClass('active');
1984					instance.getVideoObject().play();
1985				} else {
1986					$this.removeClass('active');
1987					instance.getVideoObject().pause();
1988				}
1989			});
1990		}
1991	}
1992
1993	function module_photoContent() {
1994		var OBJ = {
1995			photoContent: {
1996				slider: $('.photo-content__slider')
1997			},
1998			swiper: {}
1999		};
2000
2001		SWIPER_addClass_disabled(OBJ.photoContent.slider);
2002
2003		OBJ.swiper = new Swiper('.photo-content__slider-container', {
2004			autoplay: {
2005				delay: 2000,
2006			},
2007			pagination: {
2008				el: '.swiper-pagination',
2009				type: 'bullets',
2010				clickable: true
2011			},
2012			speed: 400
2013		});
2014	}
2015
2016	function module_contentSlider() {
2017		var OBJ = {
2018			contentSlider: {
2019				slider: $('.content-slider__slider'),
2020				$sliderSlide: [],
2021				imageSlider: $('.content-slider__image-slider')
2022			},
2023			swiper: {
2024				sliderContainer: [],
2025				imageSliderContainer: []
2026			}
2027		};
2028
2029		function slider_createSwiper_and_addEvents() {
2030			function create_$sliderSlide(swiperObj, swiperObjIndex) {
2031				var $swContainer = swiperObj.$swContainer;
2032				var $swSlide = $swContainer.find('> .swiper-wrapper > .swiper-slide');
2033	
2034				// create array
2035				OBJ.contentSlider.$sliderSlide[swiperObjIndex] = [];
2036	
2037				// create jquery for each slide
2038				// add new property (isSvgRunning) to $slide
2039				for (var i=0; i<$swSlide.length; i++) {
2040					var $slide = $($swSlide[i]);
2041					$slide.isSvgRunning = false;
2042					OBJ.contentSlider.$sliderSlide[swiperObjIndex].push($slide);
2043				}
2044			}
2045
2046			function animateRoomDots(swiperObjIndex, $slide, slideIndex) {
2047				if (!$slide.isSvgRunning) {
2048					var graphicTop = $slide.find('.content-slider__graphic-top');
2049					var graphicBottom = $slide.find('.content-slider__graphic-bottom');
2050
2051					// run graphic-top animation
2052					lottie.loadAnimation({
2053						container: graphicTop[0],
2054						renderer: 'svg',
2055						loop: false,
2056						autoplay: true,
2057						path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/room-dots-top-left.json'
2058					});
2059
2060					// run graphic-bottom animation
2061					lottie.loadAnimation({
2062						container: graphicBottom[0],
2063						renderer: 'svg',
2064						loop: false,
2065						autoplay: true,
2066						path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/room-dots-bottom-right.json'
2067					});
2068
2069					// set to true so it won't run again on slide change or on pagination events
2070					OBJ.contentSlider.$sliderSlide[swiperObjIndex][slideIndex].isSvgRunning = true;
2071				}
2072			}
2073
2074			function addEvents_on_slider(swiperObj, swiperObjIndex, $csPaginationItems) {
2075				var $sliderSlide = OBJ.contentSlider.$sliderSlide[swiperObjIndex];
2076
2077				// PAGINATION: ON SLIDE CHANGE EVENT
2078				swiperObj.on('slideChange', function(e) {
2079					var index = this.realIndex;
2080					var $slide = $sliderSlide[index];
2081	
2082					// set to active
2083					$csPaginationItems.removeClass('active');
2084					$csPaginationItems.eq(index).addClass('active');
2085
2086					// lottie room dots animation
2087					animateRoomDots(swiperObjIndex, $slide, index);
2088				});
2089	
2090				// PAGINATION: ONCLICK EVENT
2091				$csPaginationItems.click(function() {
2092					var $this = $(this);
2093					var index = $this.index();
2094					var $slide = $sliderSlide[index];
2095	
2096					// set to active
2097					if (!$this.hasClass('active')) {
2098						$csPaginationItems.removeClass('active');
2099						$this.addClass('active');
2100						swiperObj.slideTo(index);
2101					}
2102
2103					// lottie room dots animation
2104					animateRoomDots(swiperObjIndex, $slide, index);
2105				});
2106
2107				// SET INVIEW EVENT ON FIRST SLIDE
2108				if ($sliderSlide.length > 0) { // make sure slides are not empty
2109					$sliderSlide[0].on('inview', function(event, isInView) {
2110						if (isInView) {
2111							// lottie room dots animation
2112							animateRoomDots(swiperObjIndex, $sliderSlide[0], 0);
2113						}
2114					});
2115				}
2116			}
2117
2118			for (var i=0; i<OBJ.contentSlider.slider.length; i++) {
2119				var $swSlider = $(OBJ.contentSlider.slider[i]);
2120				var $csPaginationItems = $swSlider.closest('.content-slider').find('.content-slider__pagination li');
2121				var $swContainer = $swSlider.find('> .swiper-container');
2122				var $swButtonNext = $swContainer.find('> .swiper-button-next');
2123				var $swButtonPrev = $swContainer.find('> .swiper-button-prev');
2124				var className = 'con-sl-'+i;
2125	
2126				$swButtonNext.addClass(className);
2127				$swButtonPrev.addClass(className);
2128	
2129				OBJ.swiper.sliderContainer.push(
2130					new Swiper($swContainer[0], {
2131						navigation: {
2132							nextEl: '.swiper-button-next.'+className,
2133							prevEl: '.swiper-button-prev.'+className,
2134						},
2135						simulateTouch: false,
2136						speed: 400
2137					})
2138				);
2139
2140				// create $swContainer property inside swiper object
2141				OBJ.swiper.sliderContainer[i].$swContainer = $swContainer;
2142	
2143				// functions
2144				create_$sliderSlide(OBJ.swiper.sliderContainer[i], i);
2145				addEvents_on_slider(OBJ.swiper.sliderContainer[i], i, $csPaginationItems);
2146			}
2147		}
2148
2149		function imageSlider_createSwiper() {
2150			for (var i=0; i<OBJ.contentSlider.imageSlider.length; i++) {
2151				var $swSlider = $(OBJ.contentSlider.imageSlider[i]);
2152				var $swContainer = $swSlider.find('> .swiper-container');
2153				var $swPagination = $swContainer.find('> .swiper-pagination');
2154				var className = 'img-sl-'+i;
2155
2156				$swPagination.addClass(className);
2157
2158				OBJ.swiper.imageSliderContainer.push(
2159					new Swiper($swContainer[0], {
2160						autoplay: {
2161							delay: 2000,
2162						},
2163						pagination: {
2164							el: '.swiper-pagination.'+className,
2165							type: 'bullets',
2166							clickable: true
2167						},
2168						speed: 400
2169					})
2170				);
2171			}
2172		}
2173
2174		SWIPER_addClass_disabled(OBJ.contentSlider.slider);
2175		SWIPER_addClass_disabled(OBJ.contentSlider.imageSlider);
2176		slider_createSwiper_and_addEvents();
2177		imageSlider_createSwiper();
2178	}
2179
2180	function module_contentSliderAcc() {
2181		var OBJ = {
2182			contentSliderAcc: {
2183				el: $('.content-slider-acc'),
2184				imgSlider: $('.content-slider-acc__img-slider')
2185			},
2186			swiper: [],
2187			isSvgRunning: []
2188		};
2189
2190		function imgSlider_createSwiper() {
2191			for (var i=0; i<OBJ.contentSliderAcc.imgSlider.length; i++) {
2192				var $swSlider = $(OBJ.contentSliderAcc.imgSlider[i]);
2193				var $swContainer = $swSlider.find('> .swiper-container');
2194				var $swPagination = $swContainer.find('> .swiper-pagination');
2195				var className = 'con-sl-acc-img-'+i;
2196	
2197				$swPagination.addClass(className);
2198	
2199				OBJ.swiper.push(
2200					new Swiper($swContainer[0], {
2201						autoplay: {
2202							delay: 2000
2203						},
2204						observer: true,
2205						observeParents: true,
2206						pagination: {
2207							el: '.swiper-pagination.'+className,
2208							type: 'bullets',
2209							clickable: true
2210						},
2211						speed: 400
2212					})
2213				);
2214			}
2215		}
2216
2217		function animateRoomDots(blockIndex, $item, itemIndex) {
2218			// error check: set the array if values are undefined
2219			if (typeof OBJ.isSvgRunning[blockIndex] === 'undefined') OBJ.isSvgRunning[blockIndex] = [];
2220			if (typeof OBJ.isSvgRunning[blockIndex][itemIndex] === 'undefined') OBJ.isSvgRunning[blockIndex][itemIndex] = false;
2221
2222			if (!OBJ.isSvgRunning[blockIndex][itemIndex]) {
2223				var graphicBottomSvg = $item.find('.content-slider-acc__graphic-bottom-svg');
2224
2225				// run graphic-bottom animation after slideDown
2226				setTimeout(function() {
2227					lottie.loadAnimation({
2228						container: graphicBottomSvg[0],
2229						renderer: 'svg',
2230						loop: false,
2231						autoplay: true,
2232						path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/room-dots-bottom-right.json'
2233					});
2234				}, 400);
2235
2236				// set to true so it won't run again on accordion slideUp or slideDown
2237				OBJ.isSvgRunning[blockIndex][itemIndex] = true;
2238			}
2239		}
2240
2241		function title_onClick(blockIndex, $title) {
2242			$title.click(function() {
2243				var $this = $(this);
2244				var $item = $this.closest('.content-slider-acc__item');
2245				var $hidden = $item.find('.content-slider-acc__hidden');
2246	
2247				// force stop and start autoplay
2248				// autoplay won't work on init or when opening accordions
2249				for (var i=0; i<OBJ.swiper.length; i++) {
2250					OBJ.swiper[i].autoplay.stop();
2251					OBJ.swiper[i].autoplay.start();
2252				}
2253	
2254				// open accordion
2255				if (!$item.hasClass('active')) {
2256					$item.addClass('active');
2257					$hidden.slideDown();
2258				} else {
2259					$item.removeClass('active');
2260					$hidden.slideUp();
2261				}
2262
2263				// animate Room Dots
2264				animateRoomDots(blockIndex, $item, $item.index());
2265			});
2266		}
2267
2268		SWIPER_addClass_disabled(OBJ.contentSliderAcc.imgSlider);
2269		imgSlider_createSwiper();
2270
2271		for (var i=0; i<OBJ.contentSliderAcc.el.length; i++) {
2272			var $title = $(OBJ.contentSliderAcc.el[i]).find('.content-slider-acc__title');
2273
2274			// have to place them in a function just to save blockIndex than using jQuery index() on every user click
2275			title_onClick(i, $title);
2276		}
2277	}
2278
2279	function module_quoteSlider() {
2280		var OBJ = {
2281			quoteSlider: {
2282				el: $('.quote-slider')
2283			},
2284			swiper: []
2285		};
2286
2287		SWIPER_addClass_disabled(OBJ.quoteSlider.el);
2288
2289		for (var i=0; i<OBJ.quoteSlider.el.length; i++) {
2290			var $swSlider = $(OBJ.quoteSlider.el[i]);
2291			var $swContainer = $swSlider.find('> .swiper-container');
2292			var $swPagination = $swContainer.find('> .swiper-pagination');
2293			var className = 'qt-slider-'+i;
2294
2295			$swPagination.addClass(className);
2296
2297			OBJ.swiper.push(
2298				new Swiper($swContainer[0], {
2299					pagination: {
2300						el: '.swiper-pagination.'+className,
2301						type: 'bullets',
2302						clickable: true
2303					},
2304					speed: 400
2305				})
2306			);
2307		}
2308	}
2309
2310	function module_eventSlider() {
2311		var OBJ = {
2312			eventSlider: {
2313				slider: $('.event-slider__slider'),
2314				slide: $('.event-slider__slide'),
2315				$slide: [],
2316				contentTitle: $('.event-slider__content-title'),
2317				contentInfo: $('.event-slider__content-info'),
2318				contentDescExcerpt: $('.event-slider__content-desc--excerpt'),
2319				contentDescEmphasis: $('.event-slider__content-desc--emphasis'),
2320			},
2321			data: {
2322				windowWidth: 0,
2323				isMobile: false,
2324				isTablet: false,
2325				isPhone: false,
2326				slideGroup2: [],
2327				slideGroup3: [],
2328				lastBreakpoint: 'desktop',
2329				currentBreakpoint: 'desktop',
2330				updateDotdotdot: false
2331			},
2332			swiper: [],
2333			dotdotdot: []
2334		};
2335
2336		var UPDATE = {
2337			eventSlider: {
2338				$slide: function() {
2339					OBJ.eventSlider.$slide = [];
2340
2341					// optimize save all necessary jquery
2342					for (var i=0; i<OBJ.eventSlider.slider.length; i++) {
2343						// create array
2344						// groups all slides of each of the same module found in the page
2345						OBJ.eventSlider.$slide[i] = [];
2346
2347						var $swSlider = $(OBJ.eventSlider.slider[i]);
2348						var $swContainer = $swSlider.find('> .swiper-container');
2349						var $swSlide = $swContainer.find('> .swiper-wrapper > .swiper-slide');
2350
2351						for (var j=0; j<$swSlide.length; j++) {
2352							var $slide = $($swSlide[j]);
2353							var $slideItem = {
2354								$slide: $slide,
2355								$contentTitle: $slide.find('.event-slider__content-title'),
2356								$contentInfo: $slide.find('.event-slider__content-info'),
2357								$contentDescExcerpt: $slide.find('.event-slider__content-desc--excerpt'),
2358								$contentDescEmphasis: $slide.find('.event-slider__content-desc--emphasis'),
2359							};
2360							OBJ.eventSlider.$slide[i].push($slideItem);
2361						}
2362					}
2363				}
2364			},
2365			data: {
2366				windowWidth: function() {
2367					OBJ.data.windowWidth = $window.width();
2368				},
2369				isMobile: function() {
2370					OBJ.data.isMobile = (OBJ.data.windowWidth <= 1024);
2371				},
2372				isTablet: function() {
2373					OBJ.data.isTablet = (OBJ.data.windowWidth <= 1024 && OBJ.data.windowWidth >= 768);
2374				},
2375				isPhone: function() {
2376					OBJ.data.isPhone = (OBJ.data.windowWidth <= 767);
2377				},
2378				currentBreakpoint: function() {
2379					if (OBJ.data.isTablet) OBJ.data.currentBreakpoint = 'tablet';
2380					else if (OBJ.data.isPhone) OBJ.data.currentBreakpoint = 'phone';
2381					else OBJ.data.currentBreakpoint = 'desktop';
2382				},
2383				lastBreakpoint: function() {
2384					OBJ.data.lastBreakpoint = OBJ.data.currentBreakpoint;
2385				},
2386				updateDotdotdot: function() {
2387					// update Dotdotdot if currentBreakpoint and lastBreakpoint are not matching
2388					// prevents calling Dotdotdot function again on every resize
2389					OBJ.data.updateDotdotdot = (OBJ.data.currentBreakpoint !== OBJ.data.lastBreakpoint);
2390				}
2391			}
2392		};
2393
2394		function groupSlidesTo(num) {
2395			var slideGroup = [];
2396
2397			// for each of the same module (x)
2398			// loop all slides found in the page (y)
2399			// and place each slide (indexItem) by group (slideGroup|indexGroup)
2400
2401			for (var x=0; x<OBJ.eventSlider.$slide.length; x++) {
2402				var countSlides = OBJ.eventSlider.$slide[x].length;
2403				var isDivisible = (countSlides % num === 0);
2404				var indexGroup = 0;
2405				var indexItem = 0;
2406
2407				// create module group in slideGroup
2408				if (typeof slideGroup[x] === 'undefined') slideGroup[x] = [];
2409
2410				// get each $slideItem and place them to their respective group (slideGroup)
2411				for (var y=0; y<countSlides; y++) {
2412
2413					// create slide group in module group
2414					if (typeof slideGroup[x][indexGroup] === 'undefined') slideGroup[x][indexGroup] = [];
2415
2416					// add $slideItem to slide group
2417					slideGroup[x][indexGroup][indexItem] = OBJ.eventSlider.$slide[x][y];
2418
2419					// increment to move to next item
2420					// will be used for next instruction
2421					indexItem++;
2422
2423					// if: group is uneven, place the last group to the current group
2424					if (
2425						!isDivisible &&
2426						(countSlides % num >= (countSlides - (y+1))) // check if we're on the last slide group
2427					) {
2428						// do nothing continue on adding slides to this group
2429					} else if (indexItem > num-1) { // this group is now full, move to the next group
2430						indexGroup++;
2431						indexItem = 0;
2432					}
2433				}
2434			}
2435			
2436			return slideGroup;
2437		}
2438
2439		function equalizeSlideHeight() {
2440			function loop($slide) {
2441				var names = [
2442					'slide'
2443					// 'contentTitle',
2444					// 'contentInfo',
2445					// 'contentDescExcerpt',
2446					// 'contentDescEmphasis',
2447				];
2448		
2449				var maxHeights = {
2450					slide: 0,
2451					contentTitle: 0,
2452					contentInfo: 0,
2453					contentDescExcerpt: 0,
2454					contentDescEmphasis: 0
2455				};
2456		
2457				var heights = {
2458					slide: 0,
2459					contentTitle: 0,
2460					contentInfo: 0,
2461					contentDescExcerpt: 0,
2462					contentDescEmphasis: 0
2463				};
2464		
2465				// content: get max height of all slides
2466				for (var x=0; x<$slide.length; x++) {
2467					var $slideItem = $slide[x];
2468		
2469					for (var y=0; y<names.length; y++) {
2470						var name = names[y];
2471						heights[name] = $slideItem['$'+name].height();
2472						
2473						if (maxHeights[name] < heights[name]) maxHeights[name] = heights[name];
2474					}
2475				}
2476		
2477				// content: use max height and apply accordingly
2478				for (var x=0; x<$slide.length; x++) {
2479					var $slideItem = $slide[x];
2480		
2481					for (var y=0; y<names.length; y++) {
2482						var name = names[y];
2483						heights[name] = $slideItem['$'+name].height();
2484		
2485						if (maxHeights[name] > heights[name]) $slideItem['$'+name].css('height', maxHeights[name]);
2486					}
2487				}
2488			}
2489
2490			// execute
2491			for (var i=0; i<OBJ.eventSlider.$slide.length; i++) {
2492				loop(OBJ.eventSlider.$slide[i]);
2493			}
2494		}
2495
2496		function equalizeSlideHeight_unset() {
2497			OBJ.eventSlider.slide.css('height', '');
2498			// OBJ.eventSlider.contentTitle.css('height', '');
2499			// OBJ.eventSlider.contentInfo.css('height', '');
2500			// OBJ.eventSlider.contentDescExcerpt.css('height', '');
2501			// OBJ.eventSlider.contentDescEmphasis.css('height', '');
2502		}
2503
2504		function createSwiper() {
2505			for (var i=0; i<OBJ.eventSlider.slider.length; i++) {
2506				var $swSlider = $(OBJ.eventSlider.slider[i]);
2507				var $swContainer = $swSlider.find('> .swiper-container');
2508				var $swButtonNext = $swSlider.find('> .swiper-button-next');
2509				var $swButtonPrev = $swSlider.find('> .swiper-button-prev');
2510				var className = 'evt-slider-'+i;
2511	
2512				$swButtonNext.addClass(className);
2513				$swButtonPrev.addClass(className);
2514	
2515				OBJ.swiper.push(
2516					new Swiper($swContainer[0], {
2517						autoHeight: true,
2518						slidesPerView: 3,
2519						slidesPerGroup: 3,
2520						spaceBetween: ($swSlider.closest('.event-slider').hasClass('event-slider--theme-journal')) ? 40 : 60,
2521						navigation: {
2522							nextEl: '.swiper-button-next.'+className,
2523							prevEl: '.swiper-button-prev.'+className,
2524						},
2525						speed: 400,
2526						updateOnWindowResize: true,
2527						breakpoints: {
2528							768: {
2529								slidesPerView: 1,
2530								slidesPerGroup: 1,
2531								spaceBetween: 20,
2532							},
2533							1024: {
2534								slidesPerView: 2,
2535								slidesPerGroup: 2,
2536								spaceBetween: 40,
2537							},
2538						}
2539					})
2540				);
2541			}
2542	
2543			SWIPER_addClass_disabled(OBJ.eventSlider.slider, [3,2,1], [1024,767]);
2544		}
2545
2546		function updateSwiperAutoHeight() {
2547			for (var i=0; i<OBJ.swiper.length; i++) {
2548				OBJ.swiper[i].updateAutoHeight();
2549			}
2550		}
2551
2552		function createDotdotdot() {
2553			OBJ.dotdotdot = []; // force clear
2554
2555			for (var i=0; i<OBJ.eventSlider.contentDescExcerpt.length; i++) {
2556				OBJ.dotdotdot.push(new Dotdotdot(OBJ.eventSlider.contentDescExcerpt[i], {
2557					height: (!OBJ.data.isMobile) ? 150 : 80,
2558					keep: '.read-more'
2559				}))
2560			}
2561		}
2562
2563		function destroyDotdotdot() {
2564			for (var i=0; i<OBJ.dotdotdot.length; i++) {
2565				var item = OBJ.dotdotdot[i];
2566				item.API.destroy();
2567			}
2568
2569			OBJ.dotdotdot = []; // clear
2570		}
2571
2572		$window.on('load', function() {
2573			UPDATE.data.windowWidth();
2574			UPDATE.data.isMobile();
2575			UPDATE.data.isTablet();
2576			UPDATE.data.isPhone();
2577			UPDATE.data.currentBreakpoint();
2578			UPDATE.data.lastBreakpoint();
2579
2580			UPDATE.eventSlider.$slide();
2581			// OBJ.data.slideGroup2 = groupSlidesTo(2);
2582			// OBJ.data.slideGroup3 = groupSlidesTo(3);
2583
2584			createSwiper();
2585			createDotdotdot();
2586
2587			// setTimeout: equalizeSlideHeight not getting correct height FIX
2588			for (var i=0; i<5; i++) {
2589				setTimeout(function() {
2590					equalizeSlideHeight_unset();
2591					equalizeSlideHeight();
2592					updateSwiperAutoHeight();
2593				}, i*200);
2594			}
2595		});
2596
2597		$window.on('resize', function() {
2598			UPDATE.data.windowWidth();
2599			UPDATE.data.isMobile();
2600			UPDATE.data.isTablet();
2601			UPDATE.data.isPhone();
2602			UPDATE.data.currentBreakpoint();
2603			UPDATE.data.updateDotdotdot();
2604
2605			SWIPER_addClass_disabled(OBJ.eventSlider.slider, [3,1]);
2606
2607			if (OBJ.data.updateDotdotdot) {
2608				destroyDotdotdot();
2609				createDotdotdot();
2610			}
2611
2612			for (var i=0; i<5; i++) {
2613				setTimeout(function() {
2614					equalizeSlideHeight_unset();
2615					equalizeSlideHeight();
2616					updateSwiperAutoHeight();
2617				}, i*200);
2618			}
2619
2620			UPDATE.data.lastBreakpoint();
2621		});
2622	}
2623
2624	function module_instagramRow() {
2625		var OBJ = {
2626			instagram: {
2627				slider: $('.instagram__slider')
2628			},
2629			swiper: []
2630		}
2631
2632		for (var i=0; i<OBJ.instagram.slider.length; i++) {
2633			var $swSlider = $(OBJ.instagram.slider[i]);
2634			var $swContainer = $swSlider.find('> .swiper-container');
2635
2636			OBJ.swiper.push(
2637				new Swiper($swContainer[0], {
2638					slidesPerView: 4,
2639					spaceBetween: 0,
2640					speed: 400,
2641					freeMode: true,
2642					breakpoints: {
2643						767: {
2644							slidesPerView: 2,
2645							spaceBetween: 0
2646						},
2647						480: {
2648							slidesPerView: 1.25
2649						}
2650					}
2651				})
2652			);
2653		}
2654
2655		SWIPER_addClass_disabled(OBJ.instagram.slider, [4,2,1], [767,480]);
2656
2657		$window.on('resize', function() {
2658			SWIPER_addClass_disabled(OBJ.instagram.slider, [4,2,1], [767,480]);
2659		});
2660	}
2661
2662	function module_colContent() {
2663		var OBJ = {
2664			colContent: {
2665				row: $('.col-content__row'),
2666				slide: $('.col-content__slide'),
2667				$slide: [],
2668				contentDesc: $('.col-content__content-desc'),
2669				contentDescText: $('.col-content__content-desc-text'),
2670			},
2671			data: {
2672				windowWidth: 0,
2673				is568Down: false,
2674				isMobile: false,
2675				lastBreakpoint: 'desktop',
2676				currentBreakpoint: 'desktop',
2677				updateSwiper: false,
2678				updateDotdotdot: false
2679			},
2680			swiper: [],
2681			dotdotdot: []
2682		};
2683	
2684		var UPDATE = {
2685			colContent: {
2686				$slide: function() {
2687					OBJ.colContent.$slide = [];
2688
2689					// optimize save all necessary jquery
2690					for (var i=0; i<OBJ.colContent.row.length; i++) {
2691						// create array
2692						// groups all slides of each of the same module found in the page
2693						OBJ.colContent.$slide[i] = [];
2694	
2695						var $swSlider = $(OBJ.colContent.row[i]);
2696						var $swContainer = $swSlider.find('> .swiper-container');
2697						var $swSlide = $swContainer.find('> .swiper-wrapper > .swiper-slide');
2698	
2699						for (var j=0; j<$swSlide.length; j++) {
2700							var $slide = $($swSlide[j]);
2701							var $slideItem = {
2702								$slide: $slide,
2703								$contentImg: $slide.find('.col-content__content-img'),
2704								$contentImgMobile: $slide.find('.col-content__content-img-mobile'),
2705								$contentTitle: $slide.find('.col-content__content-title'),
2706								$contentDesc: $slide.find('.col-content__content-desc'),
2707							};
2708							OBJ.colContent.$slide[i].push($slideItem);
2709						}
2710					}
2711				}
2712			},
2713			data: {
2714				windowWidth: function() {
2715					OBJ.data.windowWidth = $window.width();
2716				},
2717				isMobile: function() {
2718					OBJ.data.isMobile = (OBJ.data.windowWidth <= 1024);
2719				},
2720				is568Down: function() {
2721					OBJ.data.is568Down = (OBJ.data.windowWidth <= 568);
2722				},
2723				currentBreakpoint: function() {
2724					OBJ.data.currentBreakpoint = (OBJ.data.isMobile) ? 'mobile' : 'desktop';
2725				},
2726				lastBreakpoint: function() {
2727					OBJ.data.lastBreakpoint = OBJ.data.currentBreakpoint;
2728				},
2729				updateSwiper: function() {
2730					// update swiper if currentBreakpoint and lastBreakpoint are not matching
2731					// prevents calling swiper function again on every resize
2732					OBJ.data.updateSwiper = (OBJ.data.currentBreakpoint !== OBJ.data.lastBreakpoint);
2733				},
2734				updateDotdotdot: function() {
2735					// update dotdotdot if currentBreakpoint and lastBreakpoint are not matching
2736					// prevents calling dotdotdot function again on every resize
2737					OBJ.data.updateDotdotdot = (OBJ.data.currentBreakpoint !== OBJ.data.lastBreakpoint);
2738				}
2739			}
2740		};
2741
2742		function equalizeSlideHeight() {
2743			// reset
2744			OBJ.colContent.slide.find('.col-content__content-img').css('margin-top', '');
2745			OBJ.colContent.slide.find('.col-content__content-img-mobile').css('margin-top', '');
2746			OBJ.colContent.slide.find('.col-content__content-title').css('height', '');
2747			OBJ.colContent.slide.find('.col-content__content-desc').css('height', '');
2748
2749			for (var i=0; i<OBJ.colContent.$slide.length; i++) {
2750				var $slide = OBJ.colContent.$slide[i];
2751				var maxContentImg_height = 0;
2752				var maxContentImgMobile_height = 0;
2753				var maxContentTitle_height = 0;
2754				var maxContentDesc_height = 0;
2755
2756				// get max height of all slides
2757				for (var j=0; j<$slide.length; j++) {
2758					var $slideItem = $slide[j];
2759
2760					var contentImg_height = $slideItem.$contentImg.height();
2761					var contentImgMobile_height = $slideItem.$contentImgMobile.height();
2762					var contentTitle_height = $slideItem.$contentTitle.height();
2763					var contentDesc_height = $slideItem.$contentDesc.height();
2764
2765					if (maxContentImg_height < contentImg_height) maxContentImg_height = contentImg_height;
2766					if (maxContentImgMobile_height < contentImgMobile_height) maxContentImgMobile_height = contentImgMobile_height;
2767					if (maxContentTitle_height < contentTitle_height) maxContentTitle_height = contentTitle_height;
2768					if (maxContentDesc_height < contentDesc_height) maxContentDesc_height = contentDesc_height;
2769				}
2770
2771				// use max height and apply accordingly
2772				for (var j=0; j<$slide.length; j++) {
2773					var $slideItem = $slide[j];
2774
2775					var contentImg_height = $slideItem.$contentImg.height();
2776					var contentImgMobile_height = $slideItem.$contentImgMobile.height();
2777					var contentTitle_height = $slideItem.$contentTitle.height();
2778					var contentDesc_height = $slideItem.$contentDesc.height();
2779
2780					if (maxContentImg_height > contentImg_height) $slideItem.$contentImg.css('margin-top', maxContentImg_height - contentImg_height);
2781					if (maxContentImgMobile_height > contentImgMobile_height) $slideItem.$contentImgMobile.css('margin-top', maxContentImgMobile_height - contentImgMobile_height);
2782					if (maxContentTitle_height > contentTitle_height) $slideItem.$contentTitle.css('height', maxContentTitle_height);
2783					if (maxContentDesc_height > contentDesc_height) $slideItem.$contentDesc.css('height', maxContentDesc_height);
2784				}
2785			}
2786		}
2787	
2788		function createSwiper() {
2789			OBJ.swiper = []; // force clear
2790
2791			for (var i=0; i<OBJ.colContent.row.length; i++) {
2792				var $swSlider = $(OBJ.colContent.row[i]);
2793				var $swContainer = $swSlider.find('> .swiper-container');
2794				var $swPagination = $swContainer.find('> .swiper-pagination');
2795				var className = 'clc-slider-'+i;
2796	
2797				var $swSlide = $swContainer.find('> .swiper-wrapper > .swiper-slide');
2798		
2799				$swPagination.addClass(className);
2800		
2801				var swiperObj = new Swiper($swContainer[0], {
2802					slidesPerView: 'auto',
2803					centeredSlides: true,
2804					spaceBetween: 0,
2805					speed: 400,
2806					autoplay: {
2807						delay: 2000
2808					},
2809					pagination: {
2810						el: '.swiper-pagination.'+className,
2811						type: 'bullets',
2812						clickable: true
2813					},
2814					breakpoints: {
2815						1024: {
2816							spaceBetween: 40
2817						}
2818					}
2819				});
2820		
2821				swiperObj.className = className;
2822		
2823				OBJ.swiper.push(swiperObj);
2824			}
2825		}
2826	
2827		function destroySwiper() {
2828			for (var i=0; i<OBJ.swiper.length; i++) {
2829				var swiperObj = OBJ.swiper[i];
2830				var $swContainer = $(swiperObj.$el[0]);
2831				var $swPagination = $swContainer.find('> .swiper-pagination');
2832	
2833				// remove swiper className from pagination
2834				$swPagination.removeClass(swiperObj.className);
2835	
2836				// destory swiper
2837				swiperObj.destroy();
2838			}
2839	
2840			// clean out OBJ.swiper
2841			OBJ.swiper = [];
2842		}
2843	
2844		function createDotdotdot() {
2845			for (var i=0; i<OBJ.colContent.contentDescText.length; i++) {
2846				OBJ.dotdotdot.push(new Dotdotdot(OBJ.colContent.contentDescText[i], {
2847					height: (OBJ.data.is568Down) ? 100 : 120
2848				}))
2849			}
2850		}
2851	
2852		function restoreDotdotdot() {
2853			for (var i=0; i<OBJ.dotdotdot.length; i++) {
2854				var item = OBJ.dotdotdot[i];
2855				item.API.restore();
2856			}
2857		}
2858	
2859		function truncateDotdotdot() {
2860			for (var i=0; i<OBJ.dotdotdot.length; i++) {
2861				var item = OBJ.dotdotdot[i];
2862
2863				// change dotdotdot height if breakpoint is 568px down else up
2864				if (OBJ.data.is568Down) item.maxHeight = item.options.height = 100;
2865				else item.maxHeight = item.options.height = 130;
2866
2867				// truncate
2868				item.API.truncate();
2869			}
2870		}
2871	
2872		UPDATE.data.windowWidth();
2873		UPDATE.data.isMobile();
2874		UPDATE.data.is568Down();
2875		UPDATE.data.currentBreakpoint();
2876		UPDATE.data.lastBreakpoint();
2877		UPDATE.data.updateSwiper();
2878		UPDATE.data.updateDotdotdot();
2879	
2880		SWIPER_addClass_disabled(OBJ.colContent.row, [3,1], [1024]);
2881		createDotdotdot();
2882		createSwiper();
2883
2884		UPDATE.colContent.$slide();
2885		equalizeSlideHeight();
2886
2887		$window.on('resize', function() {
2888			UPDATE.data.windowWidth();
2889			UPDATE.data.isMobile();
2890			UPDATE.data.is568Down();
2891			UPDATE.data.currentBreakpoint();
2892			UPDATE.data.updateSwiper();
2893			UPDATE.data.updateDotdotdot();
2894
2895			SWIPER_addClass_disabled(OBJ.colContent.row, [3,1], [1024]);
2896			equalizeSlideHeight();
2897
2898			// DOTDOTDOT
2899			if (OBJ.data.isMobile) {
2900				restoreDotdotdot();
2901				truncateDotdotdot();
2902			} else {
2903				if (OBJ.data.updateDotdotdot) {
2904					restoreDotdotdot();
2905				}
2906			}
2907
2908			UPDATE.data.lastBreakpoint();
2909		});
2910	}
2911
2912	function module_altPhotoCon() {
2913		var OBJ = {
2914			altPhotoCon: {
2915				el: $('.alt-photocon'),
2916				float: {},
2917				row1: {
2918					swiper: []
2919				},
2920				row2: {
2921					swiper: []
2922				}
2923			},
2924			data: {
2925				windowWidth: 0,
2926				isMobile: false,
2927				isTablet: false,
2928				isPhone: false,
2929				lastBreakpoint: 'desktop',
2930				currentBreakpoint: 'desktop',
2931				createSwiper: false
2932			}
2933		};
2934	
2935		var UPDATE = {
2936			data: {
2937				windowWidth: function() {
2938					OBJ.data.windowWidth = $window.width();
2939				},
2940				isMobile: function() {
2941					OBJ.data.isMobile = (OBJ.data.windowWidth <= 1024);
2942				},
2943				isTablet: function() {
2944					OBJ.data.isTablet = (OBJ.data.windowWidth <= 1024 && OBJ.data.windowWidth >= 768);
2945				},
2946				isPhone: function() {
2947					OBJ.data.isPhone = (OBJ.data.windowWidth <= 767);
2948				},
2949				lastBreakpoint: function() {
2950					OBJ.data.lastBreakpoint = OBJ.data.currentBreakpoint;
2951				},
2952				currentBreakpoint: function() {
2953					OBJ.data.currentBreakpoint = (OBJ.data.isMobile) ? 'mobile' : 'desktop';
2954				},
2955				createSwiper: function() {
2956					// update swiper if currentBreakpoint and lastBreakpoint does not match
2957					// prevents calling swiper function again on every resize
2958					OBJ.data.createSwiper = (OBJ.data.currentBreakpoint !== OBJ.data.lastBreakpoint);
2959				}
2960			}
2961		};
2962	
2963		// optimize: get jQuery objects ready
2964		if (OBJ.altPhotoCon.el.length > 0) {
2965			OBJ.altPhotoCon.float.el = $('.alt-photocon__float');
2966			OBJ.altPhotoCon.row1.el = $('.alt-photocon__row--1');
2967			OBJ.altPhotoCon.row2.el = $('.alt-photocon__row--2');
2968	
2969			OBJ.altPhotoCon.float['1'] = $('.alt-photocon__float--1');
2970			OBJ.altPhotoCon.float['2'] = $('.alt-photocon__float--2');
2971			OBJ.altPhotoCon.float['3'] = $('.alt-photocon__float--3');
2972			OBJ.altPhotoCon.float['4'] = $('.alt-photocon__float--4');
2973	
2974			OBJ.altPhotoCon.row1.contentBox = OBJ.altPhotoCon.row1.el.find('.alt-photocon__contentbox');
2975			OBJ.altPhotoCon.row1.mediaSlider = OBJ.altPhotoCon.row1.el.find('.alt-photocon__media-slider');
2976			OBJ.altPhotoCon.row1.mediaSlide1 = OBJ.altPhotoCon.row1.mediaSlider.find('.alt-photocon__media-slide--1');
2977			OBJ.altPhotoCon.row1.mediaSlide2 = OBJ.altPhotoCon.row1.mediaSlider.find('.alt-photocon__media-slide--2');
2978			OBJ.altPhotoCon.row1.mediaSlideWrap1 = OBJ.altPhotoCon.row1.mediaSlide1.find('.alt-photocon__media-slide-wrap');
2979			OBJ.altPhotoCon.row1.mediaSlideWrap2 = OBJ.altPhotoCon.row1.mediaSlide2.find('.alt-photocon__media-slide-wrap');
2980	
2981			OBJ.altPhotoCon.row2.contentBox = OBJ.altPhotoCon.row2.el.find('.alt-photocon__contentbox');
2982			OBJ.altPhotoCon.row2.mediaSlider = OBJ.altPhotoCon.row2.el.find('.alt-photocon__media-slider');
2983			OBJ.altPhotoCon.row2.mediaSlide1 = OBJ.altPhotoCon.row2.mediaSlider.find('.alt-photocon__media-slide--1');
2984			OBJ.altPhotoCon.row2.mediaSlide2 = OBJ.altPhotoCon.row2.mediaSlider.find('.alt-photocon__media-slide--2');
2985			OBJ.altPhotoCon.row2.mediaSlideWrap1 = OBJ.altPhotoCon.row2.mediaSlide1.find('.alt-photocon__media-slide-wrap');
2986			OBJ.altPhotoCon.row2.mediaSlideWrap2 = OBJ.altPhotoCon.row2.mediaSlide2.find('.alt-photocon__media-slide-wrap');
2987		}
2988	
2989		function float_adjustPosition() {
2990			// reset
2991			OBJ.altPhotoCon.float.el.css('top', '');
2992	
2993			// vars
2994			var cssTop = 0;
2995			var block_offset = OBJ.altPhotoCon.el.offset();
2996	
2997			var float2 = OBJ.altPhotoCon.float['2'];
2998			var float3 = OBJ.altPhotoCon.float['3'];
2999			var float4 = OBJ.altPhotoCon.float['4'];
3000	
3001			var row1_mediaSlideWrap1_offset = OBJ.altPhotoCon.row1.mediaSlideWrap1.offset();
3002			var row1_mediaSlideWrap1_height = OBJ.altPhotoCon.row1.mediaSlideWrap1.height();
3003	
3004			var row2_mediaSlideWrap1_offset = OBJ.altPhotoCon.row2.mediaSlideWrap1.offset();
3005			var row2_mediaSlideWrap1_height = OBJ.altPhotoCon.row2.mediaSlideWrap1.height();
3006	
3007			var row2_mediaSlideWrap2_offset = OBJ.altPhotoCon.row2.mediaSlideWrap2.offset();
3008	
3009			// if: desktop
3010			// else: mobile
3011			if (!OBJ.data.isMobile) {
3012	
3013				// set float2 position
3014				cssTop = row1_mediaSlideWrap1_offset.top + row1_mediaSlideWrap1_height - (float2.height()*.4) - block_offset.top;
3015				float2.css('top', cssTop);
3016		
3017				// set float3 position
3018				cssTop = row2_mediaSlideWrap1_offset.top + row2_mediaSlideWrap1_height - (float3.height()*.25) - block_offset.top;
3019				float3.css('top', cssTop);
3020		
3021				// set float4 position
3022				cssTop = row2_mediaSlideWrap2_offset.top - (float4.height()*.7) - block_offset.top;
3023				float4.css('top', cssTop);
3024	
3025			} else {
3026
3027				// if: tablet
3028				// else: phone
3029				if (OBJ.data.isTablet) {
3030
3031					// set float4 position
3032					cssTop = row2_mediaSlideWrap1_offset.top - (float4.height()*1.4) - block_offset.top;
3033					float4.css('top', cssTop);
3034
3035				} else {
3036
3037					// set float4 position
3038					cssTop = row2_mediaSlideWrap1_offset.top - (float4.height()*1.7) - block_offset.top;
3039					float4.css('top', cssTop);
3040
3041				}
3042
3043			}
3044		}
3045	
3046		function row1_adjustContentBox() {
3047			// reset
3048			OBJ.altPhotoCon.row1.contentBox.css('height', '');
3049			OBJ.altPhotoCon.row1.mediaSlide1.css('margin-bottom', '');
3050	
3051			// vars
3052			var row1_contentBox_height = OBJ.altPhotoCon.row1.contentBox.height();
3053			var row1_mediaSlideWrap1_height = OBJ.altPhotoCon.row1.mediaSlideWrap1.height();
3054	
3055			// if: add img height to contentbox to align it with img
3056			// else: contentbox is taller than img, add margin-bottom to parent of img based on height differences
3057			if (row1_contentBox_height < row1_mediaSlideWrap1_height) OBJ.altPhotoCon.row1.contentBox.css('height', row1_mediaSlideWrap1_height);
3058			else OBJ.altPhotoCon.row1.mediaSlide1.css('margin-bottom', (row1_contentBox_height - row1_mediaSlideWrap1_height));
3059		}
3060
3061		function row2_adjustContentBox() {
3062			// reset
3063			OBJ.altPhotoCon.row2.contentBox.css('height', '').css('top', '');
3064			OBJ.altPhotoCon.row1.el.css('margin-bottom', '');
3065	
3066			// vars
3067			var row2_contentBox_height = OBJ.altPhotoCon.row2.contentBox.height();
3068			var row2_contentBox_offset = OBJ.altPhotoCon.row2.contentBox.offset();
3069			var row1_mediaSlide1_marginBottom = parseInt(OBJ.altPhotoCon.row1.mediaSlide1.css('margin-bottom').replace('px', ''));
3070			var row1_mediaSlideWrap1_height = OBJ.altPhotoCon.row1.mediaSlideWrap1.height();
3071			var row1_mediaSlideWrap1_offset = OBJ.altPhotoCon.row1.mediaSlideWrap1.offset();
3072			var row1_mediaSlideWrap2_height = OBJ.altPhotoCon.row1.mediaSlideWrap2.height();
3073			var cssPositionTop = (row1_mediaSlideWrap1_offset.top + row1_mediaSlideWrap1_height) - row2_contentBox_offset.top;
3074	
3075			// if: add img height to contentbox to align contentbox with img
3076			// else: contentbox is taller than img, add margin-bottom to row1 based on height differences. Also add cssPositionTop based on height differences.
3077			if (row2_contentBox_height < row1_mediaSlideWrap2_height) {
3078				OBJ.altPhotoCon.row2.contentBox.css('height', row1_mediaSlideWrap2_height);
3079			} else {
3080				OBJ.altPhotoCon.row1.el.css('margin-bottom', (row2_contentBox_height - row1_mediaSlideWrap2_height));
3081				cssPositionTop = cssPositionTop - (row2_contentBox_height - row1_mediaSlideWrap2_height);
3082			}
3083	
3084			// stack row1_mediaSlideWrap1 margin-bottom to cssPositionTop
3085			// keep row2_contentBox aligned properly
3086			cssPositionTop = cssPositionTop + row1_mediaSlide1_marginBottom;
3087	
3088			// stack cssPositionTop to row2.contentBox
3089			// keep row2_contentBox aligned properly
3090			OBJ.altPhotoCon.row2.contentBox.css('top', cssPositionTop);
3091		}
3092	
3093		function row1_createSwiper() {
3094			OBJ.altPhotoCon.row1.swiper = []; // force clear
3095	
3096			for (var i=0; i<OBJ.altPhotoCon.row1.mediaSlider.length; i++) {
3097				var $swSlider = $(OBJ.altPhotoCon.row1.mediaSlider[i]);
3098				var $swContainer = $swSlider.find('> .swiper-container');
3099				var $swPagination = $swContainer.find('> .swiper-pagination');
3100				var className = 'apc-sl-rw1-'+i;
3101	
3102				$swPagination.addClass(className);
3103	
3104				OBJ.altPhotoCon.row1.swiper.push(
3105					new Swiper($swContainer[0], {
3106						slidesPerView: 'auto',
3107						spaceBetween: 0,
3108						speed: 400,
3109						freeMode: true,
3110						autoplay: {
3111							delay: 2000
3112						},
3113						pagination: {
3114							el: '.swiper-pagination.'+className,
3115							type: 'bullets',
3116							clickable: true
3117						}
3118					})
3119				);
3120			}
3121		}
3122	
3123		function row2_createSwiper() {
3124			OBJ.altPhotoCon.row2.swiper = []; // force clear
3125	
3126			for (var i=0; i<OBJ.altPhotoCon.row2.mediaSlider.length; i++) {
3127				var $swSlider = $(OBJ.altPhotoCon.row2.mediaSlider[i]);
3128				var $swContainer = $swSlider.find('> .swiper-container');
3129				var $swPagination = $swContainer.find('> .swiper-pagination');
3130				var className = 'apc-sl-rw2-'+i;
3131	
3132				$swPagination.addClass(className);
3133	
3134				OBJ.altPhotoCon.row2.swiper.push(
3135					new Swiper($swContainer[0], {
3136						slidesPerView: 'auto',
3137						spaceBetween: 0,
3138						speed: 400,
3139						freeMode: true,
3140						autoplay: {
3141							delay: 2000,
3142						},
3143						pagination: {
3144							el: '.swiper-pagination.'+className,
3145							type: 'bullets',
3146							clickable: true
3147						}
3148					})
3149				);
3150			}
3151		}
3152
3153		function row1_destroySwiper() {
3154			for (var i=0; i<OBJ.altPhotoCon.row1.swiper.length; i++) {
3155				OBJ.altPhotoCon.row1.swiper[i].destroy();
3156			}
3157		}
3158
3159		// EXECUTE
3160
3161		// if: check all requirements are met
3162		// else: hide or don't execute this section
3163		if (
3164			OBJ.altPhotoCon.el.length > 0 &&
3165			OBJ.altPhotoCon.row1.el.length > 0 &&
3166			OBJ.altPhotoCon.row1.mediaSlideWrap1.length > 0 &&
3167			OBJ.altPhotoCon.row1.mediaSlideWrap2.length > 0 &&
3168			OBJ.altPhotoCon.row2.el.length > 0 &&
3169			OBJ.altPhotoCon.row2.mediaSlideWrap1.length > 0 &&
3170			OBJ.altPhotoCon.row2.mediaSlideWrap2.length > 0
3171		) {
3172			// DOM READY
3173			UPDATE.data.windowWidth();
3174			UPDATE.data.isMobile();
3175			UPDATE.data.isTablet();
3176			UPDATE.data.currentBreakpoint();
3177			UPDATE.data.lastBreakpoint();
3178			UPDATE.data.createSwiper();
3179
3180			float_adjustPosition();
3181
3182			SWIPER_addClass_disabled(OBJ.altPhotoCon.row1.mediaSlider, [100,2,2,1], [1024,767,374]);
3183			SWIPER_addClass_disabled(OBJ.altPhotoCon.row2.mediaSlider, [100,2,2,1], [1024,767,374]);
3184
3185			row2_createSwiper();
3186
3187			// if: desktop
3188			// else: mobile
3189			if (!OBJ.data.isMobile) {
3190				row1_adjustContentBox();
3191				row2_adjustContentBox();
3192			} else {
3193				row1_createSwiper();
3194			}
3195
3196			// WINDOW RESIZE
3197			$window.on('resize', function() {
3198				UPDATE.data.windowWidth();
3199				UPDATE.data.isMobile();
3200				UPDATE.data.isTablet();
3201				UPDATE.data.currentBreakpoint();
3202				UPDATE.data.createSwiper();
3203
3204				float_adjustPosition();
3205
3206				SWIPER_addClass_disabled(OBJ.altPhotoCon.row1.mediaSlider, [100,2,2,1], [1024,767,374]);
3207				SWIPER_addClass_disabled(OBJ.altPhotoCon.row2.mediaSlider, [100,2,2,1], [1024,767,374]);
3208
3209				// if: desktop
3210				// else: mobile
3211				if (!OBJ.data.isMobile) {
3212
3213					row1_adjustContentBox();
3214					row2_adjustContentBox();
3215
3216					if (OBJ.data.createSwiper) {
3217						row1_destroySwiper();
3218					}
3219
3220				} else {
3221
3222					// row1_adjustContentBox reset
3223					OBJ.altPhotoCon.row1.contentBox.css('height', '');
3224					OBJ.altPhotoCon.row1.mediaSlide1.css('margin-bottom', '');
3225
3226					// row2_adjustContentBox reset
3227					OBJ.altPhotoCon.row2.contentBox.css('height', '').css('top', '');
3228					OBJ.altPhotoCon.row1.el.css('margin-bottom', '');
3229
3230					if (OBJ.data.createSwiper) {
3231						row1_createSwiper();
3232					}
3233				}
3234
3235				UPDATE.data.lastBreakpoint();
3236			});
3237		} else {
3238
3239			if (OBJ.altPhotoCon.el.length > 0) {
3240				OBJ.altPhotoCon.el.css('display', 'none');
3241
3242				if (!OBJ.altPhotoCon.el.length > 0) console.log('altPhotoCon: el is missing');
3243				if (!OBJ.altPhotoCon.row1.el.length > 0) console.log('altPhotoCon: row1.el is missing');
3244				if (!OBJ.altPhotoCon.row1.mediaSlideWrap1.length > 0) console.log('altPhotoCon: row1.mediaSlideWrap1 is missing');
3245				if (!OBJ.altPhotoCon.row1.mediaSlideWrap2.length > 0) console.log('altPhotoCon: row1.mediaSlideWrap2 is missing');
3246				if (!OBJ.altPhotoCon.row2.el.length > 0) console.log('altPhotoCon: row2.el is missing');
3247				if (!OBJ.altPhotoCon.row2.mediaSlideWrap1.length > 0) console.log('altPhotoCon: row2.mediaSlideWrap1 is missing');
3248				if (!OBJ.altPhotoCon.row2.mediaSlideWrap2.length > 0) console.log('altPhotoCon: row2.mediaSlideWrap2 is missing');
3249			}
3250
3251		}
3252	}
3253
3254	function module_roomView() {
3255		var OBJ = {
3256			roomView: {
3257				el: $('.room-view'),
3258				item: $('.room-view__item'),
3259				$item: [],
3260				title: $('.room-view__title'),
3261				desktopContent: $('.room-view__desktop-content'),
3262				amenity: $('.room-view__amenity'),
3263				amenityItem: $('.room-view__amenity-item'),
3264				btnbox: $('.room-view__btnbox'),
3265				$item: [],
3266				filterItemButton: $('.room-view__filter-item button'),
3267			},
3268			data: {
3269				filterSlug: 'all',
3270				itemGroup2: [],
3271				windowWidth: 0,
3272				isDesktop: false
3273			}
3274		};
3275
3276		var UPDATE = {
3277			roomView: {
3278				$item: function() {
3279					OBJ.roomView.$item = [];
3280
3281					// optimize save all necessary jquery
3282					for (var i=0; i<OBJ.roomView.el.length; i++) {
3283						// create array
3284						// groups all items of each of the same module found in the page
3285						OBJ.roomView.$item[i] = [];
3286
3287						var $items = $(OBJ.roomView.el[i]).find('.room-view__item');
3288
3289						for (var j=0; j<$items.length; j++) {
3290							var $item = $($items[j]);
3291							var $amenityItem = $item.find('.room-view__amenity-item');
3292							var $amenityItemEach = [];
3293
3294							for (var k=0; k<$amenityItem.length; k++) {
3295								$amenityItemEach.push($($amenityItem[k]));
3296							}
3297
3298							var $itemPush = {
3299								$item: $item,
3300								$title: $item.find('.room-view__title'),
3301								$desktopContent: $item.find('.room-view__desktop-content'),
3302								$amenity: $item.find('.room-view__amenity'),
3303								$amenityItem: $amenityItem,
3304								$amenityItemEach: $amenityItemEach,
3305								$btnbox: $item.find('.room-view__btnbox'),
3306							};
3307							OBJ.roomView.$item[i].push($itemPush);
3308						}
3309					}
3310				}
3311			},
3312			data: {
3313				windowWidth: function() {
3314					OBJ.data.windowWidth = $window.width();
3315				},
3316				isDesktop: function() {
3317					OBJ.data.isDesktop = (OBJ.data.windowWidth > 959);
3318				},
3319				isPhone: function() {
3320					OBJ.data.isPhone = (OBJ.data.windowWidth <= 767);
3321				}
3322			}
3323		};
3324
3325		var roomView_iso;
3326
3327		function groupItemsTo(num, filterSlug) {
3328			var itemGroup = [];
3329		
3330			// for each of the same module (x)
3331			// loop all items found in the page (y)
3332			// and place each item (indexItem) in groups (itemGroup|indexGroup)
3333		
3334			for (var x=0; x<OBJ.roomView.$item.length; x++) {
3335				var countItems = OBJ.roomView.$item[x].length;
3336				var indexGroup = 0;
3337				var indexItem = 0;
3338		
3339				// create itemGroup
3340				if (typeof itemGroup[x] === 'undefined') itemGroup[x] = [];
3341		
3342				// get each $item and place them to their respective group (itemGroup)
3343				for (var y=0; y<countItems; y++) {
3344		
3345					// if: check $item has the correct of filterSlug to join in the group
3346					// it will equalize height when rooms are filtered
3347					if (OBJ.roomView.$item[x][y].$item.hasClass(filterSlug)) {
3348		
3349						// create item group in module group
3350						if (typeof itemGroup[x][indexGroup] === 'undefined') itemGroup[x][indexGroup] = [];
3351		
3352						// add $item to item group
3353						itemGroup[x][indexGroup][indexItem] = OBJ.roomView.$item[x][y];
3354		
3355						// increment to move to next item
3356						// will be used for next instruction
3357						indexItem++;
3358		
3359						if (indexItem > num-1) { // this group is now full, move to the next group
3360							indexGroup++;
3361							indexItem = 0;
3362						}
3363					}
3364				}
3365			}
3366			
3367			return itemGroup;
3368		}
3369
3370		function equalizeItemHeight() {
3371			function loop($items) {
3372				var maxTitle_height = 0;
3373				var maxDesktopContent_height = 0;
3374				var maxAmenity_height = 0;
3375				var maxBtnbox_height = 0;
3376		
3377				// content: get max height of all items
3378				for (var x=0; x<$items.length; x++) {
3379					var $item = $items[x];
3380		
3381					var title_height = $item.$title.height();
3382					var desktopContent_height = $item.$desktopContent.height();
3383					var amenity_height = $item.$amenity.height();
3384					var btnbox_height = $item.$btnbox.height();
3385		
3386					if (maxTitle_height < title_height) maxTitle_height = title_height;
3387					if (maxDesktopContent_height < desktopContent_height) maxDesktopContent_height = desktopContent_height;
3388					if (maxAmenity_height < amenity_height) maxAmenity_height = amenity_height;
3389					if (maxBtnbox_height < btnbox_height) maxBtnbox_height = btnbox_height;
3390				}
3391		
3392				// content: use max height and apply accordingly
3393				for (var x=0; x<$items.length; x++) {
3394					var $item = $items[x];
3395		
3396					var title_height = $item.$title.height();
3397					var desktopContent_height = $item.$desktopContent.height();
3398					var amenity_height = $item.$amenity.height();
3399					var btnbox_height = $item.$btnbox.height();
3400		
3401					if (maxTitle_height > title_height) $item.$title.css('height', maxTitle_height);
3402					if (maxDesktopContent_height > desktopContent_height) $item.$desktopContent.css('height', maxDesktopContent_height);
3403					if (maxAmenity_height > amenity_height) $item.$amenity.css('height', maxAmenity_height);
3404					if (maxBtnbox_height > btnbox_height) $item.$btnbox.css('height', maxBtnbox_height);
3405				}
3406			}
3407		
3408			// execute
3409			if (OBJ.data.isDesktop) {
3410				for (var i=0; i<OBJ.data.itemGroup2.length; i++) {
3411					for (var j=0; j<OBJ.data.itemGroup2[i].length; j++) loop(OBJ.data.itemGroup2[i][j]);
3412				}
3413			}
3414		}
3415
3416		function equalizeItemHeight_unset() {
3417			OBJ.roomView.title.css('height', '');
3418			OBJ.roomView.desktopContent.css('height', '');
3419			OBJ.roomView.amenity.css('height', '');
3420			OBJ.roomView.btnbox.css('height', '');
3421		}
3422
3423		function alignAllAmenityItems() {
3424			function alignAmenityItems($item) {
3425				function updateItemsPerRow() {
3426					itemsPerRow = [];
3427					var offsetTop = 0;
3428					var itemCount = 0;
3429
3430					for (var i=0; i<$amenityItemEach.length; i++) {
3431						itemCount++;
3432
3433						var itemOffsetTop = $amenityItemEach[i].offset().top;
3434						var num = i+1;
3435
3436						// offset is empty, set offsetTop to start the process
3437						if (i == 0) offsetTop = itemOffsetTop;
3438
3439						// if: end of the loop, save itemCount to itemsPerRow
3440						// else: do standard process
3441						if (num == $amenityItemEach.length) {
3442
3443							itemsPerRow.push(itemCount);
3444
3445						} else {
3446
3447							// if: this amenity item is located on another row, save itemCount to current set, update offsetTop, and move to next set
3448							// else: this amenity item is still on the same row, increment itemCount
3449							if (offsetTop < itemOffsetTop) {
3450								itemsPerRow.push(itemCount);
3451
3452								// reset itemCount to 0, start counting the next row of items
3453								// + 1 because this item is in the next row
3454								itemCount = 1; 
3455							}
3456						}
3457					}
3458				}
3459
3460				function alignItemsPerRow(itemsPerRowCount, startIndex, totalItemsNeeded) {
3461					var $firstItem = $amenityItemEach[startIndex];
3462					var totalItemWidth = 0;
3463					var totalItemWidthHalf = 0;
3464					var isEven = (itemsPerRowCount%2==0);
3465
3466					// get only half of the first items and calculate the center using totalItemWidth
3467					// isEven: get only half of the items
3468					// isOdd: get half and the centered item
3469					var getHalfItemCount = (isEven) ? (totalItemsNeeded - (itemsPerRowCount/2)) : (totalItemsNeeded - Math.floor(itemsPerRowCount/2));
3470					var getHalfWidth = 0;
3471					var getCenteredItemWidth = 0;
3472
3473					// get offsetTop from first item in row
3474					var offsetTop = $firstItem.offset().top;
3475
3476					// get required widths
3477					for (var i=startIndex; i<totalItemsNeeded; i++) {
3478						var itemNum = i+1;
3479						var currentItemWidth = $amenityItemEach[i].width() + (parseInt($amenityItemEach[i].css('padding-left').replace('px', ''))*2);
3480
3481						// get width of all items in row
3482						totalItemWidth += currentItemWidth;
3483
3484						// get half of the items and calculate the width
3485						if (i < getHalfItemCount) {
3486							getHalfWidth += currentItemWidth;
3487						}
3488
3489						// get the centered item width
3490						// will be used to calculate the center for odd counted row
3491						// remove one side of the padding, no idea why it's not centered but this will work
3492						if (!isEven) {
3493							if (itemNum == (totalItemsNeeded - Math.floor(itemsPerRowCount/2))) {
3494								getCenteredItemWidth = currentItemWidth;
3495							}
3496						}
3497					}
3498
3499					// get half totalItemWidth 
3500					totalItemWidthHalf = totalItemWidth/2;
3501
3502					// alignment calculations
3503					// adds margin-left to first item to get items on center
3504					// final result must be multiplied by 2, due to text-align: center applied to room-view__amenity
3505					if (isEven) {
3506						$firstItem.css('margin-left', ((totalItemWidthHalf - getHalfWidth)*2) + 'px')
3507					} else {
3508						$firstItem.css('margin-left', ((totalItemWidthHalf - getHalfWidth + (getCenteredItemWidth/2))*2) + 'px')
3509					}
3510				}
3511
3512				var itemWidth = $item.$item.width();
3513				var $amenityItemEach = $item.$amenityItemEach;
3514				var itemsPerRow = []; // counts items found per row, places the count in a set
3515				var totalItemsNeeded = 0; // number of items needed to be aligned before moving to next group
3516
3517				updateItemsPerRow();
3518
3519				for (var i=0; i<itemsPerRow.length; i++) {
3520					var itemsPerRowCount = itemsPerRow[i];
3521					var startIndex = totalItemsNeeded;
3522					totalItemsNeeded += itemsPerRowCount;
3523
3524					alignItemsPerRow(itemsPerRowCount, startIndex, totalItemsNeeded);
3525				}
3526			}
3527
3528			// loop: by how many room-view modules found in the page
3529			for (var i=0; i<OBJ.roomView.$item.length; i++) {
3530				// loop: by how many items this room-view module have
3531				for (var j=0; j<OBJ.roomView.$item[i].length; j++) {
3532					alignAmenityItems(OBJ.roomView.$item[i][j]);
3533				}
3534			}
3535		}
3536
3537		function alignAllAmenityItems_unset() {
3538			OBJ.roomView.amenityItem.css('margin-left', '');
3539		}
3540
3541		function add_swiper() {
3542			var roomView_swiper = new Swiper('.room-view__imgslider-container', {
3543				pagination: {
3544					el: '.swiper-pagination',
3545					type: 'bullets',
3546					clickable: true
3547				},
3548				speed: 400
3549			});
3550
3551			SWIPER_addClass_disabled($('.room-view__imgslider'));
3552		}
3553
3554		function add_isotope() {
3555			roomView_iso = $('.room-view__list-wrap').isotope({
3556				itemSelector: '.room-view__item',
3557				percentPosition: true,
3558				layoutMode: 'fitRows'
3559			});
3560		}
3561
3562		function addEvent_filterButton() {
3563			OBJ.roomView.filterItemButton.click(function() {
3564				var $this = $(this);
3565				var data = {
3566					value: $this.attr('data-value'),
3567				};
3568				data.class = (data.value == 'all' || data.value == 'All') ? '*' : '.'+data.value;
3569	
3570				var this_li = $this.parent();
3571				var group_li = $this.closest('.room-view__filter-list').find('li');
3572	
3573				// set active
3574				group_li.removeClass('active');
3575				this_li.addClass('active');
3576
3577				// store selected filter slug
3578				OBJ.data.filterSlug = data.value;
3579
3580				// regroup items
3581				OBJ.data.itemGroup2 = groupItemsTo(2, OBJ.data.filterSlug);
3582	
3583				// filter isotope items
3584				roomView_iso.isotope({
3585					filter: data.class
3586				});
3587
3588				// get filtered isotope items
3589				var filteredItems = roomView_iso.isotope('getFilteredItemElements');
3590				for (var i=0; i<filteredItems.length; i++) {
3591					var $filteredItem = $(filteredItems[i]);
3592
3593					// disable graphic
3594					$filteredItem.find('.room-view__graphic').removeClass('active');
3595
3596					// set graphic to active
3597					// if: filteredItem is the last item and not placed to the right
3598					if (
3599						(i+1) == filteredItems.length &&
3600						filteredItems.length % 2 == 1
3601					) {
3602						$filteredItem.find('.room-view__graphic').addClass('active');
3603					}
3604				}
3605
3606				// equalize height
3607				// should be executed last, item height will be 0 since filtered items are hidden
3608				if (OBJ.data.isDesktop) {
3609					equalizeItemHeight_unset();
3610					equalizeItemHeight();
3611
3612					// rearrange the items again
3613					roomView_iso.isotope('layout');
3614				}
3615			});
3616	
3617			// set first filter item active
3618			if (OBJ.roomView.filterItemButton.length > 0) {
3619				var $this = $(OBJ.roomView.filterItemButton[0]);
3620				var data = {
3621					value: $this.attr('data-value'),
3622				};
3623				data.class = (data.value == 'all' || data.value == 'All') ? '*' : '.'+data.value;
3624	
3625				var this_li = $this.parent();
3626				var group_li = $this.closest('.room-view__filter-list').find('li');
3627	
3628				// set active
3629				group_li.removeClass('active');
3630				this_li.addClass('active');
3631	
3632				// filter isotope items
3633				roomView_iso.isotope({
3634					filter: data.class
3635				});
3636			}
3637		}
3638
3639		UPDATE.data.windowWidth();
3640		UPDATE.data.isDesktop();
3641		UPDATE.data.isPhone();
3642
3643		UPDATE.roomView.$item();
3644		OBJ.data.itemGroup2 = groupItemsTo(2, OBJ.data.filterSlug);
3645
3646		add_swiper();
3647		add_isotope();
3648		addEvent_filterButton();
3649
3650		//alignAllAmenityItems();
3651
3652		if (OBJ.data.isDesktop) {
3653			equalizeItemHeight();
3654		}
3655
3656		$window.on('resize', function() {
3657			UPDATE.data.windowWidth();
3658			UPDATE.data.isDesktop();
3659			UPDATE.data.isPhone();
3660
3661			alignAllAmenityItems_unset();
3662			//alignAllAmenityItems();
3663
3664			equalizeItemHeight_unset();
3665			if (OBJ.data.isDesktop) {
3666				equalizeItemHeight();
3667			}
3668		});
3669	}
3670
3671	function module_ourHotels() {
3672		var slider = jQuery(".hotel-slider-carousel");
3673		slider.owlCarousel({
3674			loop:false,
3675			margin:15,
3676			nav:true,
3677			dots:false,
3678			center:false,
3679			startPosition:1,
3680			responsive:{
3681				0:{
3682					items:1
3683				},
3684				768:{
3685					items:1
3686				},
3687				992:{
3688					items:2
3689				}
3690			}
3691		});
3692		jQuery(".hotel-mobile-slider").owlCarousel({
3693			loop:true,
3694			margin:0,
3695			nav:true,
3696			dots:false,
3697			responsive:{
3698				0:{
3699					items:1
3700				},
3701				600:{
3702					items:1
3703				},
3704				1000:{
3705					items:1
3706				}
3707			}
3708		});
3709
3710		function owlCarouselCalculeOdd(slider) {
3711			if($('.hotel-list__slider-carousel .hotel-list__slider-item').length % 2) {
3712				slider.on('change.owl.carousel', ['center', false] );
3713			} else {
3714				slider.on('change.owl.carousel', ['center', false]);
3715			}
3716		}
3717
3718		$('.hotel-list__filter-current').click(function() {
3719			$('.hotel-list__filter').toggleClass('active');
3720		});
3721
3722		$('.hotel-list__filter-dropdown li').click(function() {
3723			//owlCarouselCalculeOdd();
3724			$('.hotel-list__slider-item').parent().show();
3725			$('.hotel-list__filter-dropdown li').removeClass('current');
3726			$(this).addClass('current');
3727			var text = $(this).html();
3728			$('.hotel-list__filter-current').html(text);
3729			$('.hotel-list__filter').removeClass('active');
3730
3731			var filter = $(this).attr('data-value');
3732
3733			if(filter != 'filter-all') {
3734				$('.hotel-list__slider-item:not(.' + filter + ')').parent().hide();
3735				//owlCarouselCalculeOdd();
3736			}
3737			console.log($(this).attr('data-value'));
3738		});
3739
3740
3741	}
3742
3743	function module_offerViewFilter() {
3744
3745		$('.offer-view__filter-current').click(function() { 
3746			$('.offer-view__filter').toggleClass('active');
3747		});
3748
3749		$('.offer-view__filter-dropdown li').click(function() {
3750			$('.offer-view__item').show();
3751			$('.offer-view__filter-dropdown li').removeClass('current');
3752			$(this).addClass('current');
3753			var text = $(this).html();
3754			$('.offer-view__filter-current').html(text);
3755			$('.offer-view__filter').removeClass('active');
3756
3757			var filter = $(this).attr('data-value');
3758
3759			if(filter != 'filter-all') {
3760				$('.offer-view__item:not(.' + filter + ')').hide();
3761				$('.offer-view__item.filter-all').show();
3762			}
3763		});
3764
3765
3766	}
3767
3768	function module_scenicRoute() {
3769		var scenicRoute_swiper = new Swiper('.scenic-route__slider-container', {
3770			speed: 400,
3771			pagination: {
3772				el: '.swiper-pagination',
3773				type: 'bullets',
3774				clickable: true
3775			},
3776		});
3777
3778		SWIPER_addClass_disabled($('.scenic-route__slider'));
3779	}
3780
3781	function module_caravanSwimClub() {
3782		var caravanSwimClub_swiper = new Swiper('.caravan-swim-club__slider-container', {
3783			speed: 400,
3784			pagination: {
3785				el: '.swiper-pagination',
3786				type: 'bullets',
3787				clickable: true
3788			},
3789		});
3790
3791		SWIPER_addClass_disabled($('.caravan-swim-club__slider'));
3792	}
3793
3794	function module_eventFeatured() {
3795		var OBJ = {
3796			eventFeatured: {
3797				el: $('.event-featured'),
3798				$slide: [],
3799				contentbox: $('.event-featured__contentbox'),
3800				contentDescExcerpt: $('.event-featured__content-desc--excerpt')
3801			},
3802			data: {
3803				windowWidth: 0,
3804				isMobile: false,
3805				isTablet: false,
3806				isPhone: false,
3807				lastBreakpoint: 'desktop',
3808				currentBreakpoint: 'desktop',
3809				updateDotdotdot: false
3810			},
3811			swiper: [],
3812			dotdotdot: []
3813		};
3814	
3815		var UPDATE = {
3816			eventFeatured: {
3817				$slide: function() {
3818					OBJ.eventFeatured.$slide = [];
3819	
3820					// optimize save all necessary jquery
3821					for (var i=0; i<OBJ.eventFeatured.el.length; i++) {
3822						// create array
3823						// groups all slides of each of the same module found in the page
3824						OBJ.eventFeatured.$slide[i] = [];
3825	
3826						var $slides = $(OBJ.eventFeatured.el[i]).find('.event-featured__slide');
3827	
3828						for (var j=0; j<$slides.length; j++) {
3829							var $slide = $($slides[j]);
3830							var $slidePush = {
3831								$slide: $slide,
3832								$contentbox: $slide.find('.event-featured__contentbox')
3833							};
3834							OBJ.eventFeatured.$slide[i].push($slidePush);
3835						}
3836					}
3837				}
3838			},
3839			data: {
3840				windowWidth: function() {
3841					OBJ.data.windowWidth = $window.width();
3842				},
3843				isMobile: function() {
3844					OBJ.data.isMobile = (OBJ.data.windowWidth <= 1024);
3845				},
3846				isTablet: function() {
3847					OBJ.data.isTablet = (OBJ.data.windowWidth <= 1024 && OBJ.data.windowWidth >= 768);
3848				},
3849				isPhone: function() {
3850					OBJ.data.isPhone = (OBJ.data.windowWidth <= 767);
3851				},
3852				currentBreakpoint: function() {
3853					if (OBJ.data.isTablet) OBJ.data.currentBreakpoint = 'tablet';
3854					else if (OBJ.data.isPhone) OBJ.data.currentBreakpoint = 'phone';
3855					else OBJ.data.currentBreakpoint = 'desktop';
3856				},
3857				lastBreakpoint: function() {
3858					OBJ.data.lastBreakpoint = OBJ.data.currentBreakpoint;
3859				},
3860				updateDotdotdot: function() {
3861					// update Dotdotdot if currentBreakpoint and lastBreakpoint are not matching
3862					// prevents calling Dotdotdot function again on every resize
3863					OBJ.data.updateDotdotdot = (OBJ.data.currentBreakpoint !== OBJ.data.lastBreakpoint);
3864				}
3865			}
3866		};
3867	
3868		function createSwiper() {
3869			OBJ.swiper = new Swiper('.event-featured__slider-container', {
3870				// pagination: {
3871				// 	el: '.swiper-pagination',
3872				// 	type: 'bullets',
3873				// 	clickable: true
3874				// },
3875				autoHeight: true,
3876				navigation: {
3877					nextEl: '.swiper-button-next',
3878					prevEl: '.swiper-button-prev',
3879				},
3880				speed: 400
3881			});
3882	
3883			SWIPER_addClass_disabled($('.event-featured__slider'));
3884		}
3885	
3886		function updateSwiper() {
3887			OBJ.swiper.update();
3888		}
3889	
3890		function updateSwiperAutoHeight() {
3891			OBJ.swiper.updateAutoHeight();
3892		}
3893	
3894		function createDotdotdot() {
3895			OBJ.dotdotdot = []; // force clear
3896	
3897			for (var i=0; i<OBJ.eventFeatured.contentDescExcerpt.length; i++) {
3898				OBJ.dotdotdot.push(new Dotdotdot(OBJ.eventFeatured.contentDescExcerpt[i], {
3899					height: (!OBJ.data.isMobile) ? 145 : 145,
3900					keep: '.read-more'
3901				}))
3902			}
3903		}
3904	
3905		function destroyDotdotdot() {
3906			for (var i=0; i<OBJ.dotdotdot.length; i++) {
3907				var item = OBJ.dotdotdot[i];
3908				item.API.destroy();
3909			}
3910	
3911			OBJ.dotdotdot = []; // clear
3912		}
3913	
3914		function equalizeContentboxHeight() {
3915			function loop($slides) {
3916				var names = [
3917					'contentbox'
3918				];
3919		
3920				var maxHeights = {
3921					contentbox: 0,
3922				};
3923		
3924				var heights = {
3925					contentbox: 0,
3926				};
3927		
3928				// content: get max height of all slides
3929				for (var x=0; x<$slides.length; x++) {
3930					var $item = $slides[x];
3931		
3932					for (var y=0; y<names.length; y++) {
3933						var name = names[y];
3934						heights[name] = $item['$'+name].height();
3935						
3936						if (maxHeights[name] < heights[name]) maxHeights[name] = heights[name];
3937					}
3938				}
3939		
3940				// content: use max height and apply accordingly
3941				for (var x=0; x<$slides.length; x++) {
3942					var $item = $slides[x];
3943		
3944					for (var y=0; y<names.length; y++) {
3945						var name = names[y];
3946						heights[name] = $item['$'+name].height();
3947		
3948						if (maxHeights[name] > heights[name]) $item['$'+name].css('height', maxHeights[name]);
3949					}
3950				}
3951			}
3952		
3953			// execute
3954			for (var i=0; i<OBJ.eventFeatured.$slide.length; i++) {
3955				loop(OBJ.eventFeatured.$slide[i]);
3956			}
3957		}
3958		
3959		function equalizeContentboxHeight_unset() {
3960			OBJ.eventFeatured.contentbox.css('height', '');
3961		}
3962	
3963		if (OBJ.eventFeatured.el.length > 0) {
3964			$window.on('load', function() {
3965				UPDATE.data.windowWidth();
3966				UPDATE.data.isMobile();
3967				UPDATE.data.isTablet();
3968				UPDATE.data.isPhone();
3969				UPDATE.data.currentBreakpoint();
3970				UPDATE.data.lastBreakpoint();
3971	
3972				UPDATE.eventFeatured.$slide();
3973	
3974				createDotdotdot();
3975				createSwiper();
3976	
3977				equalizeContentboxHeight();
3978	
3979				updateSwiper();
3980				updateSwiperAutoHeight();
3981			});
3982		
3983			$window.on('resize', function() {
3984				UPDATE.data.windowWidth();
3985				UPDATE.data.isMobile();
3986				UPDATE.data.isTablet();
3987				UPDATE.data.isPhone();
3988				UPDATE.data.currentBreakpoint();
3989				UPDATE.data.updateDotdotdot();
3990	
3991				if (OBJ.data.updateDotdotdot) {
3992					destroyDotdotdot();
3993					createDotdotdot();
3994				}
3995	
3996				setTimeout(function() {
3997					equalizeContentboxHeight_unset();
3998					updateSwiper();
3999					equalizeContentboxHeight();
4000					updateSwiperAutoHeight();
4001				}, 1000);
4002		
4003				UPDATE.data.lastBreakpoint();
4004			});
4005		}
4006	}
4007
4008	function module_journalFilter() {
4009		var OBJ = {
4010			journalFilter: {
4011				el: $('.journal-filter')
4012			},
4013			navScroll: {
4014				el: $('.nav-scroll')
4015			},
4016			navHamMobile: {
4017				el: $('.nav-ham-mobile')
4018			}
4019		};
4020
4021		function setStickyKit() {
4022			var offset = 0;
4023			var windowWidth = $window.width();
4024
4025			if (windowWidth > 1024) {
4026				var offset = OBJ.navScroll.el.height();
4027			} else {
4028				var offset = OBJ.navHamMobile.el.height();
4029			}
4030
4031			OBJ.journalFilter.el.stick_in_parent({
4032				parent: 'main',
4033				sticky_class: 'is-sticky',
4034				offset_top: offset
4035			});
4036		}
4037
4038		setStickyKit();
4039		$window.on('resize', function() {
4040			OBJ.journalFilter.el.trigger("sticky_kit:detach");
4041			setStickyKit();
4042		});
4043	}
4044
4045	function module_bannerQuote() {
4046		var OBJ = {
4047			bannerQuote: {
4048				slider: $('.banner-quote__slider')
4049			},
4050			swiper: []
4051		};
4052
4053		SWIPER_addClass_disabled(OBJ.bannerQuote.slider);
4054
4055		for (var i=0; i<OBJ.bannerQuote.slider.length; i++) {
4056			var $swSlider = $(OBJ.bannerQuote.slider[i]);
4057			var $swContainer = $swSlider.find('> .swiper-container');
4058			var $swPagination = $swContainer.closest('.banner-quote').find('.swiper-pagination');
4059			var className = 'bnr-qt-slider-'+i;
4060
4061			$swPagination.addClass(className);
4062
4063			OBJ.swiper.push(
4064				new Swiper($swContainer[0], {
4065					pagination: {
4066						el: '.swiper-pagination.'+className,
4067						type: 'bullets',
4068						clickable: true
4069					},
4070					speed: 400
4071				})
4072			);
4073		}
4074	}
4075
4076	function module_imageSliderContent() {
4077		var OBJ = {
4078			imageSliderContent: {
4079				el: $('.image-slider-content'),
4080				slider: $('.image-slider-content__slider')
4081			},
4082			swiper: []
4083		};
4084
4085		SWIPER_addClass_disabled(OBJ.imageSliderContent.slider);
4086
4087		for (var i=0; i<OBJ.imageSliderContent.slider.length; i++) {
4088			var $swSlider = $(OBJ.imageSliderContent.slider[i]);
4089			var $swContainer = $swSlider.find('> .swiper-container');
4090			var $swPagination = $swContainer.find('.swiper-pagination');
4091			var className = 'img-sc-slider-'+i;
4092
4093			$swPagination.addClass(className);
4094
4095			OBJ.swiper.push(
4096				new Swiper($swContainer[0], {
4097					pagination: {
4098						el: '.swiper-pagination.'+className,
4099						type: 'bullets',
4100						clickable: true
4101					},
4102					speed: 400
4103				})
4104			);
4105		}
4106
4107		OBJ.imageSliderContent.el.one('inview', function(event, isInView) {
4108			var $this = $(this);
4109
4110			if (isInView) {
4111				var graphicTop = $this.find('.image-slider-content__graphic-top');
4112				var graphicBottom = $this.find('.image-slider-content__graphic-bottom');
4113
4114				// run graphic-top animation
4115				lottie.loadAnimation({
4116					container: graphicTop[0],
4117					renderer: 'svg',
4118					loop: false,
4119					autoplay: true,
4120					path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/room-dots-top-left.json'
4121				});
4122
4123				// run graphic-bottom animation
4124				lottie.loadAnimation({
4125					container: graphicBottom[0],
4126					renderer: 'svg',
4127					loop: false,
4128					autoplay: true,
4129					path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/room-dots-bottom-right.json'
4130				});
4131			}
4132		});
4133	}
4134
4135	function module_sliderContent() {
4136		var OBJ = {
4137			sliderContent: {
4138				el: $('.slider-content__item'),
4139				slider: $('.slider-content__slider')
4140			},
4141			swiper: []
4142		};
4143
4144		SWIPER_addClass_disabled(OBJ.sliderContent.slider);
4145
4146		for (var i=0; i<OBJ.sliderContent.slider.length; i++) {
4147			var $swSlider = $(OBJ.sliderContent.slider[i]);
4148			var $swContainer = $swSlider.find('.swiper-container');
4149			var $swButtonNext = $swContainer.find('.swiper-button-next');
4150			var $swButtonPrev = $swContainer.find('.swiper-button-prev');
4151			var className = 'con-sl-'+i;
4152
4153			$swButtonNext.addClass(className);
4154			$swButtonPrev.addClass(className);
4155
4156			OBJ.swiper.push(
4157				new Swiper($swContainer[0], {
4158					height: 600,
4159					navigation: {
4160						nextEl: '.swiper-button-next.'+className,
4161						prevEl: '.swiper-button-prev.'+className,
4162					},
4163					simulateTouch: false,
4164					speed: 400,
4165				})
4166			);
4167		}
4168
4169		OBJ.sliderContent.el.one('inview', function(event, isInView) {
4170			var $this = $(this);
4171
4172			console.log($(this));
4173
4174			if (isInView) {
4175				var graphicTop = $this.find('.slider-content__graphic-top');
4176				var graphicBottom = $this.find('.slider-content__graphic-bottom');
4177				var waves = $this.find('.slider-content__waves-graphic');
4178
4179				// run graphic-top animation
4180				lottie.loadAnimation({
4181					container: graphicTop[0],
4182					renderer: 'svg',
4183					loop: false,
4184					autoplay: true,
4185					path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/room-dots-top-left.json'
4186				});
4187
4188				// run graphic-bottom animation
4189				lottie.loadAnimation({
4190					container: graphicBottom[0],
4191					renderer: 'svg',
4192					loop: false,
4193					autoplay: true,
4194					path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/room-dots-bottom-right.json'
4195				});
4196
4197				// run graphic-waves animation
4198				lottie.loadAnimation({
4199					container: waves[0],
4200					renderer: 'svg',
4201					loop: false,
4202					autoplay: true,
4203					path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/waves.json'
4204				});
4205			}
4206		});
4207	}
4208
4209	function module_mediaContent() {
4210		var OBJ = {
4211			mediaContent: {
4212				el: $('.media-content'),
4213			},
4214		};
4215
4216		OBJ.mediaContent.el.one('inview', function(event, isInView) {
4217			var $this = $(this);
4218
4219			if (isInView) {
4220				var graphic = $this.find('.media-content__graphic');
4221
4222				// run graphic-top animation
4223				lottie.loadAnimation({
4224					container: graphic[0],
4225					renderer: 'svg',
4226					loop: false,
4227					autoplay: true,
4228					path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/waves.json'
4229				});
4230			}
4231		});
4232	}
4233
4234	function module_gatherView() {
4235		var OBJ = {
4236			navScroll: {
4237				el: $('.nav-scroll')
4238			},
4239			navHamMobile: {
4240				el: $('.nav-ham-mobile')
4241			},
4242			gatherView: {
4243				slider: $('.gather-view__slider')
4244			},
4245			gatherViewAnchor: {
4246				el: $('.gather-view-anchor'),
4247			},
4248			data: {
4249				windowWidth: 0
4250			},
4251			swiper: []
4252		};
4253
4254		var UPDATE = {
4255			data: {
4256				windowWidth: function() {
4257					OBJ.data.windowWidth = $window.width();
4258				},
4259			}
4260		};
4261
4262		function add_swiper() {
4263			for (var i=0; i<OBJ.gatherView.slider.length; i++) {
4264				var $swSlider = $(OBJ.gatherView.slider[i]);
4265				var $swContainer = $swSlider.find('> .swiper-container');
4266				var $swPagination = $swContainer.closest('.gather-view').find('.swiper-pagination');
4267				var className = 'gv-slider-'+i;
4268	
4269				$swPagination.addClass(className);
4270	
4271				OBJ.swiper.push(
4272					new Swiper($swContainer[0], {
4273						pagination: {
4274							el: '.swiper-pagination.'+className,
4275							type: 'bullets',
4276							clickable: true
4277						},
4278						speed: 400
4279					})
4280				);
4281			}
4282		}
4283
4284		function setStickyKit() {
4285			var offset = 0;
4286
4287			if (OBJ.data.windowWidth > 1024) {
4288				var offset = OBJ.navScroll.el.height();
4289			} else {
4290				var offset = OBJ.navHamMobile.el.height();
4291			}
4292
4293			OBJ.gatherViewAnchor.el.stick_in_parent({
4294				parent: 'main',
4295				sticky_class: 'is-sticky',
4296				offset_top: offset
4297			});
4298		}
4299
4300		UPDATE.data.windowWidth();
4301		add_swiper();
4302		setStickyKit();
4303
4304		$window.on('resize', function() {
4305			UPDATE.data.windowWidth();
4306			OBJ.gatherViewAnchor.el.trigger("sticky_kit:detach");
4307			setStickyKit();
4308		});
4309	}
4310
4311	function module_photoGallery() {
4312		var OBJ = {
4313			photoGallery: {
4314				filterItemButton: $('.photo-gallery__filter-item a'),
4315				graphic: $('.photo-gallery__graphic'),
4316			}
4317		};
4318
4319		var photoGallery_iso = $('.photo-gallery__list').isotope({
4320			itemSelector: '.photo-gallery__item',
4321			percentPosition: true,
4322			layoutMode: 'masonry',
4323			masonry: {
4324				columnWidth: '.photo-gallery__column-width'
4325			}
4326		});
4327
4328		OBJ.photoGallery.filterItemButton.click(function(e) {
4329			e.preventDefault();
4330			var $this = $(this);
4331			var dataValue = $this.attr('data-value');
4332			var block = $this.closest('.photo-gallery');
4333
4334			var this_li = $this.parent();
4335			var group_li = $this.closest('.photo-gallery__filter-list').find('li');
4336
4337			// set active
4338			group_li.removeClass('active');
4339			this_li.addClass('active');
4340
4341			if (dataValue != 'all') {
4342				block.addClass('photo-gallery--hide-graphic');
4343			} else {
4344				block.removeClass('photo-gallery--hide-graphic');
4345			}
4346
4347			// filter isotope items
4348			photoGallery_iso.isotope({
4349				filter: '.'+dataValue
4350			});
4351		});
4352
4353		// Gallery - Magnific Popup
4354		// var gallery_magnific_popup = {
4355		// 	type: 'image',
4356		// 	closeOnContentClick: false,
4357		// 	closeBtnInside: false,
4358		// 	mainClass: 'gallery-mfp',
4359		// 	image: {
4360		// 		verticalFit: true,
4361		// 		titleSrc: function(item) {
4362		// 			return item.el.attr('title');
4363		// 		}
4364		// 	},
4365		// 	gallery: {
4366		// 		enabled: true
4367		// 	},
4368		// 	zoom: {
4369		// 		enabled: true,
4370		// 		duration: 300, // don't foget to change the duration also in CSS
4371		// 		opener: function(element) {
4372		// 			return element.find('img');
4373		// 		}
4374		// 	}
4375		// }
4376
4377		// $('.photo-gallery__image-item--image a').magnificPopup(gallery_magnific_popup);
4378
4379		// $('.photo-gallery__image-item--video a').magnificPopup({
4380		// 	disableOn: 700,
4381		// 	type: 'iframe',
4382		// 	mainClass: 'mfp-fade',
4383		// 	removalDelay: 160,
4384		// 	preloader: false,
4385
4386		// 	fixedContentPos: false
4387		// });
4388
4389		$('.photo-gallery__item--image a').colorbox({
4390			rel: $(this).attr('rel'),
4391			current: '',
4392			maxWidth: '80%',
4393			maxHeight: '80%',
4394			onComplete: function(){
4395				var title = $(this).data('title');
4396				$('#cboxTitle').text(title);
4397			}
4398		});
4399
4400		OBJ.photoGallery.graphic.one('inview', function(event, isInView) {
4401			var $this = $(this);
4402
4403			if (isInView) {
4404				var graphic = $this;
4405
4406				// run graphic-top animation
4407				lottie.loadAnimation({
4408					container: graphic[0],
4409					renderer: 'svg',
4410					loop: false,
4411					autoplay: true,
4412					path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/rooms-dot-1.json'
4413				});
4414			}
4415		});
4416	}
4417
4418	function module_dineView() {
4419		var OBJ = {
4420			dineView: {
4421				slider: $('.dine-view__slider'),
4422				photoContent: $('.dine-view__photo-content'),
4423			},
4424			swiper: []
4425		};
4426
4427		SWIPER_addClass_disabled(OBJ.dineView.slider);
4428
4429		for (var i=0; i<OBJ.dineView.slider.length; i++) {
4430			var $swSlider = $(OBJ.dineView.slider[i]);
4431			var $swContainer = $swSlider.find('> .swiper-container');
4432			var $swPagination = $swContainer.closest('.dine-view__trio-photo-content').find('.swiper-pagination');
4433			var className = 'dv-tpc-slider-'+i;
4434
4435			$swPagination.addClass(className);
4436
4437			OBJ.swiper.push(
4438				new Swiper($swContainer[0], {
4439					pagination: {
4440						el: '.swiper-pagination.'+className,
4441						type: 'bullets',
4442						clickable: true
4443					},
4444					speed: 400
4445				})
4446			);
4447		}
4448
4449		OBJ.dineView.photoContent.one('inview', function(event, isInView) {
4450			var $this = $(this);
4451
4452			if (isInView) {
4453				var graphic = $this.find('.dine-view__svg-graphic');
4454
4455				// run graphic-top animation
4456				lottie.loadAnimation({
4457					container: graphic[0],
4458					renderer: 'svg',
4459					loop: false,
4460					autoplay: true,
4461					path: php_vars.get_stylesheet_directory_uri + '/assets/svg-animations/waves.json'
4462				});
4463			}
4464		});
4465	}
4466
4467	function module_imgRow() {
4468		var OBJ = {
4469			imgRow: {
4470				slider: $('.img-row__slider')
4471			},
4472			swiper: []
4473		};
4474	
4475		SWIPER_addClass_disabled(OBJ.imgRow.slider,[3,1],[1024]);
4476	
4477		for (var i=0; i<OBJ.imgRow.slider.length; i++) {
4478			var $swSlider = $(OBJ.imgRow.slider[i]);
4479			var $swContainer = $swSlider.find('> .swiper-container');
4480			var $swButtonNext = $swContainer.find('> .swiper-button-next');
4481			var $swButtonPrev = $swContainer.find('> .swiper-button-prev');
4482			var className = 'imgrow-slider-'+i;
4483
4484			$swButtonNext.addClass(className);
4485			$swButtonPrev.addClass(className);
4486	
4487			OBJ.swiper.push(
4488				new Swiper($swContainer[0], {
4489					slidesPerView: 'auto',
4490					navigation: {
4491						nextEl: '.swiper-button-next.'+className,
4492						prevEl: '.swiper-button-prev.'+className,
4493					},
4494					speed: 400
4495				})
4496			);
4497		}
4498	}
4499
4500	function module_landscapeVideo() {
4501		var $vides = $('.landscape-video__vide');
4502
4503		for (i=0; i<$vides.length; i++) {
4504			var $vide = $($vides[i]);
4505			var instance = $vide.data('vide');
4506
4507			$vide.closest('.landscape-video').find('.landscape-video__btn').click(function() {
4508				var $this = $(this);
4509
4510				if (!$this.hasClass('active')) {
4511					$this.addClass('active');
4512					instance.getVideoObject().play();
4513				} else {
4514					$this.removeClass('active');
4515					instance.getVideoObject().pause();
4516				}
4517			});
4518		}
4519	}
4520
4521	function module_mediaMasonry() {
4522		var mediaMasonry_iso = $('.media-masonry__wrap').isotope({
4523			itemSelector: '.media-masonry__item',
4524			percentPosition: true,
4525			layoutMode: 'masonry',
4526			masonry: {
4527				columnWidth: '.media-masonry__column-width'
4528			}
4529		});
4530	}
4531
4532	function module_accordion() {
4533		$('.accordion__titlebox').click(function() {
4534			var $this = $(this);
4535			var accordion = $this.closest('.accordion');
4536			var item = $this.closest('.accordion__item');
4537			var hidden = item.find('.accordion__hidden');
4538
4539			accordion.removeClass('see-all-active');
4540
4541			if (!item.hasClass('active')) {
4542				item.addClass('active');
4543				hidden.slideDown();
4544			} else {
4545				item.removeClass('active');
4546				hidden.slideUp();
4547			}
4548		});
4549
4550		$('.accordion__see-all button').click(function() {
4551			var $this = $(this);
4552			var data = {
4553				id: $this.attr('data-id')
4554			};
4555
4556			var list = $('#' + data.id);
4557			var item = list.find('.accordion__item');
4558			var hidden = list.find('.accordion__hidden');
4559
4560			if (!list.hasClass('see-all-active')) {
4561				list.addClass('see-all-active');
4562				item.addClass('active');
4563				hidden.slideDown();
4564			} else {
4565				list.removeClass('see-all-active');
4566				item.removeClass('active');
4567				hidden.slideUp();
4568			}
4569		});
4570	}
4571
4572	function module_blogPost() {
4573		function sticky() {
4574			var OBJ = {
4575				blogPostBack: {
4576					el: $('.blog-post-back')
4577				},
4578				blogPostSticky: {
4579					el: $('.blog-post-sticky')
4580				},
4581				navScroll: {
4582					el: $('.nav-scroll')
4583				},
4584				navHamMobile: {
4585					el: $('.nav-ham-mobile')
4586				}
4587			};
4588	
4589			function setStickyKit() {
4590				var offset = 0;
4591				var windowWidth = $window.width();
4592	
4593				if (windowWidth > 1024) {
4594					var offset = OBJ.navScroll.el.height();
4595				} else {
4596					var offset = OBJ.navHamMobile.el.height();
4597				}
4598
4599				OBJ.blogPostBack.el.stick_in_parent({
4600					parent: 'main',
4601					sticky_class: 'is-sticky',
4602					offset_top: offset
4603				});
4604	
4605				OBJ.blogPostSticky.el.stick_in_parent({
4606					parent: 'main',
4607					sticky_class: 'is-sticky',
4608					offset_top: offset
4609				});
4610			}
4611	
4612			setStickyKit();
4613			$window.on('resize', function() {
4614				OBJ.blogPostBack.el.trigger("sticky_kit:detach");
4615				OBJ.blogPostSticky.el.trigger("sticky_kit:detach");
4616				setStickyKit();
4617			});
4618		}
4619
4620		sticky();
4621	}
4622
4623	function module_form() {
4624		let formSelect = $('.form__select');
4625		let formSelectOption = $('.form__select-option');
4626
4627		formSelect.on('click', function() {
4628			$(this).find('.form__select-options').stop().slideToggle();
4629		});
4630
4631		formSelectOption.on('click', function() {
4632			let value = $(this).attr('data-value');
4633			$(this).parents('.form__select').find('input').val(value);
4634		});
4635	}
4636
4637	function module_contentForm() {
4638		let formSelect = $('.content-form__field--select');
4639		let formOption = $('.content-form__option');
4640
4641		formSelect.on('click', function() {
4642			$(this).find('.content-form__options').stop().slideToggle();
4643		});
4644
4645		formOption.on('click', function() {
4646			let value = $(this).attr('data-value');
4647			$(this).parents('.content-form__field--select').find('input').val(value);
4648		});
4649	}
4650
4651	function module_offerView() {
4652		var OBJ = {
4653			offerView: {
4654				el: $('.offer-view'),
4655				$item: [],
4656				content: $('.offer-view__content'),
4657				btnbox1: $('.offer-view__btnbox--1'),
4658				btnbox2: $('.offer-view__btnbox--2'),
4659			},
4660			data: {
4661				itemGroup2: [],
4662				itemGroup3: [],
4663				windowWidth: 0,
4664				isDesktop: false,
4665				isMobile: false,
4666				isTablet: false,
4667				isPhone: false,
4668			}
4669		};
4670
4671		var UPDATE = {
4672			offerView: {
4673				$item: function() {
4674					OBJ.offerView.$item = [];
4675
4676					// optimize save all necessary jquery
4677					for (var i=0; i<OBJ.offerView.el.length; i++) {
4678						// create array
4679						// groups all items of each of the same module found in the page
4680						OBJ.offerView.$item[i] = [];
4681
4682						var $items = $(OBJ.offerView.el[i]).find('.offer-view__item');
4683
4684						for (var j=0; j<$items.length; j++) {
4685							var $item = $($items[j]);
4686							var $itemPush = {
4687								$item: $item,
4688								$content: $item.find('.offer-view__content'),
4689								$btnbox1: $item.find('.offer-view__btnbox--1'),
4690								$btnbox2: $item.find('.offer-view__btnbox--2'),
4691							};
4692							OBJ.offerView.$item[i].push($itemPush);
4693						}
4694					}
4695				}
4696			},
4697			data: {
4698				windowWidth: function() {
4699					OBJ.data.windowWidth = $window.width();
4700				},
4701				isDesktop: function() {
4702					OBJ.data.isDesktop = (OBJ.data.windowWidth > 1024);
4703				},
4704				isMobile: function() {
4705					OBJ.data.isMobile = (OBJ.data.windowWidth <= 1024);
4706				},
4707				isTablet: function() {
4708					OBJ.data.isTablet = (OBJ.data.windowWidth <= 1024 && OBJ.data.windowWidth >= 768);
4709				},
4710				isPhone: function() {
4711					OBJ.data.isPhone = (OBJ.data.windowWidth <= 767);
4712				}
4713			}
4714		};
4715
4716		function groupItemsTo(num) {
4717			var itemGroup = [];
4718		
4719			// for each of the same module (x)
4720			// loop all items found in the page (y)
4721			// and place each item (indexItem) in groups (itemGroup|indexGroup)
4722
4723			for (var x=0; x<OBJ.offerView.$item.length; x++) {
4724				var countItems = OBJ.offerView.$item[x].length;
4725				var indexGroup = 0;
4726				var indexItem = 0;
4727		
4728				// create itemGroup
4729				if (typeof itemGroup[x] === 'undefined') itemGroup[x] = [];
4730		
4731				// get each $item and place them to their respective group (itemGroup)
4732				for (var y=0; y<countItems; y++) {
4733		
4734					// create item group in module group
4735					if (typeof itemGroup[x][indexGroup] === 'undefined') itemGroup[x][indexGroup] = [];
4736		
4737					// add $item to item group
4738					itemGroup[x][indexGroup][indexItem] = OBJ.offerView.$item[x][y];
4739		
4740					// increment to move to next item
4741					// will be used for next instruction
4742					indexItem++;
4743		
4744					if (indexItem > num-1) { // this group is now full, move to the next group
4745						indexGroup++;
4746						indexItem = 0;
4747					}
4748				}
4749			}
4750			
4751			return itemGroup;
4752		}
4753
4754		function equalizeItemHeight() {
4755			function loop($items) {
4756				var maxContent_height = 0;
4757				var maxBtnbox1_height = 0;
4758				var maxBtnbox2_height = 0;
4759		
4760				// content: get max height of all items
4761				for (var x=0; x<$items.length; x++) {
4762					var $item = $items[x];
4763		
4764					var content_height = $item.$content.height();
4765					var btnbox1_height = $item.$btnbox1.height();
4766					var btnbox2_height = $item.$btnbox2.height();
4767		
4768					if (maxContent_height < content_height) maxContent_height = content_height;
4769					if (maxBtnbox1_height < btnbox1_height) maxBtnbox1_height = btnbox1_height;
4770					if (maxBtnbox2_height < btnbox2_height) maxBtnbox2_height = btnbox2_height;
4771				}
4772		
4773				// content: use max height and apply accordingly
4774				for (var x=0; x<$items.length; x++) {
4775					var $item = $items[x];
4776		
4777					var content_height = $item.$content.height();
4778					var btnbox1_height = $item.$btnbox1.height();
4779					var btnbox2_height = $item.$btnbox2.height();
4780		
4781					if (maxContent_height > content_height) $item.$content.css('height', maxContent_height);
4782					if (maxBtnbox1_height > btnbox1_height) $item.$btnbox1.css('height', maxBtnbox1_height);
4783					if (maxBtnbox2_height > btnbox2_height) $item.$btnbox2.css('height', maxBtnbox2_height);
4784				}
4785			}
4786		
4787			// execute
4788			if (OBJ.data.isDesktop || OBJ.data.isTablet) {
4789				if (OBJ.data.isDesktop) itemGroup = OBJ.data.itemGroup3;
4790				else if (OBJ.data.isTablet) itemGroup = OBJ.data.itemGroup2;
4791
4792				for (var i=0; i<itemGroup.length; i++) {
4793					for (var j=0; j<itemGroup[i].length; j++) loop(itemGroup[i][j]);
4794				}
4795			}
4796		}
4797
4798		function equalizeItemHeight_unset() {
4799			OBJ.offerView.content.css('height', '');
4800			OBJ.offerView.btnbox1.css('height', '');
4801			OBJ.offerView.btnbox2.css('height', '');
4802		}
4803
4804		UPDATE.data.windowWidth();
4805		UPDATE.data.isDesktop();
4806		UPDATE.data.isMobile();
4807		UPDATE.data.isTablet();
4808		UPDATE.data.isMobile();
4809
4810		UPDATE.offerView.$item();
4811		OBJ.data.itemGroup2 = groupItemsTo(2);
4812		OBJ.data.itemGroup3 = groupItemsTo(3);
4813
4814		equalizeItemHeight();
4815
4816		$window.on('resize', function() {
4817			UPDATE.data.windowWidth();
4818			UPDATE.data.isDesktop();
4819			UPDATE.data.isMobile();
4820			UPDATE.data.isTablet();
4821
4822			equalizeItemHeight_unset();
4823			equalizeItemHeight();
4824		});
4825	}
4826
4827	function inviewBlockId() {
4828		var OBJ = {
4829			inviewBlockId: $('.inview-block-id'),
4830			$inviewBlockId: [],
4831			navFold: {
4832				el: $('.nav-fold'),
4833				menuItem: $('.nav-fold__menu > ul > li > a'),
4834				$menuItem: []
4835			},
4836			navMobile: {
4837				el: $('.nav-mobile'),
4838				menuItem: $('.nav-mobile__menu > ul > li > a'),
4839				$menuItem: []
4840			},
4841			viewPort: 0,
4842			blocks: [],
4843		}
4844	
4845		var UPDATE = {
4846			viewPort: function() {
4847				OBJ.viewPort = window.pageYOffset + ($window.height() * .5);
4848			},
4849			blocks: function() {
4850				OBJ.blocks = [];
4851	
4852				for (var i=0; i<OBJ.$inviewBlockId.length; i++) {
4853					var $el = OBJ.$inviewBlockId[i];
4854					var block = {
4855						$el: $el,
4856						offsetTop: $el[0].offsetTop,
4857						height: $el.height()
4858					};
4859					block.offsetBottom = block.offsetTop + block.height;
4860					OBJ.blocks.push(block);
4861				}
4862			}
4863		}
4864	
4865		// optimization: create jQuery for inview-block-id sections
4866		function create_$inviewBlockId() {
4867			for (var i=0; i<OBJ.inviewBlockId.length; i++) {
4868				var $el = $(OBJ.inviewBlockId[i]);
4869				OBJ.$inviewBlockId.push($el);
4870			}
4871		}
4872	
4873		// optimization: create jQuery for nav-fold menu item links
4874		function create_navFold_$menuItem() {
4875			for (var i=0; i<OBJ.navFold.menuItem.length; i++) {
4876				var $el = $(OBJ.navFold.menuItem[i]);
4877				OBJ.navFold.$menuItem.push($el);
4878			}
4879		}
4880
4881		// optimization: create jQuery for nav-mobile menu item links
4882		function create_navMobile_$menuItem() {
4883			for (var i=0; i<OBJ.navMobile.menuItem.length; i++) {
4884				var $el = $(OBJ.navMobile.menuItem[i]);
4885				OBJ.navMobile.$menuItem.push($el);
4886			}
4887		}
4888	
4889		function set_menuItemActive($el) {
4890			var id = $el.attr('id');
4891	
4892			for (var i=0; i<OBJ.navFold.$menuItem.length; i++) {
4893				var $item = OBJ.navFold.$menuItem[i];
4894				var href = $item.attr('href');
4895	
4896				if (href == '#'+id) {
4897					$item.closest('li').addClass('current-menu-item');
4898				}
4899			}
4900
4901			for (var i=0; i<OBJ.navMobile.$menuItem.length; i++) {
4902				var $item = OBJ.navMobile.$menuItem[i];
4903				var href = $item.attr('href');
4904	
4905				if (href == '#'+id) {
4906					$item.closest('li').addClass('current-menu-item');
4907				}
4908			}
4909		}
4910	
4911		function do_inview() {
4912			for (var i=0; i<OBJ.blocks.length; i++) {
4913				var block = OBJ.blocks[i];
4914	
4915				if (
4916					OBJ.viewPort > block.offsetTop &&
4917					OBJ.viewPort < block.offsetBottom
4918				) {
4919					OBJ.navFold.menuItem.closest('li').removeClass('current-menu-item');
4920					OBJ.navMobile.menuItem.closest('li').removeClass('current-menu-item');
4921					set_menuItemActive(block.$el);
4922				}
4923			}
4924		}
4925	
4926		if (
4927			(OBJ.navFold.el.length > 0 || OBJ.navMobile.el.length > 0) &&
4928			OBJ.inviewBlockId.length > 0
4929		) {
4930			create_$inviewBlockId();
4931			create_navFold_$menuItem();
4932			create_navMobile_$menuItem();
4933			UPDATE.viewPort();
4934			UPDATE.blocks(); // create|update block data used for do_inview() 
4935			do_inview();
4936	
4937			$window.on('load resize', function() {
4938				UPDATE.blocks();
4939			});
4940	
4941			$window.on('scroll', function() {
4942				UPDATE.viewPort();
4943				do_inview();
4944			});
4945		}
4946	}
4947
4948	/**
4949 * Handles the email capture functionality for Revinate.
4950 */
4951	function emailCapture_revinate() {
4952		var OBJ = {
4953			emailCaptureRevinate: {
4954				el: $('#revinate_contact_api_form'),
4955				form: $('#revinate_contact_api_form')
4956			}
4957		};
4958
4959		if (OBJ.emailCaptureRevinate.el.length > 0) {
4960			// Remove the onsubmit attribute from the form
4961			OBJ.emailCaptureRevinate.el.removeAttr('onsubmit');
4962
4963			OBJ.emailCaptureRevinate.el.submit(function (e) {
4964				e.preventDefault();
4965
4966				var $this = $(this);
4967				var emailAddress = $("input[name=email]").val();
4968
4969				// Validate email before calling revFormOnSubmit
4970				if (!emailAddress || !isValidEmail(emailAddress)) {
4971					console.log('Invalid email address');
4972					return;
4973				}
4974
4975				// Call Revinate's submit function
4976				revFormOnSubmit();
4977
4978				// Add visual feedback
4979				$this.closest('.email-capture').addClass('email-capture--success');
4980				console.log('Form submission initiated');
4981			});
4982
4983			// Add custom validation
4984			OBJ.emailCaptureRevinate.form.validate({
4985				rules: {
4986					email: {
4987						required: true,
4988						email: true,
4989						normalizer: function (value) {
4990							return $.trim(value);
4991						}
4992					}
4993				},
4994				messages: {
4995					email: {
4996						required: "Please enter your email address",
4997						email: "Please enter a valid email address"
4998					}
4999				}
5000			});
5001		}
5002	}
5003
5004	// Simple email validation function
5005	function isValidEmail(email) {
5006		var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
5007		return re.test(String(email).toLowerCase());
5008	}
5009
5010	function bookingWidget() {
5011		var arr =  $('.booking-widget__calendar').data('arr');
5012		var dep = $('.booking-widget__calendar').data('dep');
5013		$('.booking-widget__calendar').datepicker({
5014			dateFormat: 'dd-mm-yy',
5015			minDate: 0,
5016			dayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
5017			numberOfMonths: [1,2],
5018			numberOfMonths: 2,
5019			beforeShowDay: function(date) {
5020				var date1 = $.datepicker.parseDate('yy-mm-dd', arr);
5021				var date2 = $.datepicker.parseDate('yy-mm-dd', dep);
5022
5023				if (date1 && (date.getTime() == date1.getTime())) {
5024					className = "arrival-date";
5025				}
5026				else if (date2 && (date.getTime() == date2.getTime())) {
5027					className = "departure-date";
5028				}
5029				else if ((date1 && date2) && (date1 < date && date < date2)) {
5030					className = "between-date";
5031				}
5032				else {
5033					className = "";
5034				}
5035
5036				return [true, className];
5037			},
5038			onSelect: function(selected, inst) {
5039				selected = selected.split('-');
5040				var arrive_parseDate = $.datepicker.parseDate('yy-mm-dd', arr);
5041				var depart_parseDate = $.datepicker.parseDate('yy-mm-dd', dep);
5042				var selected_parseDate = $.datepicker.parseDate('yy-mm-dd', selected[2] + '-' + selected[1] + '-' + selected[0]);
5043				if (!arrive_parseDate || depart_parseDate) {
5044					arr = (selected[2] + '-' + selected[1] + '-' + selected[0]);
5045					dep = '';
5046
5047				} else if( selected_parseDate < arrive_parseDate ) {
5048
5049					dep = arr;
5050					arr = selected[2] + '-' + selected[1] + '-' + selected[0];
5051
5052				} else {
5053					dep = selected[2] + '-' + selected[1] + '-' + selected[0];
5054				}
5055				$('#bw-arr').val(arr);
5056				$('#bw-dep').val(dep);
5057			}
5058		});
5059
5060		$('.booking-widget__selected').click(function() {
5061			$(this).parent().find('.booking-widget__options').slideToggle(500);
5062		});
5063
5064		$('.booking-widget__options li').click(function() {
5065			$(this).parent().slideToggle(500);
5066			$(this).parent().parent().find('.booking-widget__selected').html($(this).html());
5067		});
5068	}
5069
5070	function smoothScroll() {
5071		var $root = $('html, body');
5072		var $navScroll = $('.nav-scroll');
5073		var $navHamMobile = $('.nav-ham-mobile');
5074		// var $gatherViewAnchor = $('.gather-view-anchor');
5075
5076		$('.nav-fold__menu a[href*="#"], .nav-mobile__menu a[href*="#"], .anchor-arrow, .gather-view-anchor__list a').on('click', function(e) {
5077			var windowWidth = $window.width();
5078
5079			if (windowWidth > 1024) {
5080				var offset = $navScroll.height();
5081			} else {
5082				var offset = $navHamMobile.height();
5083			}
5084
5085			var $this = $(this);
5086			var isAzdsLink = $this.attr('href').match(/\/booking\/step\-/g);
5087
5088			if (!isAzdsLink) {
5089				e.preventDefault();
5090
5091				// smooth scroll
5092				$root.animate({
5093					scrollTop: $($this.attr('href')).offset().top - offset,
5094				}, 500,'linear');
5095	
5096				// close .nav-mobile if link is in .nav-mobile__menu
5097				if ($this.closest('.nav-mobile__menu').length > 0) {
5098					$html.removeClass('overflow-hidden');
5099					$body.removeClass('body-nav-mobile overflow-hidden');
5100				}
5101			}
5102		})
5103	}
5104
5105	function videAutoplayFix() { // safari autoplay fix
5106		var $autoPlayFix = $('.vide-autoplay-fix');
5107		for (var i=0; i<$autoPlayFix.length; i++) {
5108			var $item = $($autoPlayFix[i]);
5109			$item.data('vide').getVideoObject().play();
5110		}
5111	}
5112
5113	function footer() {
5114		function setMenuItemHeight() {
5115			var maxItemHeight;
5116
5117			// reset height
5118			menuItems_col1.css('height', '');
5119			menuItems_col2.css('height', '');
5120
5121			for (i=0; i<groupBy2.length; i++) {
5122				maxItemHeight = 0;
5123
5124				// get maxItemHeight
5125				for (j=0; j<groupBy2[i].length; j++) {
5126					var $menuItem = groupBy2[i][j];
5127					if ($menuItem.height() > maxItemHeight) maxItemHeight = $menuItem.height();
5128				}
5129
5130				// apply maxItemHeight
5131				for (j=0; j<groupBy2[i].length; j++) {
5132					var $menuItem = groupBy2[i][j];
5133					$menuItem.css('height', maxItemHeight);
5134				}
5135			}
5136		}
5137
5138		var menuItems_col1 = $('.footer__menu ul:first-child li');
5139		var menuItems_col2 = $('.footer__menu ul:last-child li');
5140		var j = 0;
5141		var groupBy2 = [];
5142
5143		// group menu items by 2
5144		for (i=0; i<menuItems_col1.length; i++) {
5145			// group not yet added, create group
5146			if (typeof groupBy2[j] === 'undefined') groupBy2[j] = [];
5147
5148			// check item if it exists, prevents error if col2 item is undefined
5149			// add jQuery menuItem to set
5150			if (typeof menuItems_col1[i] !== 'undefined') groupBy2[j].push($(menuItems_col1[i]));
5151			if (typeof menuItems_col2[i] !== 'undefined') groupBy2[j].push($(menuItems_col2[i]));
5152
5153			// move to next group
5154			j++;
5155		}
5156
5157		setMenuItemHeight();
5158		$window.on('resize', function() {
5159			setMenuItemHeight();
5160		});
5161	}
5162
5163
5164	function thejune_popup_functionality() {
5165		var current_url = window.location.href;
5166		var get_booking_matches = current_url.match('\/#\/booking');
5167		var is_azds_booking_open = (get_booking_matches !== null && typeof get_booking_matches !== 'undefined' && get_booking_matches.length >= 1);
5168	
5169		var popups = $('.popup-one, .popup-two');
5170	
5171		function set_popup_active_by_geotargeting(popup) {
5172			var geotarget_match = false;
5173	
5174			if (
5175				typeof user_ip_data !== 'undefined' &&
5176				user_ip_data
5177			) {
5178				var user_data_country = user_ip_data.country;
5179				var user_data_region = user_ip_data.region;
5180	
5181				var popup_data_country = popup.attr('data-geotarget-country');
5182				var popup_data_us_state = popup.attr('data-geotarget-us-state');
5183	
5184				// CHECK FOR COUNTRY MATCH
5185				if (
5186					typeof user_data_country !== 'undefined' &&
5187					typeof popup_data_country !== 'undefined'
5188				) {
5189					popup_data_country = popup_data_country.split(',');
5190					for (var i = 0; i < popup_data_country.length; i++) {
5191						if (user_data_country == popup_data_country[i]) {
5192							geotarget_match = true;
5193						}
5194					}
5195				}
5196	
5197				// CHECK FOR US STATE MATCH
5198				if (
5199					typeof user_data_region !== 'undefined' &&
5200					typeof popup_data_us_state !== 'undefined'
5201				) {
5202					popup_data_us_state = popup_data_us_state.split(',');
5203					for (var i = 0; i < popup_data_us_state.length; i++) {
5204						if (user_data_region == popup_data_us_state[i]) {
5205							geotarget_match = true;
5206						}
5207					}
5208				}
5209			}
5210	
5211			if (geotarget_match) {
5212				popup.addClass('active');
5213			}
5214		}
5215	
5216		if (!is_azds_booking_open) {
5217	
5218			if (popups.length > 0) {
5219				for (var i = 0; i < popups.length; i++) {
5220					var popup = $(popups[i]);
5221	
5222					var is_geotargeting = (typeof popup.attr('data-is-geotargeting') !== 'undefined');
5223					var is_exit_intent = (typeof popup.attr('data-is-exit-intent') !== 'undefined');
5224	
5225					var cookie_name = 'june-cookie-popup-' + popup.attr('data-cookie-name');
5226					var cookie_value = $.cookie(cookie_name);
5227	
5228					// if: open popup if cookie doesn't exist && popup is not used for exit intent
5229					if (typeof cookie_value === 'undefined' && !is_exit_intent) {
5230						if (is_geotargeting) {
5231							set_popup_active_by_geotargeting(popup);
5232						} else {
5233							popup.addClass('active');
5234						}
5235					}
5236				}
5237			}
5238	
5239			$(document).on('mouseleave', function () {
5240				for (var i = 0; i < popups.length; i++) {
5241					var popup = $(popups[i]);
5242	
5243					var is_geotargeting = (typeof popup.attr('data-is-geotargeting') !== 'undefined');
5244					var is_exit_intent = (typeof popup.attr('data-is-exit-intent') !== 'undefined');
5245	
5246					var cookie_name = 'june-cookie-popup-' + popup.attr('data-cookie-name');
5247					var cookie_value = $.cookie(cookie_name);
5248	
5249					// if: open popup if cookie doesn't exist && popup is not used for exit intent
5250					if (typeof cookie_value === 'undefined' && is_exit_intent) {
5251						if (is_geotargeting) {
5252							set_popup_active_by_geotargeting(popup);
5253						} else {
5254							popup.addClass('active');
5255						}
5256					}
5257				}
5258			});
5259	
5260			$('.popup-one__close').click(function () {
5261				var popup_one = $(this).closest('.popup-one');
5262				var cookie_name = 'june-cookie-popup-' + popup_one.attr('data-cookie-name');
5263				$.cookie(cookie_name, true);
5264				popup_one.removeClass('active');
5265			});
5266	
5267			$('.popup-two__close, .popup-two__bg-overlay').click(function () {
5268				var popup_two = $(this).closest('.popup-two');
5269				var cookie_name = 'june-cookie-popup-' + popup_two.attr('data-cookie-name');
5270				$.cookie(cookie_name, true);
5271				popup_two.removeClass('active');
5272			});
5273	
5274		}
5275	}
5276
5277	function module_FeaturedSlider() {
5278		// OWL CAROUSEL JS
5279
5280		$('.common-carousel-js').owlCarousel({
5281			items: 1,
5282			loop: true,
5283			nav: true,
5284			navText: ['<span class="sr-only">next</span>', '<span class="sr-only">prev</span>'],
5285			mouseDrag: false,
5286			dots: false
5287		});
5288	
5289		$('.homeengage-carousel-js').owlCarousel({
5290			items: 1,
5291			loop: true,
5292			nav: true,
5293			navText: ['<span class="sr-only">next</span>', '<span class="sr-only">prev</span>'],
5294			mouseDrag: true,
5295			dots: true
5296		});
5297	
5298		$('.neighcl-carousel-js').owlCarousel({
5299			items: 1,
5300			loop: true,
5301			mouseDrag: true,
5302			dots: true,
5303			lazyLoad: true,
5304		});	
5305	
5306		$('.home-common-carousel-js').owlCarousel({
5307			dotsContainer: '.hidden',
5308			items: 1,
5309			loop: true,
5310			nav: true,
5311			navText: ['<span class="sr-only">next</span>', '<span class="sr-only">prev</span>'],
5312			mouseDrag: false,
5313			touchDrag: false,
5314		});
5315	
5316		$('.autoplay-carousel-js').owlCarousel({
5317			items: 1,
5318			loop: true,
5319			nav: true,
5320			navText: ['<span class="sr-only">next</span>', '<span class="sr-only">prev</span>'],
5321			autoplay: true,
5322			autoplaySpeed: 5000,
5323			autoplayTimeout: 7500,
5324			mouseDrag: false,
5325			touchDrag: false,
5326			dots: false
5327		});
5328	
5329		$('.tripadvisor-carousel-js').owlCarousel({
5330			animateIn: 'fadeIn',
5331			animateOut: 'fadeOut',
5332			items: 1,
5333			loop: true,
5334			mouseDrag: false,
5335		});
5336	
5337		$('.featslide-carousel-js').owlCarousel({
5338			animateIn: 'fadeIn',
5339			animateOut: 'fadeOut',
5340			autoplay: true,
5341			autoplaySpeed: 3000,
5342			items: 1,
5343			loop: true,
5344			mouseDrag: false,
5345			nav: true,
5346			navText: ['<span class="sr-only">next</span>', '<span class="sr-only">prev</span>'],
5347		});
5348	
5349		$('.gallery-brand-slider').owlCarousel({
5350			items: 2,
5351			loop: true,
5352			// mouseDrag: false,
5353			margin: 30,
5354			responsive:{
5355				0:{ items:1 },
5356				768:{ items:2 }
5357			}
5358		});
5359	
5360		$('.center-carousel-js').owlCarousel({
5361			center: false,
5362			items: 1,
5363			loop: true,
5364			margin: 0,
5365			responsive:{
5366				768: {
5367					center: true,
5368					items: 2,
5369					margin: 20,
5370				}
5371			}
5372		});
5373	
5374		$('.featureslider-carousel-js').owlCarousel({
5375			center: false,
5376			items: 1,
5377			loop: true,
5378			margin: 0,
5379			dots: false,
5380			responsive:{
5381				768: {
5382					center: true,
5383					items: 2,
5384					margin: 20,
5385				}
5386			}
5387		});
5388	
5389		$('.mainquote-slider-js').owlCarousel({
5390			items: 1,
5391			loop: true,
5392			autoplay: true,
5393			autoplaySpeed: 3000
5394		});
5395	
5396		$('.double-slider-owl').owlCarousel({
5397			slideSpeed : 300,
5398			items: 1,
5399			paginationSpeed : 400,
5400			singleItem:true,
5401			dots: false,
5402			navigationText: true
5403		});
5404	
5405		$('.full-slider-owl').owlCarousel({
5406			slideSpeed : 300,
5407			items: 1,
5408			paginationSpeed : 400,
5409			singleItem:true,
5410			dots: false,
5411			navigation: true
5412		});
5413	
5414		$('.mainquote-slider-js').owlCarousel({
5415			items: 1,
5416			loop: true
5417		});
5418	
5419		// WHOLE IMAGE NAV: OWL CAROUSEL
5420	
5421		var $wholeImgNav = $('.owl-wholeimgnav-js').owlCarousel({
5422			dotsContainer: '.wholeimgnav-navlist',
5423			items: 1,
5424			loop: false,
5425			mouseDrag: false,
5426		});
5427	
5428		$('.wholeimgnav-navitem').on('click', function() {
5429			$wholeImgNav.trigger('to.owl.carousel', [$(this).index(), 300]);
5430		});
5431	
5432		$wholeImgNav.on('changed.owl.carousel', function(e) {
5433			var thiss = $('.wholeimgnav-navitem').eq(e.item.index);
5434			var wholeImgNavBox = thiss.parent().parent();
5435	
5436			var itemOffset = thiss.offset();
5437			var navBoxOffset = wholeImgNavBox.offset();
5438	
5439			var itemNewPosition = itemOffset.left - navBoxOffset.left + wholeImgNavBox.scrollLeft() - 25;
5440	
5441			// MOBILE
5442			// move scrollbar to where the user clicked/dragged a destination
5443			if ( thiss.hasClass('wholeimgnav-active') ) {
5444				$('.wholeimgnav-navitem').removeClass('active');
5445			} else {
5446				$('.wholeimgnav-navitem').removeClass('active');
5447				$('.wholeimgnav-navitem').removeClass('wholeimgnav-active');
5448				thiss.addClass('wholeimgnav-active');
5449				wholeImgNavBox.scrollLeft( itemNewPosition );
5450			}
5451		});
5452	}
5453
5454	function stickyGalleryBar() {
5455
5456		if(document.getElementsByClassName("photo-gallery__filter").length > 0) {
5457			var navbar = document.getElementsByClassName("photo-gallery__filter")[0];
5458			var sticky = navbar.offsetTop;
5459			if($window.width() > '1024') {
5460				var header = $('.nav-scroll').height();
5461			} else {
5462				var header = $('.nav-ham-mobile').height();
5463			}
5464
5465			if (window.pageYOffset >= sticky) {
5466				navbar.classList.add("sticky");
5467				$(navbar).css({'top': header + 'px'});
5468			} else {
5469				navbar.classList.remove("sticky");
5470			}
5471		}
5472	}
5473
5474	function initContactForm7Events() {
5475		window.dataLayer = window.dataLayer || [];
5476
5477		document.addEventListener('wpcf7mailsent', function (event) {
5478
5479			const formId = event.detail.contactFormId.toString();
5480			const isRFPForm = formId === '3861';
5481
5482			console.log('Form submission detected:', {
5483				formId: formId,
5484				status: 'mail_sent',
5485				isRFPForm: isRFPForm
5486			});
5487
5488			if (isRFPForm) {
5489				window.dataLayer.push({
5490					'event': 'RFP Form Completion',
5491					'formId': formId,
5492					'formTitle': event.detail.contactFormTitle || 'Plan an Event RFP'
5493				});
5494
5495				console.log('RFP Form submission tracked:', {
5496					'event': 'RFP Form Completion',
5497					'formId': formId,
5498					'formTitle': event.detail.contactFormTitle || 'Plan an Event RFP'
5499				});
5500			}
5501		});
5502	}
5503
5504	$document.ready(function() {
5505		userAgentBodyClass();
5506		marqueeJS();
5507		navspace();
5508		navMobile();
5509		allButtons();
5510		videoInline();
5511		module_photoContent();
5512		module_contentSlider();
5513		module_contentSliderAcc();
5514		module_quoteSlider();
5515		module_eventSlider();
5516		module_colContent();
5517		module_instagramRow();
5518		module_roomView();
5519		module_ourHotels();
5520		module_offerViewFilter();
5521		module_scenicRoute();
5522		module_caravanSwimClub();
5523		module_eventFeatured();
5524		module_journalFilter();
5525		module_bannerQuote();
5526		module_imageSliderContent();
5527		module_sliderContent();
5528		module_mediaContent();
5529		module_gatherView();
5530		module_photoGallery();
5531		module_dineView();
5532		module_imgRow();
5533		module_landscapeVideo();
5534		module_mediaMasonry();
5535		module_accordion();
5536		module_blogPost();
5537		module_form();
5538		module_contentForm();
5539		module_offerView();
5540		inviewBlockId();
5541		// bookingWidget();
5542		smoothScroll();
5543		// emailCapture_cendyn();
5544		emailCapture_revinate();
5545		footer();
5546		module_FeaturedSlider();
5547		initContactForm7Events();
5548		// setTimeout(function () {
5549		// 	if ($('.ot-sdk-show-settings').length > 0) {
5550		// 		$('.ot-sdk-show-settings').text('Cookie Settings');
5551		// 	}
5552		// }, 1500);
5553	});
5554
5555	$window.on('resize', function() {
5556
5557	});
5558
5559	$window.on('scroll', function() {
5560		bodyOnScroll();
5561		stickyGalleryBar();
5562	})
5563
5564	$window.on('load', function() {
5565		bodyOnScroll();
5566		module_altPhotoCon();
5567		adjustBannerPadding();
5568		animation();
5569		videAutoplayFix();
5570		thejune_popup_functionality();
5571	});
5572})(jQuery);

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.