$(document).ready(function(){const tour={"meta":{"de":{"title":"Virtuelle Tour","description":"Erleben Sie unsere virtuelle Tour!","keywords":"Virtuelle Tour, Panorama, 360 Grad"},"en":{"title":"Virtual Tour","description":"Experience our virtual tour!","keywords":"Virtual tour, panorama, 360 degrees"}},"languages":["de","en"],"created":"2024-07-04 13:39:20","last_modified":"2024-07-09 09:34:35","buttons":["fa-bed","fa-image","fa-play-circle","fa-sync-alt"],"buttonLinks":{"fa-image":"https:\/\/v8a-moving-pictures.com\/ugt_bregenzerwald\/","fa-bed":{"de":"https:\/\/www.haus-emilia.at\/buchen\/?stepOne=on&arrivalDate=&departureDate=","en":"https:\/\/www.haus-emilia.at\/buchen\/?stepOne=on&arrivalDate=&departureDate="}},"design":{"backgroundColor":"#FFFFFF","textColor":"#000000","hoverTextColor":"#FFFFFF","activeMenuColor":"#186AA7","buttonColor":"#FFFFFF","hoverButtonColor":"#186AA7","font":"Open Sans","planHotspot":"","hoverPlanHotspot":""},"backgroundMusic":"","hotspotIcon":"","tourLogo":"tour_logo.png","tourLogoLink":{"de":"https:\/\/www.haus-emilia.at\/","en":"https:\/\/www.haus-emilia.at\/"},"categories":{"Appartements":{"de":"Appartements","en":"Appartments"},"Glatthornappartement":{"de":"Glatthornappartement","en":"Glatthornappartment"},"Zafernhornappartement":{"de":"Zafernhornappartement","en":"Zafernhornappartment"},"Apartments":{"de":"Apartments","en":"Apartments"}},"pictures":{"MW8_1205-HDR.jpg":{"names":{"de":"Bad","en":"Bathroom"}},"MW8_1214-HDR.jpg":{"names":{"de":"Bad","en":"Bathroom"}},"MW8_1200-HDR.jpg":{"names":{"de":"Schlafzimmer","en":"Bedroom"}},"MW8_1236-HDR.jpg":{"names":{"de":"Kinderzimmer","en":"Children's room"}},"MW8_1251-HDR.jpg":{"names":{"de":"Bad","en":"Bathroom"}},"MW8_1241-HDR.jpg":{"names":{"de":"Schlafzimmer","en":"Bedroom"}},"MW8_1257-HDR.jpg":{"names":{"de":"Toilette","en":"Toilett"}}},"panos":{"629efbd400":{"names":{"de":"Glatthornappartement","en":"Glatthornappartement"},"startingpoints":{"hlookat":"-123.54802","vlookat":"-0.2155937","fov":"85"},"hotspots":[{"ath":72.05127994504358,"atv":3.7312349141411256,"target":"pic_MW8_1214-HDR.jpg","img":"Foto"},{"ath":89.11081580019197,"atv":4.507027103180578,"target":"pic_MW8_1200-HDR.jpg","img":"Foto"},{"ath":61.98372669846094,"atv":1.9673158064143061,"target":"pic_MW8_1205-HDR.jpg","img":"Foto"}]},"6901615200":{"names":{"de":"Zafernhornappartement","en":"Zafernhornappartement"},"startingpoints":{"hlookat":"-94.8078222","vlookat":"-1.0342945","fov":"85"},"hotspots":[{"ath":95.51143184728323,"atv":1.1272106747031516,"target":"pic_MW8_1251-HDR.jpg","img":"Foto"},{"ath":47.894646395465884,"atv":2.7685708435133733,"target":"pic_MW8_1236-HDR.jpg","img":"Foto"},{"ath":109.14915788493536,"atv":1.6827275500157037,"target":"pic_MW8_1241-HDR.jpg","img":"Foto"},{"ath":62.03650025673136,"atv":4.055310657974323,"target":"pic_MW8_1257-HDR.jpg","img":"Foto"}]}},"navigation":[{"name":"Apartments","subnodes":[{"namePano":"629efbd400"},{"namePano":"6901615200"}]}],"statistikId":1517};const urlParams=new URLSearchParams(window.location.search);let wasSmall=false;let activePlan;activePlan="";function checkIfPhone(){var isPhone=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent);return isPhone;}
var isPhone=checkIfPhone();function findKeyByV8aId(tour,v8aId){for(const key in tour.panos){if(tour.panos[key].v8aId===v8aId){return key;}}
return false;}
function safeParse(param){try{return JSON.parse(param);}catch(e){return null;}}
function inIframe(){try{return window.self!==window.top;}catch(e){return true;}}
const notShow=safeParse(urlParams.get('notShow'))||[];const hideCategories=safeParse(urlParams.get('hideCategories'))||[];var pano=urlParams.get('pano')||[];const panov8a=urlParams.get('panov8a')||[];if(panov8a!=""){var v8apano=findKeyByV8aId(tour,panov8a);if(v8apano!=false){pano=v8apano;}}
const hideMenu=urlParams.get('hideMenu')||[];const langSelect=urlParams.get('lang')||[];var inactivityTime;const isTouchDevice='ontouchstart'in document.documentElement;const inactivityLimit=isTouchDevice?5000:5000;function resetInactivityTimer(){if($(window).height()>=250||!inIframe()){clearTimeout(inactivityTime);inactivityTime=setTimeout(hideNavigation,inactivityLimit);}}
function hideNavigation(){if($(window).height()>=250||!inIframe()){if($('.burger-menu').css('visibility')!="visible"){stopSlideshow();$('#navigation').fadeOut('fast',function(){$('.burger-menu').css('visibility','visible').animate({opacity:1},'fast');});}}
$('#planContainer').fadeOut('fast');}
$(document).on('click touchstart scroll',function(){if(hideMenu!="true"){resetInactivityTimer();}});$('#pano, #navigation').on('mousemove',function(){if(hideMenu!="true"){resetInactivityTimer();}});if(hideMenu=="true"){$('#navigation').css('display','none');}else{resetInactivityTimer();$('#pano').on('click touchstart',function(){stopSlideshow();$('#planContainer').fadeOut('fast');$navigation.fadeOut('fast',function(){$('.burger-menu').css('visibility','visible').animate({opacity:1},'fast');});});}
$('#lightbox').hide();$('#lightboxClose, #lightbox').on('click',function(e){if(e.target!==this)return;$('#linkBox').html("");$('#lightbox').fadeOut();});function toggleAutorotation(){const krpano=document.getElementById('krpanoSWFObject');if(krpano.get('autorotate.enabled')){krpano.call('autorotate.stop()');$('#fa-sync-alt').removeClass("active");}else{krpano.call('autorotate.start()');$('#fa-sync-alt').addClass("active");}}
function switchPano(panoId){stopSlideshow();const krpano=document.getElementById("krpanoSWFObject");if(krpano){const panoSettings=tour.panos[panoId];let viewSettings='';if(panoSettings.startingpoints){for(const[key,value]of Object.entries(panoSettings.startingpoints)){viewSettings+=`view.${key}=${value};`;}}
krpano.call(`loadpano("../../panos/${panoId}/pano.xml", null, MERGE, BLEND(2));`);krpano.call(viewSettings);setTimeout(function(){checkBurgerMenuAndUpdatePano(true);},1000);showPlan(panoId);playSoundproPano(panoId);trackPageView(panoSettings.names[lang]);}}
function findLinkIndexByUrl(tour,url){for(var i=0;i<tour.links.length;i++){if(tour.links[i].url===url){return i;}}
return-1;}
function addHotspots(){const krpano=document.getElementById("krpanoSWFObject").get("global");const xmlUrl=krpano.get("xml.url");const regex=/panos\/([a-zA-Z0-9]+)\/pano\.xml/;const match=xmlUrl.match(regex);if(match&&match[1]){const hotspots=tour.panos[match[1]].hotspots;if(Array.isArray(hotspots)){hotspots.forEach(function(hotspotData,index){switch(hotspotData.img){case"Tourstandard":var img="./img/default.png";break;case"Copter":var img="./img/Copter.png";break;case"Foto":var img="./img/Foto.png";break;case"Video":var img="./img/Video.png";break;case"Schneeflocke":var img="./img/Schneeflocke.png";break;default:var img="./img/default.png";break;}
if(hotspotData.target.startsWith("link_")){var linkid=findLinkIndexByUrl(tour,hotspotData.target.replace('link_',''));krpano.call("addhotspot('hotspot_"+index+"')");krpano.set("hotspot[hotspot_"+index+"].ath",hotspotData.ath);krpano.set("hotspot[hotspot_"+index+"].atv",hotspotData.atv);krpano.set("hotspot[hotspot_"+index+"].url",img);var ziel=tour.links[linkid]["target"];var onclickFunction="";if(ziel=="lightbox"){onclickFunction="js(openLightboxLink('"+hotspotData.target+"'))";}else{onclickFunction="js(window.open('"+hotspotData.target.replace("link_","")+"'))";}
krpano.set("hotspot[hotspot_"+index+"].onclick",onclickFunction);krpano.set("hotspot[hotspot_"+index+"].edge","center");krpano.set("hotspot[hotspot_"+index+"].visible",true);krpano.set("hotspot[hotspot_"+index+"].width","50");krpano.set("hotspot[hotspot_"+index+"].height","50");}else if(!hotspotData.target.startsWith("pic_")){if(hotspotData.target in tour.panos){krpano.call("addhotspot('hotspot_"+index+"')");krpano.set("hotspot[hotspot_"+index+"].ath",hotspotData.ath);krpano.set("hotspot[hotspot_"+index+"].atv",hotspotData.atv);krpano.set("hotspot[hotspot_"+index+"].url",img);const onclickFunction="js(switchPano('"+hotspotData.target+"'))";krpano.set("hotspot[hotspot_"+index+"].onclick",onclickFunction);krpano.set("hotspot[hotspot_"+index+"].edge","center");krpano.set("hotspot[hotspot_"+index+"].visible",true);krpano.set("hotspot[hotspot_"+index+"].width","50");krpano.set("hotspot[hotspot_"+index+"].height","50");krpano.set("hotspot[hotspot_"+index+"].rotate",typeof hotspotData.rotate!=='undefined'?hotspotData.rotate:0);if(!isPhone){krpano.call("addhotspot('hotspot_text_"+index+"')");const newAtv=hotspotData.atv;krpano.set("hotspot[hotspot_text_"+index+"].ath",hotspotData.ath);krpano.set("hotspot[hotspot_text_"+index+"].atv",newAtv);krpano.set("hotspot[hotspot_text_"+index+"].onclick",onclickFunction);krpano.set("hotspot[hotspot_text_"+index+"].type",'text');krpano.set("hotspot[hotspot_text_"+index+"].html",tour.panos[hotspotData.target].names[lang]);krpano.set("hotspot[hotspot_text_"+index+"].css",'background-color:#186AA7;margin-top:40px;color: #FFFFFF; font-size: 12px; text-align: center; padding: 5px; border-radius:5px;');krpano.set("hotspot[hotspot_text_"+index+"].zorder",'1');krpano.set("hotspot[hotspot_text_"+index+"].bg",false);}}}else{krpano.call("addhotspot('hotspot_"+index+"')");krpano.set("hotspot[hotspot_"+index+"].ath",hotspotData.ath);krpano.set("hotspot[hotspot_"+index+"].atv",hotspotData.atv);krpano.set("hotspot[hotspot_"+index+"].url",img);const onclickFunction="js(openLightbox('"+hotspotData.target+"'))";krpano.set("hotspot[hotspot_"+index+"].onclick",onclickFunction);krpano.set("hotspot[hotspot_"+index+"].edge","center");krpano.set("hotspot[hotspot_"+index+"].visible",true);krpano.set("hotspot[hotspot_"+index+"].width","50");krpano.set("hotspot[hotspot_"+index+"].height","50");}});}}else{console.error("Kein gültiger XML-URL gefunden.");}}
function stopSlideshow(){if(typeof slideshowInterval!=='undefined'){clearInterval(slideshowInterval);const krpano=document.getElementById('krpanoSWFObject');if(krpano){krpano.call('autorotate.stop();');krpano.set('autorotate.speed',2);krpano.set('autorotate.accel',1);krpano.call(`autorotate.start();`);$('#fa-sync-alt').addClass("active");}}
currentIndex=0;$('#fa-play-circle').removeClass("active");}
function openLightbox(target){target=target.replace("pic_","");$('#lightbox').addClass('visible');$('#picBox').attr('src','pictures/'+target)
$('#lightbox').fadeIn();}
let resizeInterval;function openLightboxLink(link){target=link.replace("link_","");$('#lightbox').addClass('visible');$('#lightbox').fadeIn();resizeLightbox();var iframe='<iframe id="lightboxIframe" src="'+target+'" frameborder="0" allowfullscreen></iframe>';$('#linkBox').html(iframe);startLightboxResizeTimer();}
function resizeLightbox(){var breite=$('.lightbox-content').width()-20;var hoehe=breite*9 / 16;var realeHoehe=$('.lightbox-content').height()-20;if(hoehe>realeHoehe){hoehe=realeHoehe;breite=hoehe*16 / 9;}
$('#lightboxIframe').attr('width',breite+'px');$('#lightboxIframe').attr('height',hoehe);}
function startLightboxResizeTimer(){resizeInterval=setInterval(()=>{if($('#lightboxIframe').length===0){clearInterval(resizeInterval);}else{resizeLightbox();}},500);}
function filterNavigation(navigation,notShow,hideCategories){return navigation.reduce((filteredNav,item)=>{if(item.namePano&&notShow.includes(item.namePano)){return filteredNav;}
if(item.name&&hideCategories.includes(item.name)){return filteredNav;}
if(item.subnodes){item.subnodes=filterNavigation(item.subnodes,notShow,hideCategories);}
if(Object.keys(item).length>0){filteredNav.push(item);}
return filteredNav;},[]);}
function filterPanos(panos,notShow){return Object.keys(panos).reduce((filtered,key)=>{if(!notShow.includes(key)){filtered[key]=panos[key];}
return filtered;},{});}
function getVisitorLanguage(data,queryLang=null){var availableLanguages=data.languages;if(queryLang&&availableLanguages.includes(queryLang)){return queryLang;}
var visitorLanguage=getCurrentLanguage();if(availableLanguages.includes(visitorLanguage)){return visitorLanguage;}
return availableLanguages.includes('en')?'en':availableLanguages[0];}
function getCurrentLanguage(){return(navigator.language||navigator.userLanguage).substring(0,2);}
let lang;if(langSelect!=""){lang=getVisitorLanguage(tour,langSelect);}else{lang=getVisitorLanguage(tour);}
tour.navigation=filterNavigation(tour.navigation,notShow,hideCategories);tour.panos=filterPanos(tour.panos,notShow);const $navigation=$('#navigation');const $navBackground=$('<div>',{class:'nav-background'}).css('background-color',tour.design.backgroundColor);const $navContent=$('<div>',{class:'nav-content'});if(tour.tourLogo){var $logo=$('<img>',{src:tour.tourLogo,alt:'Tour Logo',class:'logo'});if(tour.tourLogoLink&&tour.tourLogoLink[lang]){$('<a>',{href:tour.tourLogoLink[lang],target:'_blank'}).append($logo).appendTo($navContent);}else{$logo.appendTo($navContent);}}
const mainMenuItems=getMainMenu();const $mainMenu=$('<div>',{class:'main-menu'});const $subMenu=$('<div>',{class:'sub-menu'});mainMenuItems.forEach(item=>{const $menuItem=$('<div>',{class:'menu-item',text:findCategoryText(tour,item.name,lang)}).appendTo($mainMenu);$menuItem.on('click',function(){updateSubMenu(item,true);});});$navContent.append($mainMenu,$subMenu);const footerIcons=tour.buttons;const $footerButtons=$('<div>',{class:'footer-buttons'});footerIcons.forEach(iconClass=>{let $button=$(`

                    <div id="${iconClass}" class="footer-button">

                        <i class="fa ${iconClass}"></i>

                    </div>

                `);if(iconClass==='fa-bed'&&tour.buttonLinks&&tour.buttonLinks['fa-bed']&&tour.buttonLinks['fa-bed'][lang]){const link=tour.buttonLinks['fa-bed'][lang];$button=$('<a>',{href:link,target:'_blank',html:$button});}
if(iconClass==='fa-image'&&tour.buttonLinks&&tour.buttonLinks['fa-image']){const link=tour.buttonLinks['fa-image'];$button=$('<a>',{href:link,target:'_blank',html:$button});}
if(iconClass==='fa-sync-alt'){$button.on('click',function(){toggleAutorotation();});}
if(iconClass==='fa-play-circle'){$button.on('click',function(){startSlideshow();});}
$footerButtons.append($button);});$navContent.append($footerButtons);$navigation.append($navBackground,$navContent);const $burgerMenu=$('#burgerMenu');$burgerMenu.on('click touchstart',function(){$burgerMenu.animate({opacity:0},'fast',function(){$burgerMenu.css('visibility','hidden');$navigation.fadeIn('fast');$("#planContainer").fadeIn('fast');stopSlideshow();});});function findCategoryText(tour,category,language){if(tour.categories.hasOwnProperty(category)){if(tour.categories[category].hasOwnProperty(language)){return tour.categories[category][language];}else{return category;}}else{return category;}}
let currentMenuItem=null;let currentSubMenuItem=null;let currentMinipicItem=null;function collectPanos(node,panos){if(node.namePano){panos.push(node.namePano);}
if(node.subnodes){node.subnodes.forEach(subnode=>collectPanos(subnode,panos));}}
if(mainMenuItems.length>0){updateSubMenu(mainMenuItems[0]);}
function getMainMenu(){return tour.navigation.filter(node=>node.name&&!node.namePano).map(node=>({name:node.name,subnodes:node.subnodes}));}
function getPanos(menuItem){let nodes=[];function findPanos(node){if(node.namePano){nodes.push(node.namePano);}
if(node.subnodes){node.subnodes.forEach(findPanos);}}
findPanos(menuItem);return nodes;}
function updateVisibility(){const height=$(window).height();const width=$(window).width();if(height<250&&inIframe()){wasSmall=true;$("#planContainer").remove();$('#navigation').empty();$('#burgerMenu').empty();$('#pano').hide();clearTimeout(inactivityTime);const $openInNewWindowButton=$('<div>',{class:'open-in-new-window-container'}).css({position:'absolute',top:'50%',left:'50%',transform:'translate(-50%, -50%)',textAlign:'center'});const $svgImage=$('<img>',{src:'img/panorama-solid.svg',class:'open-in-new-window-button',click:function(){window.open(window.location.href,'_blank');}}).css({cursor:'pointer',width:'100px',height:'auto'});const $text=$('<div>',{text:'360° Virtual Tour',class:'open-in-new-window-text'}).css({marginTop:'10px',fontSize:'16px',color:'#000'});$openInNewWindowButton.append($svgImage).append($text);$('body').append($openInNewWindowButton);$(window).resize(function(){if(wasSmall&&$(window).height()>250&&inIframe()){location.reload();}});}else if(height<550||width<1000){$('.logo').addClass('hidden');$("#planContainer").addClass('hidden');}else{$('.logo').removeClass('hidden');$("#planContainer").removeClass('hidden');}
if(height<350){$('.footer-buttons').addClass('hidden');$('.main-menu, .sub-menu').addClass('hidden');const allPanos=getMainMenu().flatMap(item=>getPanos(item));updateMinipics({name:'All Panos',subnodes:[],namePano:'',subnodes:[]});}else{$('.footer-buttons').removeClass('hidden');$('.main-menu, .sub-menu').removeClass('hidden');if(currentMenuItem){updateMinipics(currentMenuItem);}}}
function playSoundproPano(pano){if(tour&&tour.panos&&tour.panos[pano]&&tour.panos[pano].audios&&typeof tour.panos[pano].audios[lang]!=='undefined'){$('#sound2').attr('src','audio/'+tour.panos[pano].audios[lang]);$('#sound')[0].load();var audio=document.getElementById('sound');$('#sound')[0].play();function playSoundOnce(){$('#sound')[0].play();document.removeEventListener('click',playSoundOnce);}
document.addEventListener('click',playSoundOnce);}}
$(window).resize(updateVisibility);updateVisibility();var settings={'view.hlookat':'-123.54802','view.vlookat':'-0.2155937','view.fov':'85','autorotate.enabled':true,'autorotate.waittime':1.0,'autorotate.speed':2,'autorotate.startatidle':true,'view.maxpixelzoom':'',};if(pano==""||typeof tour.panos[pano]==='undefined'){embedpano({xml:"panos/629efbd400/pano.xml",target:"pano",passQueryParameters:"startscene,startlookat",vars:settings,onready:function(krpano){krpano.set("events.onloadcomplete","js(addHotspots())");}});showPlan("629efbd400");pano="629efbd400";}else{settings['view.hlookat']=tour.panos[pano]["startingpoints"]["hlookat"];settings['view.vlookat']=tour.panos[pano]["startingpoints"]["vlookat"];settings['view.fov']=tour.panos[pano]["startingpoints"]["fov"];embedpano({xml:"panos/"+pano+"/pano.xml",target:"pano",passQueryParameters:"startscene,startlookat",vars:settings,onready:function(krpano){krpano.set("events.onloadcomplete","js(addHotspots())");}});showPlan(pano);checkBurgerMenuAndUpdatePano(true);}
playSoundproPano(pano);$('#fa-sync-alt').addClass("active");const panos=Object.keys(tour.panos);let currentIndex=0;const rotationTime=10000;const transitionTime=1000;const autorotateSpeed=2;let slideshowInterval;function loadPano(panoId){const krpano=document.getElementById("krpanoSWFObject");if(krpano){const panoSettings=tour.panos[panoId];let viewSettings='';if(panoSettings.startingpoints){for(const[key,value]of Object.entries(panoSettings.startingpoints)){viewSettings+=`view.${key}=${value};`;}}
krpano.call(`loadpano("../../panos/${panoId}/pano.xml", null, MERGE, BLEND(${transitionTime / 1000}));`);krpano.call(viewSettings);krpano.set('autorotate.speed',8);krpano.set('autorotate.accel',8);krpano.call(`autorotate.start();`);checkBurgerMenuAndUpdatePano(true);$("#planContainer").remove();trackPageView(panoSettings.names[lang]);}}
function startSlideshow(){loadPano(panos[currentIndex]);slideshowInterval=setInterval(function(){currentIndex=(currentIndex+1)%panos.length;loadPano(panos[currentIndex]);},rotationTime+transitionTime);$('#fa-play-circle').addClass("active");$('#navigation').fadeOut('fast',function(){$('.burger-menu').css('visibility','visible').animate({opacity:1},'fast');});}
function checkBurgerMenuAndUpdatePano(doIt=false){if($('.burger-menu').css('visibility')=="visible"||doIt){const krpanoObj=document.getElementById("krpanoSWFObject");if(krpanoObj){const xmlUrl=krpanoObj.get("xml.url");const regex=/panos\/([a-zA-Z0-9]+)\/pano\.xml/;const match=xmlUrl.match(regex);if(match&&match[1]){const id=match[1];const navElement=document.getElementById(`nav_${id}`);$('.minipic-item').removeClass('active');if(navElement){navElement.classList.add('active');}else{const menuItem=findMenuItemByPanoId(id);if(menuItem){updateMenuAndSubMenu(menuItem);const newNavElement=document.getElementById(`nav_${id}`);if(newNavElement){newNavElement.classList.add('active');}}}}}}}
setInterval(checkBurgerMenuAndUpdatePano,10000);function findMenuItemByPanoId(panoId){let result=null;function searchNodes(nodes,parentNode){for(const node of nodes){if(node.namePano===panoId){result=parentNode||node;return;}
if(node.subnodes){searchNodes(node.subnodes,node);}}}
searchNodes(tour.navigation);return result;}
function updateMenuAndSubMenu(menuItem){$('.main-menu .menu-item').removeClass('active');$(`.main-menu .menu-item`).filter((index,item)=>$(item).text()===findCategoryText(tour,menuItem.name,lang)).addClass('active');updateSubMenu(menuItem);updateMinipics(menuItem);}
function updateSubMenu(menuItem,click=false){$subMenu.empty();currentMenuItem=menuItem;$('.main-menu .menu-item.active').removeClass('active');$('.main-menu .menu-item').filter((index,item)=>$(item).text()===findCategoryText(tour,menuItem.name,lang)).addClass('active');if(menuItem.subnodes&&menuItem.subnodes.some(subItem=>subItem.name)){let startSub="";menuItem.subnodes.filter(subItem=>subItem.name).forEach((subItem,index)=>{const subMenuItemClass=index===0?'menu-item active':'menu-item';const $subMenuItem=$('<div>',{class:subMenuItemClass,text:findCategoryText(tour,subItem.name,lang)}).appendTo($subMenu);$subMenuItem.on('click',function(){updateMinipics(subItem,true);if(currentSubMenuItem){currentSubMenuItem.removeClass('active');}
currentSubMenuItem=$subMenuItem;currentSubMenuItem.addClass('active');});if(index===0){currentSubMenuItem=$subMenuItem;}
if(startSub==""){startSub=subItem;}});updateMinipics(startSub,click);currentMenuItem=startSub;}else{updateMinipics(menuItem,click);}}
function updateMinipics(menuItem,click=false){const $minipicsContainer=$('<div>',{class:'minipics-container'});let panos=[];if(menuItem.name==='All Panos'){tour.navigation.forEach(node=>{collectPanos(node,panos);});}else{panos=getPanos(menuItem);}
const isTouchDevice='ontouchstart'in document.documentElement;panos.forEach((pano,index)=>{if(index===0&&click){switchPano(pano);}
const minipicId=`nav_${pano}`;const minipicUrl=`./panos/${pano}/thumb-250.jpg`;const popupImageUrl=`./panos/${pano}/thumb-320.jpg`;const panoName=tour.panos[pano].names[lang]||pano;if(tour.panos[pano]&&tour.panos[pano].audios&&tour.panos[pano].audios[lang]){var setAudio='<i class="fa fa-music-alt"></i> ';}else{var setAudio='';}
const $minipicItem=$(`

                        <div id="${minipicId}" class="minipic-item pano trackEvent" style="background-image: url('${minipicUrl}');" data-popup-image="${popupImageUrl}">

                            <div style="height:45px;width:197px;overflow:hidden;"></div>

                            <div class="text">${setAudio}${panoName}</div>

                        </div>

                    `);$minipicsContainer.append($minipicItem);if(!isTouchDevice){$minipicItem.on('mouseover',function(){$('.popup-container').remove();const popupImageSrc=$(this).attr('data-popup-image');const textContent=$(this).find('.text').text();if(!popupImageSrc)return;const $popupContainer=$(`

                                <div id="popupContainer" class="popup-container" style="position: absolute; left: ${$(this).offset().left - 300 - 10}px; top: ${$(this).offset().top}px;">

                                    <img src="${popupImageSrc}" class="popup-image" style="width: 300px;">

                                </div>

                            `);$('body').append($popupContainer);});$minipicItem.on('mouseout',function(){$('#popupContainer').remove();});}
$minipicItem.on('click',function(){switchPano(pano);if(currentMinipicItem){currentMinipicItem.removeClass('active');}
currentMinipicItem=$minipicItem;currentMinipicItem.addClass('active');});});$navContent.find('.minipics-container').remove();$navContent.find('.footer-buttons').before($minipicsContainer);}
function trackAction(action,name){if(window._paq){_paq.push(['trackEvent',action,name]);}}
function trackPageView(panoId){if(window._paq){_paq.push(['setCustomUrl','/pano/'+panoId]);_paq.push(['setDocumentTitle',panoId]);_paq.push(['trackPageView']);}}
$('.footer-button').on('click',function(){const action='Button Click';const buttonId=$(this).attr('id');trackAction(action,buttonId);});window.openLightbox=openLightbox;window.openLightboxLink=openLightboxLink;window.toggleAutorotation=toggleAutorotation;window.switchPano=switchPano;window.addHotspots=addHotspots;window.stopSlideshow=stopSlideshow;window.trackPageView=trackPageView;window.trackAction=trackAction;$menuChecker=getMainMenu();if($menuChecker.length==1){if($menuChecker[0].subnodes&&$menuChecker[0].subnodes.some(subItem=>subItem.name)){}else{$('.main-menu').css('display','none');$('.sub-menu').css('display','none');}}
function showPlan(panoId){const planContainerId='planContainer';const planInfo=tour.panos[panoId]?.plan;if(planInfo===undefined||planInfo===null){document.getElementById(planContainerId)?.remove();activePlan="";return;}
activePlan=panoId;const existingPlan=document.getElementById(planContainerId);if(existingPlan){existingPlan.remove();}
const planContainer=document.createElement('div');planContainer.id=planContainerId;planContainer.style.position='absolute';planContainer.style.left='30px';planContainer.style.top='30px';planContainer.style.overflow='hidden';planContainer.style.display='block';const plan=tour.plans[planInfo];if(!plan)return;const maxHeight=window.innerHeight*0.75;const maxWidth=window.innerWidth*0.75;const img=new Image();img.onload=function(){const scaleHeight=Math.min(maxHeight / img.height,1);const scaleWidth=Math.min(maxWidth / img.width,1);const scale=Math.min(scaleHeight,scaleWidth);planContainer.style.width=`${img.width * scale}px`;planContainer.style.height=`${img.height * scale}px`;img.style.width='100%';img.style.height='auto';planContainer.appendChild(img);plan.points.forEach(point=>{const hotspot=document.createElement('div');hotspot.style.position='absolute';hotspot.id=`planHotspot-${point.target}`;hotspot.style.left=`${point.x * scale}px`;hotspot.style.top=`${point.y * scale}px`;hotspot.style.width='14px';hotspot.style.height='14px';hotspot.style.borderRadius='50%';if(point.target!=panoId){hotspot.style.backgroundColor=tour.design.planHotspot||tour.design.buttonColor;hotspot.style.cursor='pointer';hotspot.onmouseover=function(){this.style.backgroundColor=tour.design.hoverPlanHotspot||tour.design.hoverButtonColor;};hotspot.onmouseout=function(){this.style.backgroundColor=tour.design.planHotspot||tour.design.buttonColor;};hotspot.onclick=function(){switchPano(point.target);};}else{hotspot.style.backgroundColor=tour.design.hoverPlanHotspot||tour.design.hoverButtonColor;}
planContainer.appendChild(hotspot);});document.body.appendChild(planContainer);updateVisibility();};img.src=`./plans/${plan.filename}`;}});