/* Cookie Js _______________________________________________________ */

	var oUnitCookies = {
	
		lCookieExpires: 365,
		
		init: function () {
			
			if (GetCookie('bCookieBarClosed') != 'true') {
			
				if ($('section.unitcookieonpage').attr('data-cookieexpires') > 0) { this.lCookieExpires = $('section.unitcookieonpage').attr('data-cookieexpires').toString(); }
				
				$(window).on('click', $.proxy(function(oEvent) {
					if (!$.contains($('#unitcookieonpageBar')[0], oEvent.target)) {
						this.closeBarAndSetCookie();
					}
				}, this));
				
			}
		
		},
		
		closeBarAndSetCookie: function() {
		
			$('#unitcookieonpageBar').hide();
			SetCookie('bCookieBarClosed', 'true', this.lCookieExpires);
		
		}
	
	};
	
	onScrMngrLoaded(function() {
	
		$(document).ready(function(){
			oUnitCookies.init();
		});
	
	});
	
/* Custom Javascript ______________________________________________*/

	var oPano = { autumn: undefined, winter: undefined, spring: undefined, summer: undefined, summer2: undefined};
	
	function renderDefaultIcons (sParent) {
	
		sParent = sParent == undefined ? '' : sParent + ' ';
		
		$(sParent + "*.icon1 ul li, " + sParent + "ul.icon1 li").each(function() {
		
			var oElement = $('> svg.icon-next bgicon', this);
			
			if (oElement.length) {
				$(oElement).html('');
			} else {
				$(this).html('<svg class="icon icon-next bgicon"><use xlink:href="#icon-next"></use></svg>' + $(this).html());
				oElement = $('> svg.icon-next bgicon', this);
			}
		
		});
	
	}
	
	function positionBreadcrumb () {
	
		var oBreadcrumb = $('[itemprop="breadcrumb"]');
		if (!oBreadcrumb.length) return;
		
		var oContainer = $('[data-breadcrumb="true"]').first().find('[data-breadcrumb-container="true"]');
		if (!oContainer.length) return;
		
		oContainer.html(oBreadcrumb[0].outerHTML);
		oBreadcrumb.remove();
	
	}
	
	function initObjectFit (sType, oContext) {
	
		oContext = oContext || document;
		var oObjects = $('[data-object-fit="' + sType + '"]', $(oContext));
		
		oObjects.each(function (i, o) {
		
			var oPicture, oVideo, oImg;
			var oElement = $(o);
			var bUseCssObjectFit = oElement.attr('data-object-fit-css');
			
			if (bUseCssObjectFit == 'true') {
				bUseCssObjectFit = true;
			} else if (bUseCssObjectFit == 'false') {
				bUseCssObjectFit = false;
			} else {
				bUseCssObjectFit = undefined; 
			}
			
			if (oElement.is('img')) oElement = oElement.parent();
			
			if (oElement.data('bInitObjectFit') == true) {
			
				oElement.objectFit(sType, bUseCssObjectFit);
			
			} else {
			
				oElement.data('bInitObjectFit', true);
				
				if (oElement.is('picture') || oElement.find('picture').length || oElement.is('video') || oElement.find('video').length) {
				
					if (oElement.is('picture')) {
						oPicture = oElement;
					} else if (oElement.is('video')) {
						oVideo = oElement;
					} else {
						oPicture = oElement.find('picture');
						oVideo = oElement.find('video');
					}
					
					oPicture.each(function () {
					
						oImg = $(this).find('img');
						
						if (oImg.length) {
							$('<img />').on('load', function () {
								oElement.objectFit(sType, bUseCssObjectFit);
							}).attr('src', oImg.attr('src'));
						} else {
							$(this).on('image:load', function () {
								$(this).closest('[data-object-fit="' + sType + '"]').objectFit(sType, bUseCssObjectFit);
							})
						}
					
					});
					
					oVideo.each(function () {
					
						if ($(this).attr('bVideoConverted') == 'true') {
							oElement.objectFit(sType, bUseCssObjectFit);
						} else {
							$(this).one('video:converted', $.proxy(function () {
								$(this).closest('[data-object-fit="' + sType + '"]').objectFit(sType, bUseCssObjectFit);
							}, this));
						}
					
					});
				
				} else if (oElement.find('img').length) {
				
					oElement.find('img').each(function () {
						$('<img />').load(function () {
							oElement.objectFit(sType, bUseCssObjectFit);
						}).attr('src', $(this).find('img').attr('src'));
					});
				
				}
			
			}
		
		});
	
	}
	
	function initAdaptHeight (oContext) {
	
		oContext = oContext || document;
		
		$('[data-adapt-height="true"]', $(oContext)).each(function (i, o){
		
			var oElement = $(this);
			
			if (oElement.data('bInitAdaptHeight') !== true) {
			
				oElement.data('bInitAdaptHeight', true);
				var lMinWidth = parseInt(oElement.attr('data-adapt-height-min-width'), 10) || 0;
				var lMinHeight = parseInt(oElement.attr('data-adapt-height-min-height'), 10) || 0;
				
				RespHelper.on('resize:change',  $.proxy(function () {
				
					var oElem = $(this);
					var sSelector = oElement.attr('data-adapt-height-selector');
					var lHeight = $(window).height();
					var lLastHeight = oElem.data('lLastAdaptedHeight') || -1;
					var lMultiplier = parseInt(oElement.attr('data-adapt-height-multiplier'), 10) || 1;
					
					lHeight = lHeight * lMultiplier;
					
					if (sSelector != undefined && sSelector != '') {
					
						$(sSelector).each(function () {
							lHeight -= $(this).outerHeight();
						});
					
					}
					
					if (lHeight > $(window).width() && lMinHeight > 0) {
					
					 lHeight = lMinHeight;
					
					}
					
					if (lLastHeight == lHeight && oElement.hasClass('adapted-height')) return;
					
					oElem.data('lLastAdaptedHeight', lHeight);
					
					oElem.css('height', lHeight);
					oElem.addClass('adapted-height');
					
					initObjectFit('cover', oElem.parent());
				
				}, this), { lMinWidth: lMinWidth + 1, lMinHeight: lMinHeight + 1, sOperator: 'and' });
				
				if (lMinWidth > 0 || lMinHeight > 0) {
				
					RespHelper.on('resize:change', $.proxy(function () {
					
						var oElem = $(this);
						if (!oElem.hasClass('adapted-height')) return;
						
						oElem.css('height', '');
						oElem.removeClass('adapted-height');
						
						initObjectFit('cover', oElem.parent());
					
					}, this), { lMaxWidth: lMinWidth, lMaxHeight: lMinHeight });
				
				}
			
			}
		
		});
		
		RespHelper.fire('resize:change')
	
	}
	
	$(function() {
	
		positionBreadcrumb();
		initAdaptHeight();
		initObjectFit('cover');
		
		$(window).on('DOMContentLoaded load resize scroll', function() { animations(); }).trigger('scroll');
		
		$(window).on('DOMContentLoaded load resize scroll transitionend animationend webkitAnimationEnd', function() {
			$('[data-carousel="false"][data-carousel-start="visibleInViewport"]').each(function(){
				if ($(this).visibleInViewport(true)) {
					$(this).attr('data-carousel', 'true');
					initCarousel($(this), $(this).attr('data-carousel-config'));
				}
			});
		});
		
		if (GetCookie('Page_bNoLoader') == '') {
			SetCookie('Page_bNoLoader', 'true', 1);
		}
		
		var resizeTimer;
		$(window).resize(function() {
			clearTimeout(resizeTimer);
			resizeTimer = setTimeout(function() { $('[data-object-fit="cover"]').objectFit('cover'); }, 200);
		});
		
		renderDefaultIcons();
		
		var aFeatures = ['transition', 'transform'];
		var sPrefix;
		for (var i = 0; i < aFeatures.length; i++) {
		
			sPrefix = 'no';
			if (detectCSSFeature(aFeatures[i])) sPrefix = 'with';
			
			$(document.body).addClass(sPrefix + aFeatures[i]);
		
		}
	
	});
	
	function detectCSSFeature (sFeatureName){
	
		var bFeature = false;
		var aDomPrefixes = 'Webkit Moz ms O'.split(' ');
		var oBody = document.body;
		var sFeatureNameCapital;
		
		sFeatureName = sFeatureName.toLowerCase();
		
		if(oBody.style[sFeatureName] !== undefined) { bFeature = true; } 
		
		if(bFeature === false) {
		
			sFeatureNameCapital = sFeatureName.charAt(0).toUpperCase() + sFeatureName.substr(1);
			for( var i = 0; i < aDomPrefixes.length; i++ ) {
			
				if( oBody.style[aDomPrefixes[i] + sFeatureNameCapital ] !== undefined ) {
				  bFeature = true;
				  break;
				}
			
			}
		
		}
		return bFeature;
	
	}
	
	function setColorLuminance (sColor, fLum) {
	
		if (sColor.substr(0, 3) == 'rgb') {
			eval('sColor = rgb2hex' + sColor.substr(3));
		}
		
		sColor = String(sColor).replace(/[^0-9a-f]/gi, '');
		
		if (sColor.length < 6) {
			sColor = sColor[0] + sColor[0] + sColor[1] + sColor[1] + sColor[2] + sColor[2];
		}
		
		fLum = fLum || 0;
		
		var sRgb = "#", c, i;
		
		for (i = 0; i < 3; i++) {
		
			c = parseInt(sColor.substr(i * 2, 2), 16);
			c = Math.round(Math.min(Math.max(0, c + (c * fLum)), 255)).toString(16);
			sRgb += ("00" + c).substr(c.length);
		
		}
		
		return sRgb;
	
	}
	
	function rgb2hex (r, g, b) {
	
		return '#' + r.toString(16) + g.toString(16) + b.toString(16);
	
	}
	
	function animations() {
		
		$('[data-animation="True"]').each(function() {
			
			if ($(this).data('animationtype')) {
			
				var aAnimationTypes = $(this).data('animationtype').split(',');
				
				for (i = 0; i < aAnimationTypes.length; i ++) {
				
					if (aAnimationTypes[i] == 'scrollv1') {
						
						var oInnerElement = $(this).find('[data-animationcontainer="this"]');
						
						if ($(window).scrollTop() + $(window).outerHeight() * 0.85 > oInnerElement.offset().top) {
						
							oInnerElement.addClass('fadein');
							
						}
						
					}
					
				}
				
			}
			
		});
		
	}
	
	function scrollToNextSection (oThis) {
	
		if ($(oThis).closest('section').next('section').length) {
			$('html, body').animate({
				scrollTop: $(oThis).closest('section').next('section').offset().top
			}, 500);
		}
	
	}
	
	function toggleElement (oThis) {
	
		$(oThis).closest('section').find('.toggleMobile').slideDown();
		$(oThis).closest('.readmore').hide();
	
	}
	
	function startLoader () {
	
		$(function() {
		
			window.setTimeout(function() {
						
				$('div.LoaderT1').first().addClass('loaded');
				
				window.setTimeout(function() {
				
					$('div.LoaderT1').first().addClass('fadeout');
					
					window.setTimeout(function() {
					
						$('div.LoaderT1').first().hide();
						$('body').removeClass('loader');
						$('[data-carousel="false"]').each(function() {
						
							$(this).width($(window).outerWidth());
							$(this).attr('data-carousel', 'true');
							$(this).find('video').attr('data-autoplay', 'true');
							initCarousel($(this), $(this).data('carousel-config'));
						
						});
					
					}, 1000);
				
				}, 2000);
			
			}, 4000);
		
		});
	
	}
var oTrust = {

	init: function () {	
	
		$('[data-mobile-carousel="true"]').each(function(lIndex, oElement) {
		
			var lWindowWidth = parseInt($(oElement).attr('data-mobile-carousel-maxwidth'), 10) || 600;
			
			if ($(window).width() <= lWindowWidth) { 
				this.startCarousel(oElement)
			}
			
			RespHelper.one('resize:change', function() {
				
				this.startCarousel(oElement);
			
			}.bind(this), {
				lMaxWidth: lWindowWidth
			});
			
			RespHelper.one('resize:change', function() {
			
				this.stopCarousel(oElement);
			
			}.bind(this), {
				lMinWidth: lWindowWidth + 1
			});
		
		}.bind(this));
	
	},
	
	startCarousel: function (oElement) {
	
		initCarousel(oElement);
	
	},
	
	stopCarousel: function (oElement) {
	
		$(oElement).trigger('destroy.owl.carousel');
	
	}

};

onScrMngrLoaded(function() {
	$(document).ready(function() {
		oTrust.init();
	});
});
var oThemestage = {

	init: function () {	
	
		$('section.themestage.map').find('div.clickpoint').each(function (lIndex, oElement) {
		
			$(oElement).on('click mouseover mouseout', function (evt) {
				$('section.themestage.map').find('div.clickpoints div.clickpointInner[data-clickpoint]').removeClass('active');
				if (evt.type != 'mouseout') {
					$('section.themestage.map').find('div.clickpoints div.clickpointInner[data-clickpoint=' + $(oElement).attr('data-clickpoint') + ']').addClass('active');
				}
			});
		
		});
		
		$('section.themestage.map').find('div.clickpoints div.clickpointInner').each(function (lIndex, oElement) {
		
			$(oElement).on('click mouseover mouseout', function (evt) {
				$('section.themestage.map').find('div.clickpoint[data-clickpoint]').removeClass('active');
				if (evt.type != 'mouseout') {
					$('section.themestage.map').find('div.clickpoint[data-clickpoint=' + $(oElement).attr('data-clickpoint') + ']').addClass('active');
				}
			});
		
		});
	
	}

};

onScrMngrLoaded(function() {
	$(document).ready(function() {
		oThemestage.init();
	});
});
var oTeaser = {
	
	init: function () {	
			
		if ($(window).width() > 800) { 
			this.startCarousel()
		}
		
		RespHelper.one('resize:change', function() {
			
			this.stopCarousel();
		
		}.bind(this), {
			lMaxWidth: 800
		});
		
		RespHelper.one('resize:change', function() {
				
			this.startCarousel();
		
		}.bind(this), {
			lMinWidth: 801
		});
		
		this.checkAndSetDetailLink();
		
	},
	startCarousel: function () {
		
		$('[data-desktop-carousel="true"]').each(function(lIndex, oElement) {
		
			initCarousel(this);
		
		});
		
	},
	stopCarousel: function () {
		
		var owl = $('.owl-carousel[data-desktop-carousel="true"]');
 		owl.trigger('destroy.owl.carousel');
		
	},
	checkAndSetDetailLink: function() {
		
		$('section.teaser[data-unit-elementlinked="true"]').each(function () {
		
			$('[data-unit-detaillink]:not([data-unit-detaillink=""])', $(this)).each(function (lIndex, oElement) {
			
				oElement = $(oElement);
				
				oElement.addClass('hover');
				
				$(oElement).find('a[class!="liveedit"]').each( function () {
					$(this).removeAttr("href");
				});
				
				oElement.click(function (o) {
					if (!$(o.target).closest('div.liveedit').length) {
						if ($(oElement).attr('data-unit-detaillink-target') != undefined && $(oElement).attr('data-unit-detaillink-target') != '') {
							window.open(oElement.attr('data-unit-detaillink'), $(oElement).attr('data-unit-detaillink-target'));
						} else {
							window.location.href = oElement.attr('data-unit-detaillink');
						}
					}
				});
			
			});
		
		});
	
	},
	
	toggleOverlay: function (oThis) {
	
		var oTeaser = $(oThis).closest('div.teaserElement');
		
		oTeaser.closest('.owl-carousel').trigger('stop.owl.autoplay');
		
		if ($(oTeaser).find('div.overlay.open').length) {
			$(oTeaser).removeClass('overlay-open');
			$(oTeaser).find('div.overlay.open').removeClass('open');
		} else {
			$(oTeaser).addClass('overlay-open');
			$(oTeaser).find('div.overlay').addClass('open');
		}
	
	},
	
	loadPanoView: function (oThis, sPanoSeason, sXmlUrl, sSharedKey) {
		
		if (oPano[sPanoSeason] == undefined) {
		
			var oPanoViewContainer = $(oThis).closest('section').find('div.panoviewContainer');
			var oPanoViewDiv = oPanoViewContainer.find('div.panoview');
			
			var ua = window.navigator.userAgent;
			var msie = ua.indexOf('MSIE ');
			
			$.ajax(msie > 0 ? encodeURI(this.sAjaxUrl) : this.sAjaxUrl, {
			
				data:{
					sSharedKey: sSharedKey,
					sPanoSeason: sPanoSeason
				},
				type: 'POST',
				complete: function(data){
				
					data = data.responseText;
					
					oPanoViewContainer.show();
					oPanoViewContainer.addClass('panoopen');
					oPanoViewContainer.removeClass('panoclose');
					oPanoViewDiv.html(data);
					
					if (sXmlUrl != undefined) {
					
						oPano[sPanoSeason].readConfigUrlAsync(sXmlUrl);
						checkIfPanoSoundIsPlaying(oPano[sPanoSeason]);
						checkIfPanoIsLoaded(oPano[sPanoSeason]);
					
					}
				
				}
				
			});
			
		} else {
			
			this.openPanoView(oThis, sPanoSeason);
			
		}
		
	},
	
	openPanoView: function (oThis, sPanoSeason) {
		
		oPano[sPanoSeason].playSound();
		oPano[sPanoSeason].startAutorotate();
		
		var oPanoViewContainer = $(oThis).closest('section').find('div.panoviewContainer');;
		
		oPanoViewContainer.removeClass('panoclose');
		oPanoViewContainer.addClass('panoopen');
		oPanoViewContainer.show();
		
	}
	
};

onScrMngrLoaded(function() {
	$(document).ready(function() {
		oTeaser.init();
	});
});

/* SalesContent RequestT1 __________________________________________________________ */
	
	var oSalesContentRequest = {
	
		bViomaInit: false,
		
		init: function () {
		
			if ($('[data-requesthotels] div.row.checkbox input').length > 1) {
			
				$('[data-requesthotels]').show();
				
				$('[data-requesthotels] div.row.checkbox input').on('click', function() {
					this.setHotelIDs();
				}.bind(this));
			
			}
		
		},
		
		toggleAdditionalChildren: function () {
		
			$('#additionalChildrenInfo').hide();
			$('#additionalChildren').show();
		
		},
		
		scrollToSectionBegin: function (sType) {
		
			if (sType != undefined) {
				this.toggleForm(sType);
			} else {
				$('body, html').animate({
					scrollTop: $('[data-requestform]').offset().top
				}, 250);
			}
		
		},
		
		setHotelIDs: function () {
		
			var sHotelIDs = '';
			$('[data-requesthotels] input:checked').each(function() {
				sHotelIDs = sHotelIDs + ',' + $(this).val();
			});
			
			$('#UnitPortalRequestFormularsHotelIDs').val(sHotelIDs.substr(1));
			
			$('#UnitPortalRequestErrorNoHotels').hide();
		
		},
		
		removeOffer: function () {
		
			$('[data-requestform-offer]').hide();
			$('#UnitPortalRequestFormularlOfferID').val(-1);
			if ($('#UnitPortalRequestFormularlOfferID').prop("tagName").toLowerCase() == 'select') {
				$('#UnitPortalRequestFormularlOfferID').trigger('change');
			}
			$('#UnitPortalRequestFormularsOfferName').val('');
			if ($('[data-requestform-offer] [data-requestform-offer-name]').length) $('[data-requestform-offer] [data-requestform-offer-name]').html('');
			if ($('[data-requestform-offer] [data-requestform-offer-duration]').length) $('[data-requestform-offer] [data-requestform-offer-duration]').html('');
			if ($('[data-requestform-offer] [data-requestform-offer-nights]').length) $('[data-requestform-offer] [data-requestform-offer-nights]').html('');
			if ($('[data-requestform-offer] [data-requestform-offer-price]').length) $('[data-requestform-offer] [data-requestform-offer-price]').html('');
			
			$('[data-requestform="true"] div.hotels div.hotel').removeClass('disabled');
		
		},
		
		toggleForm: function (sType, bSkipScroll, lPackageId) {
		
			if (sType == 'request') {
				$('[data-requestbookingtab="request"]').show();
				$('[data-requestbookingtab="booking"]').hide();
			} else {
				$('[data-requestbookingtab="request"]').hide();
				$('[data-requestbookingtab="booking"]').show();
				if (!this.bViomaInit) {
					initVioma(lPackageId);
				} else if (lPackageId != undefined) {
					vcst( { id: parseInt($('[data-requestbookingtab="booking"]').attr('data-bookingIntegrationID'), 10), 'package': lPackageId } );
				}
				this.bViomaInit = true;
			}
			
			if (!bSkipScroll) {
				$('body, html').animate({
					scrollTop: $('[data-requestbookingtab="' + sType + '"]').offset().top
				}, 250);
			}
		
		}
	
	};
	
/* RequestSkiRental _____________________________________________________________*/
	
	var oRequestSkiRental = {
	
		sFormName: 'section.RequestSkiRental form',
		
		setAgeFields: function (ElementCount) {
		
			$(this.sFormName).find('.persons').hide();
			
			for (j = 1; j <= 8; j++) {
			
				$(this.sFormName).find('.person' + j).hide();
			
			}
			
			for (i = 1; i <= ElementCount; i++) {
			
				$(this.sFormName).find('.persons').show();
				$(this.sFormName).find('.person' + i).show();
			
			}
		
		},
	
	};
/* Garden Gnome Software - Skin 
Pano2VR 5.0.3/15088
Filename: Skin_Verlauf_1.ggsk
Generated Mi. Jan. 18 17:16:52 2017 */

function pano2vrSkin(player,sTopPageKey,sSeason,base) {
	var ggSkinVars = [];
	var me=this;
	var flag=false;
	this.player=player;
	this.player.skinObj=this;
	this.divSkin=player.divSkin;

	this.divSkinContainer = document.createElement('div');
	var hsContainer='';
		hsContainer+='position: absolute;';
		hsContainer+='left: 0px;';
		hsContainer+='bottom: 0px;';
		hsContainer+='text-align: center;';
		hsContainer+='width: 100%;';
	this.divSkinContainer.setAttribute('style',hsContainer);
	this.divSkinContainer.className = 'skinContainer';
	this.divSkin.appendChild(this.divSkinContainer);
	
	this.ggUserdata=me.player.userdata;
	this.lastSize={ w: -1,h: -1 };
	var basePath="";
	/* auto detect base path */
	if (base=='?') {
		var scripts = document.getElementsByTagName('script');
		for(var i=0;i<scripts.length;i++) {
			var src=scripts[i].src;
			if (src.indexOf('skin.js')>=0) {
				var p=src.lastIndexOf('/');
				if (p>=0) {
					basePath=src.substr(0,p+1);
				}
			}
		}
	} else
	if (base) {
		basePath=base;
	}
	this.elementMouseDown=[];
	this.elementMouseOver=[];
	var cssPrefix='';
	var domTransition='transition';
	var domTransform='transform';
	var prefixes='Webkit,Moz,O,ms,Ms'.split(',');
	var i;
	if (typeof document.body.style['transform'] == 'undefined') {
		for(var i=0;i<prefixes.length;i++) {
			if (typeof document.body.style[prefixes[i] + 'Transform'] !== 'undefined') {
				cssPrefix='-' + prefixes[i].toLowerCase() + '-';
				domTransition=prefixes[i] + 'Transition';
				domTransform=prefixes[i] + 'Transform';
			}
		}
	}
	
	this.player.setMargins(0,0,0,0);
	
	this.updateSize = (function(startElement) {
		var stack=[];
		stack.push(startElement);
		while(stack.length>0) {
			var e=stack.pop();
			if (e.ggUpdatePosition) {
				e.ggUpdatePosition();
			}
			if (e.hasChildNodes()) {
				for(var i=0;i<e.childNodes.length;i++) {
					stack.push(e.childNodes[i]);
				}
			}
		}
	});
	
	parameterToTransform = (function(p) {
		var hs='translate(' + p.rx + 'px,' + p.ry + 'px) rotate(' + p.a + 'deg) scale(' + p.sx + ',' + p.sy + ')';
		return hs;
	});
	
	this.findElements = (function(id,regex) {
		var r=[];
		var stack=[];
		var pat=new RegExp(id,'');
		stack.push(me.divSkin);
		while(stack.length>0) {
			var e=stack.pop();
			if (regex) {
				if (pat.test(e.ggId)) r.push(e);
			} else {
				if (e.ggId==id) r.push(e);
			}
			if (e.hasChildNodes()) {
				for(var i=0;i<e.childNodes.length;i++) {
					stack.push(e.childNodes[i]);
				}
			}
		}
		return r;
	});
	
	this.addSkin = (function() {
		
		var hs='';
		hs+='height : 100px;';
		hs+='position : relative;';
		hs+='display : inline-block;';
		hs+='visibility : inherit;';
		hs+='width : 100px;';
		
		this.ggCurrentTime=new Date().getTime();
		
		/*  image 1 */
		this._image_1=document.createElement('div');
		this._image_1__img=document.createElement('img');
		this._image_1__img.className='ggskin ggskin_image';
		this._image_1__img.setAttribute('src',basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/image_node1.png');
		this._image_1__img.setAttribute('style','position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;-webkit-user-drag:none;pointer-events:none;');
		this._image_1__img.className='ggskin ggskin_image ggskin_image_node1';
		this._image_1__img['ondragstart']=function() { return false; };
		me.player.checkLoaded.push(this._image_1__img);
		this._image_1.appendChild(this._image_1__img);
		this._image_1.ggId="Image 6";
		this._image_1.ggParameter={ rx:0,ry:0,a:0,sx:1,sy:1 };
		this._image_1.ggVisible=true;
		this._image_1.className='ggskin ggskin_image ';
		this._image_1.ggType='image';
		this._image_1.setAttribute('style',hs);
		this._image_1.style[domTransform + 'Origin']='50% 50%';
		me._image_1.ggIsActive = (function() {
			return false;
		});
		me._image_1.ggElementNodeId = (function() {
			return me.player.getCurrentNode();
		});
		this._image_1.onclick = (function () {
			me.player.openNext("{node1}","");
		});
		this._image_1.ggUpdatePosition = (function () {
		});
		this.divSkinContainer.appendChild(this._image_1);
		
		/* image 2 */
		this._image_2=document.createElement('div');
		this._image_2__img=document.createElement('img');
		this._image_2__img.className='ggskin ggskin_image';
		this._image_2__img.setAttribute('src',basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/image_node2.png');
		this._image_2__img.setAttribute('style','position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;-webkit-user-drag:none;pointer-events:none;');
		this._image_2__img.className='ggskin ggskin_image ggskin_image_node2';
		this._image_2__img['ondragstart']=function() { return false; };
		me.player.checkLoaded.push(this._image_2__img);
		this._image_2.appendChild(this._image_2__img);
		this._image_2.ggId="Image 1";
		this._image_2.ggParameter={ rx:0,ry:0,a:0,sx:1,sy:1 };
		this._image_2.ggVisible=true;
		this._image_2.className='ggskin ggskin_image ';
		this._image_2.ggType='image';
		this._image_2.setAttribute('style',hs);
		this._image_2.style[domTransform + 'Origin']='50% 50%';
		me._image_2.ggIsActive = (function() {
			return false;
		});
		me._image_2.ggElementNodeId = (function() {
			return me.player.getCurrentNode();
		});
		this._image_2.onclick = (function () {
			me.player.openNext("{node2}","");
		});
		this._image_2.ggUpdatePosition = (function () {
		});
		this.divSkinContainer.appendChild(this._image_2);
		
		if (sSeason == 'summer2' || (sTopPageKey == 'renon' && sSeason == 'winter')) {
		
			/*  sun */
			this._sun = document.createElement('div');
			this._sun_img = document.createElement('img');
			this._sun_img.className='sun';
			this._sun_img.setAttribute('src',basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/sun.png');
			this._sun_img.setAttribute('style','position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;-webkit-user-drag:none;pointer-events:none;');
			this._sun.appendChild(this._sun_img);
			this._sun.setAttribute('style',hs);
			this._sun.ggUpdatePosition=(function () {
			});
			this.divSkinContainer.appendChild(this._sun);
			
		}
		
		/* image3 */
		this._image_3=document.createElement('div');
		this._image_3__img=document.createElement('img');
		this._image_3__img.className='ggskin ggskin_image';
		this._image_3__img.setAttribute('src',basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/image_node3.png');
		this._image_3__img.setAttribute('style','position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;-webkit-user-drag:none;pointer-events:none;');
		this._image_3__img.className='ggskin ggskin_image ggskin_image_node3';
		this._image_3__img['ondragstart']=function() { return false; };
		me.player.checkLoaded.push(this._image_3__img);
		this._image_3.appendChild(this._image_3__img);
		this._image_3.ggId="Image 5";
		this._image_3.ggParameter={ rx:0,ry:0,a:0,sx:1,sy:1 };
		this._image_3.ggVisible=true;
		this._image_3.className='ggskin ggskin_image ';
		this._image_3.ggType='image';
		this._image_3.setAttribute('style',hs);
		this._image_3.style[domTransform + 'Origin']='50% 50%';
		me._image_3.ggIsActive = (function() {
			return false;
		});
		me._image_3.ggElementNodeId = (function() {
			return me.player.getCurrentNode();
		});
		this._image_3.onclick = (function () {
			me.player.openNext("{node3}","");
		});
		this._image_3.ggUpdatePosition = (function () {
		});
		this.divSkinContainer.appendChild(this._image_3);
		
		if (sSeason == 'autumn') {
		
			/*  sun */
			this._sun = document.createElement('div');
			this._sun_img = document.createElement('img');
			this._sun_img.className='sun';
			this._sun_img.setAttribute('src',basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/sun.png');
			this._sun_img.setAttribute('style','position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;-webkit-user-drag:none;pointer-events:none;');
			this._sun.appendChild(this._sun_img);
			this._sun.setAttribute('style',hs);
			this._sun.ggUpdatePosition=(function () {
			});
			this.divSkinContainer.appendChild(this._sun);
			
		}
		
		/* image 4 */
		this._image_4=document.createElement('div');
		this._image_4__img=document.createElement('img');
		this._image_4__img.className='ggskin ggskin_image';
		this._image_4__img.setAttribute('src',basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/image_node4.png');
		this._image_4__img.setAttribute('style','position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;-webkit-user-drag:none;pointer-events:none;');
		this._image_4__img.className='ggskin ggskin_image ggskin_image_node4';
		this._image_4__img['ondragstart']=function() { return false; };
		me.player.checkLoaded.push(this._image_4__img);
		this._image_4.appendChild(this._image_4__img);
		this._image_4.ggId="Image 4";
		this._image_4.ggParameter={ rx:0,ry:0,a:0,sx:1,sy:1 };
		this._image_4.ggVisible=true;
		this._image_4.className='ggskin ggskin_image ';
		this._image_4.ggType='image';
		this._image_4.setAttribute('style',hs);
		this._image_4.style[domTransform + 'Origin']='50% 50%';
		me._image_4.ggIsActive = (function() {
			return false;
		});
		me._image_4.ggElementNodeId = (function() {
			return me.player.getCurrentNode();
		});
		this._image_4.onclick = (function () {
			me.player.openNext("{node4}","");
		});
		this._image_4.ggUpdatePosition = (function () {
		});
		this.divSkinContainer.appendChild(this._image_4);
		
		if ((sSeason != 'summer2') && (sTopPageKey != 'renon' && sSeason != 'winter')) {
			/* image 5 */
			this._image_5=document.createElement('div');
			this._image_5__img=document.createElement('img');
			this._image_5__img.className='ggskin ggskin_image';
			this._image_5__img.setAttribute('src',basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/image_node5.png');
			this._image_5__img.setAttribute('style','position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;-webkit-user-drag:none;pointer-events:none;');
			this._image_5__img.className='ggskin ggskin_image ggskin_image_node5';
			this._image_5__img['ondragstart']=function() { return false; };
			me.player.checkLoaded.push(this._image_5__img);
			this._image_5.appendChild(this._image_5__img);
			this._image_5.ggId="Image 3";
			this._image_5.ggParameter={ rx:0,ry:0,a:0,sx:1,sy:1 };
			this._image_5.ggVisible=true;
			this._image_5.className='ggskin ggskin_image ';
			this._image_5.ggType='image';
			this._image_5.setAttribute('style',hs);
			this._image_5.style[domTransform + 'Origin']='50% 50%';
			me._image_5.ggIsActive = (function() {
				return false;
			});
			me._image_5.ggElementNodeId = (function() {
				return me.player.getCurrentNode();
			});
			this._image_5.onclick = (function () {
				me.player.openNext("{node5}","");
			});
			this._image_5.ggUpdatePosition = (function () {
			});
			this.divSkinContainer.appendChild(this._image_5);
		}
		
		if (sSeason != 'summer2' && (sTopPageKey != 'renon' && sSeason != 'winter')) {
			/* image6 */
			this._image_6=document.createElement('div');
			this._image_6__img=document.createElement('img');
			this._image_6__img.className='ggskin ggskin_image';
			this._image_6__img.setAttribute('src',basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/image_node6.png');
			this._image_6__img.setAttribute('style','position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;-webkit-user-drag:none;pointer-events:none;');
			this._image_6__img.className='ggskin ggskin_image ggskin_image_node6';
			this._image_6__img['ondragstart']=function() { return false; };
			me.player.checkLoaded.push(this._image_6__img);
			this._image_6.appendChild(this._image_6__img);
			this._image_6.ggId="Image 2";
			this._image_6.ggParameter={ rx:0,ry:0,a:0,sx:1,sy:1 };
			this._image_6.ggVisible=true;
			this._image_6.className='ggskin ggskin_image ';
			this._image_6.ggType='image';
			this._image_6.setAttribute('style',hs);
			this._image_6.style[domTransform + 'Origin']='50% 50%';
			me._image_6.ggIsActive = (function() {
				return false;
			});
			me._image_6.ggElementNodeId = (function() {
				return me.player.getCurrentNode();
			});
			this._image_6.onclick = (function () {
				me.player.openNext("{node6}","");
			});
			this._image_6.ggUpdatePosition = (function () {
			});
			this.divSkinContainer.appendChild(this._image_6);
		}
			
		if (sSeason == 'winter' && sTopPageKey != 'renon') {
		
			/* image7 */
			this._image_7=document.createElement('div');
			this._image_7__img=document.createElement('img');
			this._image_7__img.className='ggskin ggskin_image';
			this._image_7__img.setAttribute('src',basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/image_node7.png');
			this._image_7__img.setAttribute('style','position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;-webkit-user-drag:none;pointer-events:none;');
			this._image_7__img.className='ggskin ggskin_image ggskin_image_node7';
			this._image_7__img['ondragstart']=function() { return false; };
			me.player.checkLoaded.push(this._image_7__img);
			this._image_7.appendChild(this._image_7__img);
			this._image_7.ggId="Image 7";
			this._image_7.ggParameter={ rx:0,ry:0,a:0,sx:1,sy:1 };
			this._image_7.ggVisible=true;
			this._image_7.className='ggskin ggskin_image ';
			this._image_7.ggType='image';
			this._image_7.setAttribute('style',hs);
			this._image_7.style[domTransform + 'Origin']='50% 50%';
			me._image_7.ggIsActive = (function() {
				return false;
			});
			me._image_7.ggElementNodeId = (function() {
				return me.player.getCurrentNode();
			});
			this._image_7.onclick = (function () {
				me.player.openNext("{node7}","");
			});
			this._image_7.ggUpdatePosition = (function () {
			});
			this.divSkinContainer.appendChild(this._image_7);
			
		}
		
		
		
		this.divSkin.ggUpdateSize = (function(w,h) {
			me.updateSize(me.divSkin);
		});
		this.divSkin.ggViewerInit = (function() {
		});
		this.divSkin.ggLoaded = (function() {
		});
		this.divSkin.ggReLoaded = (function() {
		});
		this.divSkin.ggLoadedLevels = (function() {
		});
		this.divSkin.ggReLoadedLevels = (function() {
		});
		this.divSkin.ggEnterFullscreen = (function() {
		});
		this.divSkin.ggExitFullscreen = (function() {
		});
		this.skinTimerEvent();
	});
	this.hotspotProxyClick = (function(id) {
	});
	this.hotspotProxyOver = (function(id) {
	});
	this.hotspotProxyOut = (function(id) {
	});
	this.changeActiveNode = (function(id) {
		
		var lNodeID;
		
		for (var i = 0; i < me.player.getNodeIds().length; i++) {
			
			sNodeID = me.player.getNodeIds()[i];
			
			$('div.ggskin_image img.ggskin_image_' + sNodeID).attr('src', basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/image_' + sNodeID +'.png');
			
		}
		
		var sActiveNodeID = me.player.getCurrentNode();
		
		$('div.ggskin_image img.ggskin_image_' + sActiveNodeID).attr('src', basePath + '/images/panoview/' + sTopPageKey + '/' + sSeason + '/image_' + sActiveNodeID +'_active.png');
		
		me.ggUserdata=me.player.userdata;
		
	});
	this.skinTimerEvent = (function() {
		setTimeout(function() { me.skinTimerEvent(); }, 10);
		me.ggCurrentTime=new Date().getTime();
	});
	this.addSkin();
};

/*  Custom Functions ______________________________ */

	function stopPlaySound (oPanoObject) {
	
		if ($('section.PanoViewT1 div.sound').hasClass('paused')) {
			
			$('section.PanoViewT1 div.sound').removeClass('paused');
			$('section.PanoViewT1 div.sound').addClass('running');
			
			$('section.PanoViewT1 audio')[0].play();
			
		} else {
			
			$('section.PanoViewT1 div.sound').removeClass('running');
			$('section.PanoViewT1 div.sound').addClass('paused');
			
			$('section.PanoViewT1 audio')[0].pause();
			
		}
		
	}

/* Offers T1 _______________________________________________________________ */
	
	var oOffers = {
	
		lLastId: null,
		
		triggerCheckbox: function(oThis) {
		
			$(oThis).closest('form').find('input').prop('checked', false);
			$(oThis).closest('form').find('.tab.active').removeClass('active');
			
			if (this.lLastId != $(oThis).find('input').val()) {
			
				this.lLastId = $(oThis).find('input').val();
				
				if ($(oThis).hasClass('active')) {
					$(oThis).removeClass('active');
					$(oThis).find('input').prop('checked', false);
				} else {
					$(oThis).addClass('active');
					$(oThis).find('input').prop('checked', true);
					window.location.hash = "#" + $(oThis).attr('data-label-code');
				}
			
			} else {
			
				$(oThis).closest('form').find('.tab.alllabel').addClass('active');
				
				this.lLastId = null;
			
			}
			
			this.load($(oThis).closest('section'));
		
		},
		
		triggerCheckboxAll: function(oThis) {
		
			$(oThis).closest('form').find('input').prop('checked', false);
			$(oThis).closest('form').find('.tab.active').removeClass('active');
			
			$(oThis).addClass('active');
			history.pushState(null, null, window.location.href.split('#')[0]);
			
			this.lLastId = null;
			
			this.load($(oThis).closest('section'));
		
		},
		
		load: function(oSection) {
		
			$(oSection).find('.loading').show();
			
			var sParams = $(oSection).find('.filter form').serialize();
			sParams = sParams + "&sSharedKey=" + $(oSection).attr('data-sharedkey');
			
			var sLabels = '';
			$(oSection).find('.filter form input[type="checkbox"]:checked').each(function() {
				sLabels = sLabels + ',' + $(this).val();
			});
			
			this.setCookie('Page_OffersLabel' + $(oSection).attr('data-cookiesuffix'), sLabels.substr(1));
			
			$.ajax(location.protocol + '//' + location.host + location.pathname, {
				type: 'POST',
				data: sParams,
				complete: $.proxy(function(data) {
					$(oSection).find('.result').html($(data.responseText).find('div.listInner').html());
					$(oSection).find('.loading').hide();
				}, this)
			});
		
		},
		
		setCookie: function (sCookieName, sCookieValue) {
		
			sCookieName = '' + sCookieName;
			sCookieValue = '' + sCookieValue;
			
			document.cookie = sCookieName.replace('Page_', 'Page%5F') + '=' + UrlEncode(sCookieValue) + ';Domain=' + location.host + ';path=' + location.pathname;
		
		},
		
		scrollPrev: function (oThis) {
		
			$(oThis).closest('div.listOuter').find('[data-carousel="true"]').trigger('prev.owl.carousel');
			if ($(oThis).closest('div.listOuter').find('[data-carousel="true"]').find('.owl-item:first-child').hasClass('active')) { $(oThis).find('svg').hide(); }
			$(oThis).closest('div.listOuter').find('.gallerybtn.next svg').show();
		
		},
		
		scrollNext: function (oThis) {
		
			$(oThis).closest('div.listOuter').find('[data-carousel="true"]').trigger('next.owl.carousel');
			if ($(oThis).closest('div.listOuter').find('[data-carousel="true"]').find('.owl-item:last-child').hasClass('active')) { $(oThis).find('svg').hide(); }
			$(oThis).closest('div.listOuter').find('.gallerybtn.prev svg').show();
		
		},
		
		setOfferAndScrollToForm: function (oData) {
		
			var bOfferIsSelectBox = false;
			
			$('[data-requestform-offer]').show();
			
			if (oData.bOfferGroup) {
			
				var oOfferField = $('#UnitPortalRequestFormularlOfferGroupID');
				
				if ($('#UnitPortalRequestFormularlOfferID').length) {
					$('#UnitPortalRequestFormularlOfferID').val(-1);
				}
			
			} else {
			
				var oOfferField = $('#UnitPortalRequestFormularlOfferID');
				
				if ($('#UnitPortalRequestFormularlOfferGroupID').length) {
					$('#UnitPortalRequestFormularlOfferGroupID').val(-1);
				}
			
			}
			
			if (oOfferField.length) {
			
				oOfferField.val(oData.lOfferID);
				if (oOfferField.prop("tagName").toLowerCase() == 'select') {
					bOfferIsSelectBox = true;
					oOfferField.trigger('change');
				}
			
			}
			
			if ($('body').find('.lg-outer').length && $('body').find('.lg-outer .lg-close').length) {
				$('body').find('.lg-outer .lg-close').trigger('click');
			}
			
			if (parseInt(oData.lOfferID, 10) < 0) {
				if ($('#UnitPortalRequestFormularsOfferName').length) $('#UnitPortalRequestFormularsOfferName').val(oData.sOfferName);
			}
			
			if (!bOfferIsSelectBox) {
				if ($('[data-requestform-offer] [data-requestform-offer-name]').length) $('[data-requestform-offer] [data-requestform-offer-name]').html(oData.sOfferName);
				if ($('[data-requestform-offer] [data-requestform-offer-duration]').length) $('[data-requestform-offer] [data-requestform-offer-duration]').html(oData.dtFrom + ' - ' + oData.dtTo);
				if ($('[data-requestform-offer] [data-requestform-offer-nights]').length) $('[data-requestform-offer] [data-requestform-offer-nights]').html(oData.sNightsDic);
				if ($('[data-requestform-offer] [data-requestform-offer-price]').length) $('[data-requestform-offer] [data-requestform-offer-price]').html(oData.sMinPrice);
			}
			
			oSalesContentRequest.toggleForm('request', true);
			
			if ($('[data-requestbookingtab="request"]').length) {
				var oElement = $('[data-requestbookingtab="request"]');
			} else {
				var oElement = $('[data-requestform]');
			}
			
			$('body, html').animate({
				scrollTop: oElement.offset().top
			}, 250);
		
		},
		
		setOfferInBookingWidgetAndScrollToForm: function (lPackageId) {
		
			if ($('[data-requestbookingtab="booking"]').length && lPackageId > 0) {
			
				if ($('body').find('.lg-outer').length && $('body').find('.lg-outer .lg-close').length) {
					$('body').find('.lg-outer .lg-close').trigger('click');
				}
				
				var oElement = $('[data-requestbookingtab="booking"]');
				
				oSalesContentRequest.toggleForm('booking', true, lPackageId);
				
				$('body, html').animate({
					scrollTop: oElement.offset().top
				}, 250);
			
			}
		
		},
		
		setFilterWithHash : function() {
			
			var sHash = window.location.hash;
			
			if (sHash != '') {
				
				sHash = sHash.replace('#', '');
				var oTab = $('.offers .filter [data-label-code="' + sHash + '"]');
				if (oTab.length == 1) {
					if (!oTab.hasClass('active')) {
						oTab.trigger('click');
					}
				}
				
			} else {
				
				var oTab = $('section.offers.withtwocolumns[data-eof="True"] div.filter div.tab').first();
				oTab.trigger('click');
				
			}
			
		}
	
	};
	
	onScrMngrLoaded(function() {
	
		$(function() {
			
			oOffers.setFilterWithHash();
			
		});
	
	});

/* List T1 _______________________________________________________________ */
	
	var oList = {
	
		lLastId: null,
		
		init: function () {
		
			var lDiary = 1;
			
			$('section.list.diary').each(function() {
			
				if ($(this).prev('section.intro.centered').length) {
				
					$(this).attr('data-diaryIndex', lDiary);
					
					var lCount = $('section.list.diary article.element').length;
					var sHtml = '';
					
					for (var i = 1; i <= lCount; i++) {
					
						sHtml = sHtml + '<a onclick="oList.goToDiary(' + lDiary + ', ' + i + ');" class="default t3">' + i + '</a>';
					
					}
					
					var oElement = $(this).prev('section.intro.centered').find('div.chapter');
					
					oElement.find('[data-chapter-container]').html(sHtml);
					oElement.removeClass('hidden');
					
					lDiary++;
				
				}
			
			});
			
			this.checkAndSetDetailLink();
		
		},
		
		goToDiary: function (lDiary, lIndex) {
		
			$('body, html').animate({
				scrollTop: $('section.list.diary[data-diaryIndex="' + lDiary + '"]').find('[data-element-index="' + lIndex + '"]').offset().top
			}, 250);
		
		},
		
		triggerCheckbox: function(oThis) {
		
			var sLocation = location.href;
			var aMatches = /\/[0-9]+\-([0-9]+).html/g.exec(sLocation);
			
			if (aMatches.length == 2 && aMatches[1].toString() != '0') {
				sLocation = sLocation.replace('-' + aMatches[1] + '.html', '-0.html');
				window.history.pushState(null, null, sLocation);
			}
			
			$(oThis).closest('form').find('input').prop('checked', false);
			$(oThis).closest('form').find('.tab.active').removeClass('active');
			
			if (this.lLastId != $(oThis).find('input').val()) {
			
				this.lLastId = $(oThis).find('input').val();
				
				if ($(oThis).hasClass('active')) {
					$(oThis).removeClass('active');
					$(oThis).find('input').prop('checked', false);
				} else {
					$(oThis).addClass('active');
					$(oThis).find('input').prop('checked', true);
				}
			
			} else {
			
				$(oThis).closest('form').find('.tab.alllabel').addClass('active');
				
				this.lLastId = null;
			
			}
			
			this.load(oThis.closest('section'));
		
		},
		
		triggerCheckboxAll: function(oThis) {
		
			$(oThis).closest('form').find('input').prop('checked', false);
			$(oThis).closest('form').find('.tab.active').removeClass('active');
			
			$(oThis).addClass('active');
			
			this.lLastId = null;
			
			this.load(oThis.closest('section'));
		
		},
		
		load: function(oSection) {
		
			$(oSection).find('.loading').show();
			
			var sParams = $(oSection).find('.filter form').serialize();
			sParams = sParams + "&sSharedKey=" + $(oSection).attr('data-sharedkey');
			
			var sLabels = '';
			$(oSection).find('.filter form input[type="checkbox"]:checked').each(function() {
				sLabels = sLabels + ',' + $(this).val();
			});
			
			this.setCookie('Page_ListLabel' + $(oSection).attr('data-cookiesuffix'), sLabels.substr(1));
			
			$.ajax(location.protocol + '//' + location.host + location.pathname, {
				type: 'POST',
				data: sParams,
				complete: $.proxy(function(data) {
					$(oSection).find('.result').html($(data.responseText).find('div.listInner').html());
					$(oSection).find('.loading').hide();
				}, this)
			});
		
		},
		
		setCookie: function (sCookieName, sCookieValue) {
		
			sCookieName = '' + sCookieName;
			sCookieValue = '' + sCookieValue;
			
			document.cookie = sCookieName.replace('Page_', 'Page%5F') + '=' + UrlEncode(sCookieValue) + ';Domain=' + location.host + ';path=/;';
		
		},
		
		openCloseDownloads: function (oThis) {
		
			var oDownlodsBox = $(oThis).parents('article').find('div.downloads');
			var oSvg = $(oThis).find('svg');
			var oSvgUse = $(oThis).find('use');
			
			if (oDownlodsBox.length > 0) {
			
				oDownlodsBox.slideToggle(400, function (a) {
				
					if ($(oDownlodsBox).is(":visible")) {
						oSvg.removeClass('icon-down');
						oSvg.addClass('icon-down');
						oSvgUse.attr('xlink:href', '#icon-up');
					} else {
						oSvg.addClass('icon-down');
						oSvg.addClass('icon-down');
						oSvgUse.attr('xlink:href', '#icon-down');
					}
				
				});
			
			}
		
		},
		
		openCloseFoldOut: function (oThis) {
		
			var oTextBox = $(oThis).parents('article').find('div.textbox');
			var oSvg = $(oThis).find('svg');
			var oSvgUse = $(oThis).find('use');
			
			if (oTextBox.length > 0) {
			
				oTextBox.slideToggle(400, function (a) {
				
					if ($(oTextBox).is(":visible")) {
						oSvg.removeClass('icon-down');
						oSvg.addClass('icon-down');
						oSvgUse.attr('xlink:href', '#icon-up');
					} else {
						oSvg.addClass('icon-down');
						oSvg.addClass('icon-down');
						oSvgUse.attr('xlink:href', '#icon-down');
					}
				
				});
			
			}
		
		},
		
		checkAndSetDetailLink: function() {
			
			$('section.list.diary[data-unit-elementlinked="true"]').each(function () {
			
				$('[data-unit-detaillink]:not([data-unit-detaillink=""])', $(this)).each(function (lIndex, oElement) {
				
					oElement = $(oElement);
					
					oElement.addClass('hover');
					
					$(oElement).find('a[class!="liveedit"]').each( function () {
						$(this).removeAttr("href");
					});
					
					oElement.click(function (o) {
						if (!$(o.target).closest('div.liveedit').length) {
							if ($(oElement).attr('data-unit-detaillink-target') != undefined && $(oElement).attr('data-unit-detaillink-target') != '') {
								window.open(oElement.attr('data-unit-detaillink'), $(oElement).attr('data-unit-detaillink-target'));
							} else {
								window.location.href = oElement.attr('data-unit-detaillink');
							}
						}
					});
				
				});
			
			});
		
		},
		
		diaryScrollEffect: function() {
		
			$('section.list article.element').each(function () {
			
				if ($(window).scrollTop() >= $(this).offset().top + $(this).height()) {
				
					$(this).removeClass('animation-scale');
				
				} else if ($(window).scrollTop() + $(window).height() >= $(this).offset().top) {
				
					$(this).addClass('animation-scale');
				
				} else if ($(window).scrollTop() + $(window).height() < $(this).offset().top) {
				
					$(this).removeClass('animation-scale');
				
				}
			
			});
		
		}
	
	};
	
	onScrMngrLoaded(function() {
	
		oList.init();
	
	});

/* Header T1 _______________________________________________________________ */
	
	var oHeaderT1 = {
	
		bLock: false,
		lLastMenuID: undefined,
		bTransitionSupport: false,
		bMenuFixed: false,
		bWaitingForTransition: false,
		lTimer: undefined,
		lMenuClassTimer: undefined,
		
		init: function () {
		
			if ($('[data-menu="Menu' + sCurrentTopPageKey + '"]').length) $('[data-menu="Menu' + sCurrentTopPageKey + '"]').addClass('active');
			if ($('[data-menu="Menu' + sCurrentPageKey + '"]').length) $('[data-menu="Menu' + sCurrentPageKey + '"]').addClass('active');
			if ($('[data-menu="Menu' + sCurrentPageKey + sCurrentSubPageKey + '"]').length) $('[data-menu="Menu' + sCurrentPageKey + sCurrentSubPageKey + '"]').addClass('active');
			
			this.bTransitionSupport = (typeof($('body')[0].style.transition) != 'undefined');
			
			$(window).on('scroll', $.proxy(function() {
				this.lTimer = window.setTimeout(function() {
					clearTimeout(oHeaderT1.lTimer);
					oHeaderT1.setMenuPosition();
				}, 50);
			}, this));
			
			this.setMenuPosition();
		
		},
		
		setMenuPosition: function() {
		
			var lHeight = $('[data-page="header"]').height();
			var lScrollTop = $(window).scrollTop();
			
			if (lScrollTop > lHeight) {
				$('body').addClass('out-of-viewport');
			} else {
				$('body').removeClass('out-of-viewport');
			}
			
			if (!this.bMenuFixed && lScrollTop > lHeight + 50) {
			
				this.bMenuFixed = true;
				$('body').addClass('menu-fixed');
				clearTimeout(this.lMenuClassTimer);
				this.lMenuClassTimer = window.setTimeout(function() {
					$('body').addClass('slide');
				}, 50);
			
			} else if(this.bMenuFixed && lScrollTop <= lHeight + 50) {
			
				this.bMenuFixed = false;
				$('body').removeClass('slide');
				clearTimeout(this.lMenuClassTimer);
				this.lMenuClassTimer = window.setTimeout(function() {
					$('body').removeClass('menu-fixed');
				}, 250);
			
			}
		
		},
		
		toggleMenu: function(sId) {
		
			if (this.bLock || this.bWaitingForTransition) return;
			
			this.bLock = true;
			
			if (!!sId && !!this.lLastMenuID) {
				if (sId == this.lLastMenuID) {
					$('[data-menu="' + this.lLastMenuID + '"]').closest('li').removeClass('active');
					this.lLastMenuID = null;
					this.bLock = false;
					return;
				}
			}
			// if (!sId && !this.lLastMenuID) {
			// 	sId = $('#menuContainer [data-menu]').attr('data-menu');
			// }
			
			if (!$('#menuContainer').hasClass('opened')) {
			
				$('body').addClass('menu-opened');
				$('#menuContainer').addClass('showmenu');
				window.setTimeout(function() {
					$('#menuContainer').addClass('opened');
				}, 100);
			
			}
			
			if (sId != undefined && this.lLastMenuID != sId) {
			
				if (this.lLastMenuID != undefined) {
				
					if (this.bTransitionSupport) {
					
						this.bWaitingForTransition = true;
						
						$('[data-menu="' + this.lLastMenuID + '"]').closest('li').bind('transitionend.hidden', function() {
						
							$(this).unbind('transitionend.hidden');
							
							$(this).addClass('hidden');
							
							oHeaderT1.bWaitingForTransition = false;
						
						});
					
					} else {
					
						$('[data-menu="' + this.lLastMenuID + '"]').addClass('hidden');
					
					}
					
					$('[data-menu="' + this.lLastMenuID + '"]').closest('li').removeClass('active');
				
				}
				
				$('[data-menu="' + sId + '"]').closest('li').removeClass('hidden');
				
				// if (!$('#menuContainer').hasClass('opened')) {
				
				// 	if (this.bTransitionSupport) {
					
				// 		$('div.menu nav.completemainmenu > ul > li > a').last().bind('transitionend.menuanimation', $.proxy(function() {
						
				// 			$('div.menu nav.completemainmenu > ul > li > a').last().unbind('transitionend.menuanimation');
							
				// 			$('[data-menu="' + sId + '"]').closest('li').addClass('active');
							
				// 			this.lLastMenuID = sId;
							
				// 			this.bLock = false;
						
				// 		}, this));
					
				// 	} else {
					
				// 		$('[data-menu="' + sId + '"]').closest('li').addClass('active');
						
				// 		this.lLastMenuID = sId;
						
				// 		this.bLock = false;
					
				// 	}
					
				// 	$('#menuContainer').addClass('opened');
				
				// } else {
				
					$('[data-menu="' + sId + '"]').closest('li').addClass('active');
					
					this.lLastMenuID = sId;
					
					this.bLock = false;
				
				// }
			
			} else {
			
				this.bLock = false;
			
			}
		
		},
		
		openCloseMenu: function(sId) {
		
			if ($('body').hasClass('requestbooking-opened')) {
				this.openCloseRequestBooking();
			}
			
			if (!$('#menuContainer').hasClass('opened')) {
				if (!sId) {
					if ($('[data-menu="SubMenu' + sCurrentTopPageKey + '"]').length && $('[data-menu="SubMenu' + sCurrentTopPageKey + '"]').find('li').length > 1) {
						sId = 'SubMenu' + sCurrentTopPageKey;
					}
					if ($('[data-menu="SubMenu' + sCurrentPageKey + '"]').length && $('[data-menu="SubMenu' + sCurrentPageKey + '"]').find('li').length > 1) {
						sId = 'SubMenu' + sCurrentPageKey;
					}
				}
				this.toggleMenu(sId);
			} else {
				this.closeMenu();
			}
		
		},
		
		openCloseRequestBooking: function() {
		
			if ($('body').hasClass('menu-opened')) {
				this.closeMenu();
			}
			
			if (!$('#requestBookingOverlay').hasClass('opened')) {
			
				$('body').addClass('requestbooking-opened');
				$('#requestBookingOverlay').addClass('showoverlay');
				window.setTimeout(function() {
					$('#requestBookingOverlay').addClass('opened');
				}, 100);
			
			} else {
			
				$('body').removeClass('requestbooking-opened');
				$('#requestBookingOverlay').removeClass('opened');
				
				window.setTimeout(function() {
					$('#requestBookingOverlay').removeClass('showoverlay');
				}, 200);
			
			}
		
		},
		
		closeMenu: function () {
		
			$('body').removeClass('menu-opened');
			$('#menuContainer').removeClass('opened');
			
			window.setTimeout(function() {
				$('#menuContainer').removeClass('showmenu');
			}, 1150);
			
			this.bLock = false;
		
		}
	
	};
	
	onScrMngrLoaded(function() {
		$(document).ready(function() {
			oHeaderT1.init();
		});
	});

/* Gallery T1 _______________________________________________________________ */
	
	var oGallery = {
	
		lLastId: null,
		
		triggerCheckbox: function(oThis) {
		
			$(oThis).closest('form').find('input').prop('checked', false);
			$(oThis).closest('form').find('.tab.active').removeClass('active');
			
			if (this.lLastId != $(oThis).find('input').val()) {
			
				this.lLastId = $(oThis).find('input').val();
				
				if ($(oThis).hasClass('active')) {
					$(oThis).removeClass('active');
					$(oThis).find('input').prop('checked', false);
				} else {
					$(oThis).addClass('active');
					$(oThis).find('input').prop('checked', true);
				}
			
			} else {
			
				this.lLastId = null;
			
			}
			
			this.load(oThis.closest('section'));
		
		},
		
		load: function(oSection) {
		
			$(oSection).find('.loading').show();
			
			var sParams = $(oSection).find('.filter form').serialize();
			sParams = sParams + "&sSharedKey=" + $(oSection).attr('data-sharedkey');
			
			var sLabels = '';
			$(oSection).find('.filter form input[type="checkbox"]:checked').each(function() {
				sLabels = sLabels + ',' + $(this).val();
			});
			
			this.setCookie('Page_GalleryLabel', sLabels.substr(1));
			
			$.ajax(location.protocol + '//' + location.host + location.pathname, {
				type: 'POST',
				data: sParams,
				complete: $.proxy(function(data) {
					$(oSection).find('.result').html($(data.responseText).find('div.listInner').html());
					$(oSection).find('.loading').hide();
				}, this)
			});
		
		},
		
		setCookie: function (sCookieName, sCookieValue) {
		
			sCookieName = '' + sCookieName;
			sCookieValue = '' + sCookieValue;
			
			document.cookie = sCookieName.replace('Page_', 'Page%5F') + '=' + UrlEncode(sCookieValue) + ';Domain=' + location.host + ';path=' + location.pathname;
		
		}
	
	};
var oFooter = {
	
	init: function () {
	
		$('div.adlerworldmenu div.column a.element, div.adlerworldmenu div.column span.element').each(function() {
		
			var sAttrValue = $(this).attr('data-productID');
			
			$(this).on('mouseover', function () {
				$('div.adlerworldmenu div.outerImages div.image[data-productID="' + sAttrValue + '"]').addClass('active');
			});
			
			$(this).on('mouseout', function () {
				$('div.adlerworldmenu div.outerImages div.image[data-productID="' + sAttrValue + '"]').removeClass('active');
			});
		
		})
		
	},
	
	toggleAdlerWorldMenu: function () {
	
		if ($('body').hasClass('adlerworldmenuopend')) {
			$('body').removeClass('adlerworldmenuopend');
		} else {
			$('body').addClass('adlerworldmenuopend');
		}
	
	},
	
	toggleMap: function (oThis) {
	
		if ($(oThis).hasClass('opened')) {
			$(oThis).removeClass('opened');
			$('[data-footer-map="true"]').hide();
		} else {
			$(oThis).addClass('opened');
			$('[data-footer-map="true"]').show();
			$(window).trigger('scroll');
		}
	
	}

};

$(document).ready(function() {
	oFooter.init();
});
/* ByCodeDetail __________________________________________  */

	var oByCodeDetail = {
	
		init: function () {
		
			this.initSocialShares();
		
		},
		
		initSocialShares: function () {
		
			$('section.bycodedetail.story div.social a[data-share]').each(function(i, oElement){
			
				oElement = $(oElement);
				var sKey = oElement.attr('data-share');
				
				oElement.on('click', function() {
							
					var oOpenGraph = {
						title: undefined,
						description: undefined,
						url: undefined,
						site_name: undefined,
						image: undefined
					};
					
					$("meta[property^='og:']").each(function() {
						oOpenGraph[$(this).attr('property').substr(3)] = $(this).attr('content');
					});
					
					if (sKey == 'facebook') {
					
						var sUrl = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURI(oOpenGraph.url);
						openWin(sUrl, sKey + 'window', 'height=570, width=600, toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
					
					} else if (sKey == 'pinterest') {
					
						var sUrl = 'https://www.pinterest.com/pin/create/button/?url=' + encodeURI(oOpenGraph.url) + '&media=' + encodeURI(oOpenGraph.image) + '&description=' + encodeURI(oOpenGraph.title).replace('&', '%26') + ' ' + encodeURI(oOpenGraph.description).replace('&', '%26') + ' ' + encodeURI(oOpenGraph.url);
						openWin(sUrl, sKey + 'window', 'height=570, width=600, toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
					
					}
				
				});
			
			});
		
		},
		
		startGallery: function (oThis) {
		
			$('[data-carousel="false"]', oThis).each(function() {
			
				$(this).attr('data-carousel', 'true');
				initCarousel($(this), $(this).data('carousel-config'));
			
			});
		
		}
	
	};
	
