function docReady(n){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(n,1):document.addEventListener("DOMContentLoaded",n)}function setupIntersectionObservation(n,t,i){if(!("IntersectionObserver"in window)||!("IntersectionObserverEntry"in window)||!("intersectionRatio"in window.IntersectionObserverEntry.prototype)){docReady(t);return}i=i||{root:null,rootMargin:"0px",threshold:1};const r=new IntersectionObserver(function(n){n.forEach(function(n){n.intersectionRatio>0&&(t(),r.unobserve(n.target))})},i),u=document.getElementById(n);r.observe(u)}function loadGetYourGuideScript(n){if(document.getElementById(n)!=null)setupIntersectionObservation(n,function(){dynamicScriptInjection("https://widget.getyourguide.com/v2/widget.js",!1,null,"gyg-script")},{root:null,rootMargin:"250px",threshold:.1})}function loadCitypassScript(n){if(document.getElementById(n)!=null)setupIntersectionObservation(n,function(){dynamicScriptInjection("https://widgets.tiqets.com/loader.js",!1,null,"citypass-script")},{root:null,rootMargin:"250px",threshold:.1})}function loadSkyScannerScript(n){if(document.getElementById(n)!=null)setupIntersectionObservation(n,function(){dynamicScriptInjection("https://widgets.skyscanner.net/widget-server/js/loader.js",!1,null,"ss-script")},{root:null,rootMargin:"250px",threshold:.1})}function elementIsInViewPort(n,t,i){const r=document.querySelector(n);var u=new IntersectionObserver(function(n){n.forEach(function(n){n.intersectionRatio!=1?i():t()})},{threshold:1});u.observe(r)}function loadGoogleMaps(n){const t="//maps.google.com/maps/api/js?key="+n+"&callback=googleMapCallback";dynamicScriptInjection(t,!1,null,"gmaps-script")}function dynamicScriptInjection(n,t,i,r){if(!document.getElementById(r)){const u=document.createElement("script");u.id=r;u.type="text/javascript";u.async=t;u.src=n;u.onload=function(){i&&i()};document.body.appendChild(u)}}function formatTime(n){return n.length<=5?n:n.substring(0,n.lastIndexOf(":"))}function initTransfersCurrencySwitcher(){$(".transfers-currency-switcher").on("change",function(){const n=$(this).find(":selected").data("rate"),t=$(this).find(":selected").data("symbol");$(".dynamic-price").each(function(){const i=$(this),r=i.data("base-price"),u=Math.round(r*n);i.text(t.concat(u))})})}function initHotelCheckPriceListeners(n){$(".check-hotel-price").on("click",function(){const t=$(this),i=t.data("hotel-id"),u=t.data("hotel-name"),f=t.data("loading-text"),e={hotelId:i,culture:n},o={method:"POST",headers:{"Content-Type":"application/json"},dataType:"json",body:JSON.stringify(e)};var r=t.text();t.text(f);t.attr("disabled","disabled");fetch("/umbraco/api/HotelPricingapi/GetHotelBookingUrl/",o).then(function(n){return n.json()}).then(function(n){document.location.href="https://"+n;t.text(r);t.removeAttr("disabled")}).catch(function(n){console.log(n);t.text(r);t.removeAttr("disabled")});selectItemEvent("Hotels List",i,u)})}function selectPromotionEvent(n,t,i){return typeof gtag=="function"&&gtag("event","select_promotion",{promotion_name:n,creative_name:t,creative_slot:i}),!0}function searchEvent(n){return typeof gtag=="function"&&gtag("event","search",{search_term:n}),!0}function trackCustomEvent(n,t){return typeof gtag=="function"&&gtag("event",n,t),!0}function selectItemEvent(n,t,i,r,u,f){return typeof gtag=="function"&&gtag("event","select_item",{item_list_name:n,items:[{item_id:t,item_name:i,index:u,item_brand:f,item_category:r}]}),!0}function isMobile(){return Math.min(window.screen.width,window.screen.height)<768}function initMapCanvas(){const t=document.getElementById("address").value;$("#map_canvas").html("Loading.....");const i=$("#Latitude").val(),r=$("#Longitude").val();if(i&&r){const e=new google.maps.LatLng(i,r),o={zoom:11,center:e,mapTypeControl:!1,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},navigationControl:!1,mapTypeId:google.maps.MapTypeId.ROADMAP};var n=new google.maps.Map(document.getElementById("map_canvas"),o),f=new google.maps.InfoWindow({content:"<b>"+t+"<\/b>",size:new google.maps.Size(150,50)}),u=new google.maps.Marker({position:e,map:n,title:t});google.maps.event.trigger(n,"resize");google.maps.event.addListener(u,"click",function(){f.open(n,u)})}else $("#map_canvas").html("No Map.")}function showOnParkingMap(n,t,i,r){if("map"in window)window.map.setCenter(new google.maps.LatLng(i,r)),window.map.setZoom(16);else{const u="//maps.google.com/maps/api/js?key="+n+"&callback=googleMapCallback";dynamicScriptInjection(u,!1,initParkingMap(t,i,r,16),"gmaps-script")}document.getElementById("map-container").scrollIntoView({behavior:"smooth",block:"start"})}function googleMapCallback(){window.googleMapScriptLoaded=!0}function initParkingMap(n,t,i,r){if(typeof google=="object"&&typeof google.maps=="object"){$("#map_canvas").html("Loading.....");const u=new google.maps.LatLng(t,i),f={zoom:r,center:u,mapTypeControl:!0,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},navigationControl:!0,mapTypeId:google.maps.MapTypeId.ROADMAP};window.map=new google.maps.Map(document.getElementById("map_canvas"),f);n.forEach(function(n){var t=new google.maps.Marker({position:new google.maps.LatLng(n.lat,n.lon),map:map,title:n.address}),i=new google.maps.InfoWindow({content:"<h3>"+n.name+"<\/h3><p>"+n.address+"<\/p>"+(n.actionUrl?"<div><a rel='noreferrer noopener nofollow' href='"+n.actionUrl+"'>"+n.actionUrlText+"<\/a><\/div>":""),size:new google.maps.Size(150,50)});google.maps.event.addListener(t,"click",function(){i.open(map,t)})});google.maps.event.trigger(map,"resize")}else setTimeout(function(){initParkingMap(n,t,i,r)},5)}function loadGliderCta(n,t){if(document.getElementById(n)!=null)setupIntersectionObservation(n,function(){dynamicScriptInjection("/dist/js/glider.min.js",!1,function(){function f(){clearTimeout(u);u=setTimeout(function(){r||n.scrollItem((n.slide+1)%n.slides.length)},s)}var i=document.querySelector(t),e,o;const n=new Glider(i,{draggable:!0,scrollLock:!0,scrollLockDelay:0,duration:3});var s=5e3,u=-1,r=!1;e=0;i.addEventListener("glider-animated",function(){e=n.animate_id;r||f()});i.addEventListener("mouseover",function(){r=!0;clearTimeout(u)});i.addEventListener("mouseout",function(){r=!1;!n.animate_id!==e&&f()});f();o=document.querySelectorAll(".cta-rotator.display-none");o.forEach(function(n){n.classList.remove("display-none")})},"glider")},{root:null,rootMargin:"250px",threshold:.1})}function createDebounceFunction(n){var t;return function(i){clearTimeout(t);t=setTimeout(i,n)}}function triggerScrollDepthTracking(){var t=window.scrollY,i=document.documentElement.scrollHeight-window.innerHeight,n=t/i*100;typeof window.loggedScrollDepths=="undefined"&&(window.loggedScrollDepths=[]);n>=25&&window.loggedScrollDepths.indexOf(25)===-1?trackScrollDepth(25):n>=50&&window.loggedScrollDepths.indexOf(50)===-1?trackScrollDepth(50):n>=75&&window.loggedScrollDepths.indexOf(75)===-1?trackScrollDepth(75):n>=95&&window.loggedScrollDepths.indexOf(100)===-1&&trackScrollDepth(100)}function trackScrollDepth(n){if(typeof gtag=="function"&&window.loggedScrollDepths.indexOf(n)===-1){window.loggedScrollDepths.push(n);var t="percent_scrolled_"+n;gtag("event",t,{scroll_depth:n})}}function initControls(n){$("#btnFindArrivals").click(function(){var t=$("#ddlFrom").val(),i=$("#ddlAirline").val(),r=$("#ArrivingFlightNo").val(),u={AirportCode:""+t+"",Airline:""+i+"",FlightNo:""+r+"",Culture:n};loadFlightArrivalsData(u)});$("#btnFindDepartures").click(function(){var t=$("#ddlFlyingTo").val(),i=$("#ddlDepartureAirline").val(),r=$("#DepartingFlightNo").val(),u={AirportCode:""+t+"",Airline:""+i+"",FlightNo:""+r+"",Culture:n};loadFlightDeparturesData(u)});$(document).on("click",".child-flights-toggle",function(){var n=$(this).attr("id");$("."+n+".child-flight").toggle();$("."+n+" , #"+n).toggleClass("code-share-wrapper");$(this).children(".flight-no").children("i").text($(this).children(".flight-no").children("i").text()==="expand_more"?"expand_less":"expand_more")})}function loadFlightArrivalsData(n){const t={method:"POST",headers:{"Content-Type":"application/json"},dataType:"json",body:JSON.stringify(n)};fetch("/umbraco/api/arrivaldepartureapi/FindArrivingFlights/",t).then(function(n){return n.json()}).then(function(n){n!==null&&n.length>0?($("#ArrivalsChart").empty(),bindArrivals(n)):$("#ArrivalsChart").append("<tr><td colspan=6>No flights found for your search<\/td><\/tr>")})}function loadFlightDeparturesData(n){const t={method:"POST",headers:{"Content-Type":"application/json"},dataType:"json",body:JSON.stringify(n)};fetch("/umbraco/api/arrivaldepartureapi/FindDepartingFlights/",t).then(function(n){return n.json()}).then(function(n){n!==null&&n.length>0?($("#DeparturesChart").empty(),bindDepartures(n)):$("#DeparturesChart").append("<tr><td colspan=6>No flights found for your search<\/td><\/tr>")})}function bindArrivals(n){if(n&&n.length>0)for(var t=0;t<n.length;t++)$("#ArrivalsChart").append(getScheduleArrivalRow(n[t],!1));else $("#NoArrivalsRow").show()}function bindDepartures(n){if(n&&n.length>0)for(var t=0;t<n.length;t++)$("#DeparturesChart").append(getScheduleDepartureRow(n[t],!1));else $("#NoDeparturesRow").show()}function getScheduleArrivalRow(n,t){var s=new Date(Date.parse(n.Date)),f=s.toLocaleTimeString(navigator.language,{hour:"2-digit",minute:"2-digit",hour12:!1}),e=n.ActualArrivalTime!==null?formatTime(n.ActualArrivalTime):"",o=n.LocalizedFlightStatus,i,r,u;if(t&&(f="",e="",o=""),i=n.CodeShareFlights!==null&&n.CodeShareFlights.length>0,r="<tr class='text-left "+(t?"child-flight "+n.ParentFlightNumber:i?"child-flights-toggle":"")+"'id='"+n.FlightNumber+"'><td class='text-left'>"+n.AirportCity+" ("+n.AirportCode+")<\/td><td class='text-left'>"+n.Airliner+"<\/td><td class='flight-no text-left'>"+n.FlightNumber+(i?"<i class='material-icons'>expand_more<\/i>":"")+"<\/td><td>"+f+"<\/td><td>"+e+"<\/td><td>"+o+"<\/td><\/tr>",i)for(u=0;u<n.CodeShareFlights.length;u++)r=r+getScheduleArrivalRow(n.CodeShareFlights[u],!0);return r}function getScheduleDepartureRow(n,t){var s=new Date(Date.parse(n.Date)),f=s.toLocaleTimeString(navigator.language,{hour:"2-digit",minute:"2-digit",hour12:!1}),e=n.ActualDepartureTime!==null?formatTime(n.ActualDepartureTime):"",o=n.LocalizedFlightStatus,i,r,u;if(t&&(f="",e="",o=""),i=n.CodeShareFlights!==null&&n.CodeShareFlights.length>0,r="<tr class='text-left "+(t?"child-flight "+n.ParentFlightNumber:i?"child-flights-toggle":"")+"'id='"+n.FlightNumber+"'><td class='text-left'>"+n.AirportCity+" ("+n.AirportCode+")<\/td><td class='text-left'>"+n.Airliner+"<\/td><td class='flight-no text-left'>"+n.FlightNumber+(i?" <i class='material-icons child-flights-toggle'>expand_more<\/i>(+"+n.CodeShareFlights.length+")":"")+"<\/td><td>"+f+"<\/td><td>"+e+"<\/td><td>"+o+"<\/td><\/tr>",i)for(u=0;u<n.CodeShareFlights.length;u++)r=r+getScheduleDepartureRow(n.CodeShareFlights[u],!0);return r}function initArrivalDepartureWidget(n){initControls(n)}(function(n){function t(){this.init=function(){isMobile()||(n("#btnHeadSearch").click(function(t){t.preventDefault();const i=n("#headerSearchText").val();i!==""&&(window.location.href="/"+webName+"-flight-search/?searchText="+i)}),n("#btnFooterSearch").click(function(t){t.preventDefault();const i=n("#footerSearchText").val();i!==""&&(window.location.href="/"+webName+"-flight-search/?searchText="+i)}));n(".culture-selector").on("click",function(){const t=n(this).data("url");t!==undefined&&(window.location.href=t)})}}n(function(){const n=new t;n.init()})})(jQuery)