function SetNavScrollObj(){return new function(){if($("#why-viking-left-nav").length){var n=this;n.lastScrollTop=$(window).scrollTop();n.scrollDelta=0;n.$sidebar=$("#why-viking-left-nav");n.sidebarHeight=n.$sidebar.outerHeight(!0);n.maxScrollBtm=headerOffset-parseInt(n.sidebarHeight-$(window).height()-headerOffset);n.maxScrollTop=headerOffset;n.sidebarTop=n.$sidebar.position().top}}}function SetFlexSlider(n,t){$(n).flexslider({controlNav:!1,slideshow:t,start:function(n){var t=$(n[0]).find(".flex-direction-nav .flex-prev"),i=$(n[0]).find(".flex-direction-nav .flex-next");$(n[0]).find(".max-slides").html($(n[0]).find(".slides > li").length);$(n[0]).find(".slides > li:not(.flex-active-slide)").css("display","none");$(n[0]).find(".current-slide").html($(n[0]).find(".slides > li").index($(n[0]).find(".flex-active-slide"))+1);t.attr("aria-label","View the previous slide");i.attr("aria-label","View the next slide");$(n[0]).find(".custom-numbered-controls .prev").on("click",function(){$(n[0]).flexslider("prev")});t.off("keyup");t.on("keypress",function(n){n.preventDefault();n.keyCode==32&&$(this).click()});i.off("keyup");i.on("keypress",function(n){n.preventDefault();n.keyCode==32&&$(this).click()});$(n[0]).find(".custom-numbered-controls .next").on("click",function(){$(n[0]).flexslider("next")});$(n[0]).find(".aria-announcer").html($(n[0]).find(".flex-active-slide").html());$(".why-viking-card-template").length&&(setCardTemplateHeight(),adjustCardTemplateFlexNavs())},before:function(n){$(n[0]).find(".slides > li").css("display","block")},after:function(n){$(n[0]).find(".slides > li:not(.flex-active-slide)").css("display","none");$(n[0]).find(".current-slide").html($(n[0]).find(".slides > li").index($(n[0]).find(".flex-active-slide"))+1);$(n[0]).find(".aria-announcer").html($(n[0]).find(".flex-active-slide").html())}})}function WVRunAfterResize(){screenXs.matches&&$(".why-viking-content-carousel-template").length&&setComp4Height();$(".why-viking-card-template").length&&(setCardTemplateHeight(),adjustCardTemplateFlexNavs());$(".why-viking .component-6.tables").length>0&&(setComponent6Height(),updateComponent6TableScrollMessage());$(".why-viking .component-7.numeric-list").length>0&&setComponent7Height();$(".why-viking .component-5").length>0&&setComp5Height();$(".why-viking .component-11.gallery").length>0&&setComponent11Height()}function setHeightAfterResize(){clearTimeout(doneResizing);doneResizing=setTimeout(WVRunAfterResize,500)}function setHeroContainerHeight(){$(".hero-container").each(function(){var n=$(this);n.css({marginTop:"",marginBottom:""});var t=n.find(".hero-copy").outerHeight(!0),i=Math.ceil((t-n.height())/2)+30;t&&(screenMd.matches||screenLg.matches?n.height()<t&&n.css({marginTop:i,marginBottom:i}):n.css({marginTop:"",marginBottom:""}))})}function setCardTemplateHeight(){$(".why-viking-card-template:not(.explorer-sale-lading-page)").each(function(){var n=$(this).find(".copy-block");$(this).find(".flex-container").length||(screenXs.matches||screenSm.matches||screenMd.matches?n.css("height",""):n.css("height",$(this).find(".flexslider .slides").outerHeight(!0)));n.addClass("fadeIn")})}function reduceJQueryElements(n,t,i,r){var u=i;return n.each(function(){if(r&&r(u,this))return!1;u=t(u,this)}),u}function adjustCardTemplateFlexNav(n){var t=reduceJQueryElements($(n).find(".flex-active-slide img"),function(n,t){return $(t).height()>0?$(t).height():n},0,function(n){return n>0}),i=$(n).find(".flex-direction-nav a").outerHeight();$(n).find(".flex-direction-nav a").css({"margin-top":-(i/2),top:t/2})}function adjustCardTemplateFlexNavs(){$(".why-viking-card-template .flexslider").each(function(){adjustCardTemplateFlexNav(this)})}function setComp4Height(){$(".why-viking-content-carousel-template").each(function(){var n=$(this).find(".mobile-content .mobile-overflow-container"),i=n.find("section:first").outerHeight(),r=0,t;n.css("height","");n.find("section").each(function(){r+=$(this).outerHeight(!0)});n.attr({"data-min-height":i,"data-max-height":r});n.css("height",i).addClass("collapsed");t=n.siblings("footer:first").find(".btn-cta");t.attr("aria-label").startsWith("Collapse ")&&t.attr("aria-label","See more about "+t.attr("aria-label").substring(9));t.html("SEE MORE");n.children().slice(1).css("display","none")})}function setComp5Height(){$(".why-viking .component-5.one-up").length>0&&$(".why-viking .component-5.one-up").each(function(){var n=$(this),t=n.find("section"),i=$(t).find(".article");n.hasClass("has-hidden")&&setStackedMaxHeight(3,t,i,$(this).find("footer .cta"),!0,!1)});$(".why-viking .component-5.three-up:not(.use-natural-height), .why-viking .component-5.itinerary:not(.use-natural-height)").length>0&&$(".why-viking .component-5.three-up:not(.use-natural-height), .why-viking .component-5.itinerary:not(.use-natural-height)").each(function(){var n=$(this),t=n.find("section"),r=$(t).find(".thumbnail"),f=n.find(".thumbnail-wrapper"),i,u;setComponentItemMaxHeight(f,r);$(t).hasClass("collapsed")?setComponentContentHeight(t,r):$(t).css("height","");n.hasClass("has-hidden")&&(r.each(function(){i!==null&&$(this).offset().top>i?(i=$(this).offset().top,u=!0):i=$(this).offset().top}),u?n.find("footer").show():u||n.find("footer").hide())});$(".why-viking .component-5.thumbnail-only").length>0&&$(".why-viking .component-5.thumbnail-only").each(function(){var n=$(this),t=n.find("section"),u=n.find(".thumbnail-img > div"),f=n.find(".container-fluid"),i,r;n.closest("#partnerLogos").length||(setComponentItemMaxHeight(f,u),$(t).hasClass("collapsed")?setComponentContentHeight(t,u):$(t).css("height",""),n.hasClass("has-hidden")&&(t.find(".thumbnail-wrapper > div").each(function(){i!==null&&$(this).offset().top>i?(i=$(this).offset().top,r=!0):i=$(this).offset().top}),r?n.find("footer").show():r||n.find("footer").hide()))})}function setComponent6Height(){$(".why-viking .component-6.news-strip").each(function(){var n=$(this),t=n.find(".slides"),i=$(t).find(".item");n.hasClass("has-hidden")&&setStackedMaxHeight(1,t,i,$(this).find("footer .cta"),!0,!1)});$(".why-viking .component-6.tables").each(function(){var t=$(this),n=t.find("section");$(n).hasClass("collapsed")?setTableMaxHeight(n):$(n).css("height","")})}function hasOverflow(n){return n.offsetHeight<n.scrollHeight||n.offsetWidth<n.scrollWidth}function updateComponent6TableScrollMessage(){$(".why-viking .component-6.tables-scroll").each(function(){var n=$(this).find(".scroll-content").get(0);hasOverflow(n)?$(this).find(".table-scroll-message").show():$(this).find(".table-scroll-message").hide()})}function setComponent7Height(){$(".why-viking .component-7.numeric-list").each(function(){var t=$(this),n=t.find("section"),u=$(n).find(".article-text"),i,r;t.hasClass("has-hidden")&&(equalizeHeightOnRow(u),$(n).hasClass("collapsed")?setComponentContentHeight(n,u):$(n).css("height",""),n.find(".row > div").each(function(){i!==null&&$(this).offset().top>i?(i=$(this).offset().top,r=!0):i=$(this).offset().top}),r?t.find("footer").show():r||t.find("footer").hide())})}function setComponent11Height(){$(".why-viking .component-11.gallery").each(function(){var t=$(this),n=t.find("section"),u=$(n).find(".item"),i,r;t.hasClass("has-hidden")&&($(n).hasClass("collapsed")?setComponentContentHeight(n,u):$(n).css("height",""),n.find(".row > div").each(function(){i!==null&&$(this).offset().top>i?(i=$(this).offset().top,r=!0):i=$(this).offset().top}),r?t.find("footer").show():r||t.find("footer").hide())})}function WhyVikingSelectLeftNavItem(n){$(".why-viking-left-navigation a").parent().removeClass("active");$('.why-viking-left-navigation a[href="#'+n+'"]').parent().addClass("active");$('.why-viking-left-navigation a[href="#'+n+'"]').parent().is(":hidden")&&window.matchMedia("(min-width:768px)").matches&&$('.why-viking-left-navigation a[href="#'+n+'"]').parent().parents("ul:first").collapse("show")}function setComponentContentHeight(n,t){var i=$(t).outerHeight(!0);$(n).outerHeight(i)}function resizeComponentContentHeight(n,t,i,r){var f=$(n).find(".row").outerHeight(!0),e=$(t).outerHeight(!0),o=$(n).offset().top-$(".hdr-canvas").outerHeight(!0),u=$(i).attr("aria-label");$(n).hasClass("collapsed")?($(n).removeClass("collapsed"),$(t).removeClass("off-screen"),$(i).html("Show Less"),typeof u!=typeof undefined&&u!==!1?$(i).attr("aria-label",u.replace("Show More","Show Less")):$(i).attr("aria-label","Show Less"),r&&(typeof u!=typeof undefined&&u!==!1?i.next(".show-toggle").text("Showing More"+u.replace("Show More","")+" on the page"):i.next(".show-toggle").text("Showing More items on the page")),$(n).animate({height:f},500)):($(n).addClass("collapsed"),$(i).html("Show More"),typeof u!=typeof undefined&&u!==!1?$(i).attr("aria-label",u.replace("Show Less","Show More")):$(i).attr("aria-label","Show More"),r&&(typeof u!=typeof undefined&&u!==!1?i.next(".show-toggle").text("Showing Less"+u.replace("Show Less","")+" on the page"):i.next(".show-toggle").text("Showing Less items on the page")),$(n).animate({height:e},500,function(){setComponentContentHeight(n,t)}),r&&$("html, body").animate({scrollTop:o}))}function setHeightForGroup(n,t){for(var i=0;i<n.length;i++)$(n[i]).css("height",t)}function setComponentItemMaxHeight(n,t){var u=0,i=0,r=[];(t.each(function(){$(this).css("height","")}),screenXXs.matches)||(t.each(function(){var t=$(this),f=t.outerHeight(!1),e=t.offset(),n=Math.floor(e.top);i==0&&(i=n);i<=n+30&&i>=n-30?(f>u&&(u=f),i=n,r.push(t)):(setHeightForGroup(r,u),u=f,i=n,r=[],r.push(t))}),r.length>0&&setHeightForGroup(r,u))}function equalizeHeightOnRow(n){var t=[],r=[],u=0,f=0,i;for($(n).each(function(n){var i=$(this),s=i.offset(),o=s.top,e;n==0&&(f=o);i.css("height","");f==o||u||(u=n);e=0;u&&(e=Math.floor(n/u));t.length<e+1&&t.push(0);r.push({y:e,toResize:i,h:i.outerHeight()});i.outerHeight()>t[e]&&(t[e]=i.outerHeight())}),i=0;i<r.length;i++)r[i].toResize.css("height",t[r[i].y])}function setTableMaxHeight(n){var r=$(".reference-table tr").length,t=15,i=0;return r<=t?($(".tables footer .cta").hide(),$(".tables footer").css("paddingBottom",30)):r>t&&($(".reference-table tr:lt("+t+")").each(function(){i+=$(this).outerHeight()}),$(n).height(i+1)),$(".reference-table.opacity-0").animate({opacity:1},300,function(){$(this).toggleClass("opacity-0")}),i+1}function setStackedMaxHeight(n,t,i,r,u,f){var c=n,s=0,h=0,e=0,o=$(r),l=$(t).offset().top-$(".hdr-canvas").outerHeight(!0);$(i).each(function(n){h+=$(this).outerHeight(!0);n<c&&(s+=$(this).outerHeight(!0)-1)});u?e=$(t).hasClass("collapsed")?s:h:$(t).hasClass("collapsed")?(o.html("Show Less"),o.attr("aria-label","Show Less"),$(t).removeClass("collapsed"),e=h):(o.html("Show More"),o.attr("aria-label","Show More"),$(t).addClass("collapsed"),e=s,f&&$("html, body").animate({scrollTop:l}));u?$(t).css("height",e):$(t).animate({height:e},500)}function setSidebarPos(){var t=$(window),i=t.height()-headerOffset,n=t.scrollTop();navScrollObj.sidebarHeight=navScrollObj.$sidebar.outerHeight(!0);navScrollObj.maxScrollBtm=headerOffset-parseInt(navScrollObj.sidebarHeight-i);navScrollObj.maxScrollTop=headerOffset;navScrollObj.sidebarTop=navScrollObj.$sidebar.position().top;navScrollObj.scrollDelta=navScrollObj.lastScrollTop-n;var u=i>navScrollObj.sidebarHeight,r=n+headerOffset+navScrollObj.sidebarHeight-$(".trd-footer-canvas,.mobile-footer-canvas").offset().top,f=n+headerOffset+navScrollObj.sidebarHeight>=$(".trd-footer-canvas,.mobile-footer-canvas").offset().top;f?(console.log("else if"),(Math.floor(navScrollObj.sidebarTop)>=Math.floor(headerOffset-r)||navScrollObj.scrollDelta>0||vrcIsMobile.any())&&navScrollObj.$sidebar.css("top",headerOffset-r)):(console.log("else"),u?navScrollObj.$sidebar.css("top",headerOffset):n+headerOffset<=navScrollObj.maxScrollTop&&navScrollObj.scrollDelta>0||navScrollObj.sidebarTop>=navScrollObj.maxScrollTop&&navScrollObj.scrollDelta>0?navScrollObj.$sidebar.css("top",navScrollObj.maxScrollTop):navScrollObj.sidebarTop<=navScrollObj.maxScrollBtm&&navScrollObj.scrollDelta<0?navScrollObj.$sidebar.css("top",navScrollObj.maxScrollBtm):navScrollObj.$sidebar.css("top",navScrollObj.sidebarTop+navScrollObj.scrollDelta));navScrollObj.lastScrollTop=n}function scrollToLocation(n,t){n.size()!=0&&(t?setTimeout(function(){$("body,html").animate({scrollTop:$("#cruise-hdr").length?n.offset().top-($("#trd-header").outerHeight()+$("#cruise-hdr").outerHeight()):n.offset().top-$("#trd-header").outerHeight()},600)},550):$("body,html").animate({scrollTop:$("#cruise-hdr").length?n.offset().top-($("#trd-header").outerHeight()+$("#cruise-hdr").outerHeight()):n.offset().top-$("#trd-header").outerHeight()},600))}function loadImages(n,t){var i=$(t).find(".responsive-thumbnail.ratio-2by1"),r;i!=null&&i.data("image")!==undefined&&(r="url("+i.data("image")+") no-repeat 50% 0",i.css("background",r).css("background-size","cover").removeAttr("data-image"))}function disableOnlineBooking(){$(".book-now-link").hide();$(".book-now-btn").hide();$(".request-quote-btn").removeClass("hidden-sm hidden-md hidden-lg");$(".request-quote-btn.btn-clear-dark").removeClass("btn-clear-dark").addClass("btn-red");$(".request-quote-btn.btn-clear-white").removeClass("btn-clear-white").addClass("btn-red")}var screenXXs=window.matchMedia("(max-width:479px)"),screenXs=window.matchMedia("(max-width:767px)"),screenSm=window.matchMedia("(min-width:768px) and (max-width:1023px)"),screenMd=window.matchMedia("(min-width:1024px) and (max-width:1365px)"),screenLg=window.matchMedia("(min-width:1366px)"),headerOffset=0,alertOffset=0,navScrollObj=null,vcDisableBookNowButtons=!1,doneResizing,intervalDaemon,convertDurationToISO8601;$(document).ready(function(){alertOffset=$(".page-alert").is(":visible")?$(".page-alert").outerHeight(!0):0;headerOffset=$("#cruise-hdr").length?$("#trd-header").outerHeight()+$("#cruise-hdr").outerHeight()+alertOffset:$("#trd-header").outerHeight()+alertOffset;navScrollObj=SetNavScrollObj();$(".inline-video-trigger").each(function(){var n=new InlineVideo(this);n.init()});$(".film-group").on("show.bs.collapse",function(n){var r=$(this),t,i;n&&n.target&&(t=$(n.target),t.size()>0&&(i="#"+t.attr("id").replace("content-panel-","panel-"),i!=window.location.hash&&(window.location.hash=i)))})});$(window).on("load",function(){var t=window.location&&window.location.hash,n=t.replace(/[^a-zA-Z0-9-_]/g,"");n.indexOf("panel-")==0&&($("#"+n.replace("panel-","content-panel-")).collapse("show"),window.setTimeout(function(){window.scrollTo(0,$("#"+n.replace("panel-","title-panel-")).offset().top-350)},100));$(".progressive-image").length>0&&$(".progressive-image").each(function(){var n=$(this).find(".loadingImage"),t;n.size()>0&&typeof n.data("image")!="undefined"&&n.data("image").length>0&&(t=new Image,t.onload=function(){newImage=n.after('<img src="'+t.src+'" class="overlay" />');$(".overlay").animate({opacity:1},200,function(){})},t.src=n.data("image"))})});$(document).ready(function(){$(".why-viking-content-carousel-template").on("click",".mobile-content .btn-cta",function(){var n=$(this),t=n.parents(".mobile-content:first").find(".mobile-overflow-container"),i=$("#cruise-hdr").length?$("#trd-header").outerHeight()+$("#cruise-hdr").outerHeight():$("#trd-header").outerHeight(),r=n.parents(".why-viking-content-carousel-template:first").offset().top-i-15;t.hasClass("collapsed")?(t.removeClass("collapsed"),t.children().slice(1).css("display",""),t.css("height",t.data("max-height")),n.attr("aria-expanded","true"),n.attr("aria-label","Collapse "+n.attr("aria-label").substring(15)),n.html("COLLAPSE")):(t.addClass("collapsed"),t.css("height",t.data("min-height")),n.attr("aria-expanded","false"),n.attr("aria-label","See more about "+n.attr("aria-label").substring(9)),n.html("SEE MORE"),$("html, body").animate({scrollTop:r},500),t.children().slice(1).css("display","none"))});screenXs.matches&&$(".why-viking-content-carousel-template").length&&setComp4Height()});$(window).on("load resize",function(){alertOffset=$(".page-alert").is(":visible")?$(".page-alert").outerHeight(!0):0;headerOffset=$("#cruise-hdr").length?$("#trd-header").outerHeight()+$("#cruise-hdr").outerHeight()+alertOffset:$("#trd-header").outerHeight()+alertOffset;navScrollObj!=null&&typeof navScrollObj.$sidebar!="undefined"&&navScrollObj.$sidebar!==null&&navScrollObj.$sidebar.length&&(screenXs.matches||(navScrollObj.$sidebar.css("width",navScrollObj.$sidebar.parent().width()),setSidebarPos(),navScrollObj.sidebarHeight=$("#why-viking-left-nav").outerHeight(!0)),screenXs.matches?(navScrollObj.$sidebar.hasClass("in")&&navScrollObj.$sidebar.collapse("hide"),navScrollObj.$sidebar.css({top:"",width:""})):navScrollObj.$sidebar.hasClass("in")||navScrollObj.$sidebar.collapse("show"));$(".hero-container").length>0&&setHeroContainerHeight();$(".why-viking-fullscreen-carousel-template").length>0&&$(".why-viking-fullscreen-carousel-template").each(function(){var n=$(this),t=n.find(".copy-block-container"),r=n.find(".flexslider").height(),u=n.find(".flexslider img:first").height(),i;screenXs.matches&&n.css("height","");(screenSm.matches||screenMd.matches||screenLg.matches)&&(t.length>0?t.outerHeight()<r?(t.css({top:(r-t.outerHeight())/2,bottom:"auto"}),n.css("height","")):(t.css({top:"",bottom:""}),n.css("height",u*.66+t.outerHeight(!0))):n.css("height",""));n.hasClass("layout-copy-center")&&n.find(".head-line").length>0&&(i=n.find(".head-line"),i.css("top",u-i.outerHeight(!0)))});$(".why-viking-card-template").length&&setCardTemplateHeight()});$(window).on("resize",function(){setHeightAfterResize()});$(function(){$(".why-viking .component-6.tables").length>0&&(setComponent6Height(),updateComponent6TableScrollMessage());$(".why-viking .component-7.numeric-list").length>0&&setComponent7Height();$(".why-viking .component-5").length>0&&setComp5Height();$(".why-viking .component-11.gallery").length>0&&setComponent11Height()});$(window).on("load",function(){var r=!1,u,n,t,f,i;typeof navScrollObj.$sidebar!="undefined"&&navScrollObj.$sidebar!==null&&navScrollObj.$sidebar.length>0&&(setTimeout(function(){$("#why-viking-left-nav").on("shown.bs.collapse",function(){var t=$("#why-viking-left-nav").outerHeight(!0)-navScrollObj.sidebarHeight,n=$(window).scrollTop(),i=n+headerOffset+navScrollObj.sidebarHeight>=$(".trd-footer-canvas,.mobile-footer-canvas").offset().top;i&&!screenXs.matches&&$("html,body").scrollTop(n-t)})},500),$("#why-viking-left-nav").hasClass("recipe")||$("#why-viking-left-nav a:first").parent().addClass("active"),$("#why-viking-left-nav").hasClass("htmx-swap")&&(r=!0));u=location.hash;n=u.replace(/[^a-zA-Z0-9-_]/g,"");n.length&&n.indexOf("-section")>=0&&(t=n.split("-section")[0],r?(f=document.getElementById("button-"+t),htmx.trigger(f,"click"),WhyVikingSelectLeftNavItem(t)):(i=$("#"+t),i.length>0&&scrollToLocation(i,!0)));$("body").on("click",'.animate-link-transitions a[href^="#"]:not([data-toggle=collapse]), #trd-header a[href^="#"]:not([data-toggle=collapse])',function(n){n.preventDefault();var t=$(this.hash.split("-section")[0]);window.history.replaceState({},this.hash+"-section",this.hash+"-section");scrollToLocation(t,!1)});$("body").on("click",'#trd-header a[href*="#"]:not([href="#"]):not([href*="#noscroll"]):not([data-toggle=collapse])',function(n){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){n.preventDefault();var t=$(this.hash.split("-section")[0]);window.history.replaceState({},t+"-section",t+"-section");scrollToLocation(t,!1)}});$(".why-viking .component-5.one-up").length>0&&$(".why-viking .component-5.one-up").each(function(){var n=$(this),t=n.find("section"),i=$(t).find(".article");if(n.hasClass("has-hidden")&&n.find("footer .cta").length>0){setStackedMaxHeight(3,t,i,n.find("footer .cta"),!1,!1);n.find("footer .cta").on("click",function(){setStackedMaxHeight(3,t,i,$(this),!1,!0)})}});$(".why-viking .component-5.three-up").length>0&&$(".why-viking .component-5.three-up").each(function(){var n=$(this),t=n.find("section"),i=$(t).find(".thumbnail");if(n.hasClass("has-hidden")&&n.find("footer .cta").length>0){n.find("footer .cta").on("click",function(){$(i).each(loadImages);resizeComponentContentHeight(t,i,$(this),!0)});resizeComponentContentHeight(t,i,n.find("footer .cta"),!1)}});$(".why-viking .component-5.thumbnail-only").length>0&&$(".why-viking .component-5.thumbnail-only").each(function(){var n=$(this),t=n.find("section"),i=n.find(".thumbnail-img");if(!n.closest("#partnerLogos").length&&n.hasClass("has-hidden"))n.find("footer .cta").on("click",function(){resizeComponentContentHeight(t,i,$(this),!0)})});$(".why-viking .component-5").length>0&&setComp5Height();$(".why-viking .component-6.news-strip").length>0&&$(".why-viking .component-6.news-strip").each(function(){var n=$(this),t=n.find(".slides"),i=$(t).find(".item");if(n.hasClass("has-hidden")&&n.find("footer .cta").length>0){setStackedMaxHeight(1,t,i,n.find("footer .cta"),!1,!1);n.find("footer .cta").on("click",function(){setStackedMaxHeight(1,t,i,$(this),!1,!0)})}});$(".why-viking .component-6.tables").length>0&&$(".why-viking .component-6.tables").each(function(){var n=$(this),t=n.find("section"),r=setTableMaxHeight(t),u=$(t).offset().top-$(".hdr-canvas").outerHeight(!0),i=n.hasClass("cruise-dbd-itinerary");n.find("footer .cta").on("click",function(){var n=$(this),f=n.parents(".component-6.tables:first"),e=f.find("section .row").outerHeight(),t=f.find("section");$(t).hasClass("collapsed")?($(t).toggleClass("collapsed"),$(t).animate({height:e},500),n.html("Show Less"),i?(n.attr("aria-label","Show less itinerary day."),n.attr("aria-expanded",!0)):n.attr("aria-label","Show Less.")):($(t).toggleClass("collapsed"),$(t).animate({height:r},500),n.html("Show More"),i?(n.attr("aria-label","Show more itinerary day."),n.attr("aria-expanded",!1)):n.attr("aria-label","Show more."),$("html, body").animate({scrollTop:u}))});n.find("table.opacity-0").animate({opacity:1},500,function(){$(this).toggleClass("opacity-0")})});$(".why-viking .component-7.numeric-list").length>0&&$(".why-viking .component-7.numeric-list").each(function(){var n=$(this),t=n.find("section"),i=$(t).find(".article-text");if(n.hasClass("has-hidden"))n.find("footer .cta").on("click",function(){resizeComponentContentHeight(t,i,$(this),!0)})});$(".why-viking .component-11.gallery").length>0&&$(".why-viking .component-11.gallery").each(function(){var n=$(this),t=n.find("section"),i=$(t).find(".item");if(n.hasClass("has-hidden"))n.find("footer .cta").on("click",function(){resizeComponentContentHeight(t,i,$(this),!0)})})});const scrollHandler=vcDebounce(function(){var n=$("#cruise-hdr").length?$("#trd-header").outerHeight()+$("#cruise-hdr").outerHeight():$("#trd-header").outerHeight();$(".content-section").each(function(){if($(window).scrollTop()>=$(this).offset().top-n-25&&$(window).scrollTop()<=$(this).offset().top-n-25+$(this).outerHeight(!0)){var t=$(this).attr("id");typeof t=="undefined"&&(t=$(this).children().attr("id"));typeof t!="undefined"&&window.location.hash!=="#"+t&&($(".why-viking-left-navigation a").parent().removeClass("active"),$('.why-viking-left-navigation a[href="#'+t+'"]').parent().addClass("active"),$('.why-viking-left-navigation a[href="#'+t+'"]').parent().is(":hidden")&&window.matchMedia("(min-width:768px)").matches&&$('.why-viking-left-navigation a[href="#'+t+'"]').parent().parents("ul:first").collapse("show"))}});typeof navScrollObj!="undefined"&&navScrollObj!=null&&typeof navScrollObj.$sidebar!="undefined"&&navScrollObj.$sidebar!=null&&navScrollObj.$sidebar.length>0&&!screenXs.matches&&setSidebarPos()},250,!1);$(window).on("scroll",scrollHandler);$(document).ready(function(){$('[data-toggle="tooltip"]').tooltip({html:!0})});$(window).scroll(function(){var n=$(document);n.scrollTop()>=50&&$(".scroll-button .bounce").removeClass("infinite")});$(window).on("load",function(){$(".fac-block .btn-fac").on("click",function(){$(this).parent().parent().parent().find(".fac-block").fadeOut("fast",function(){$(this).addClass("collapsed");$(this).parent().parent().parent().find(".fac-form").fadeIn("slow",function(){$(this).removeClass("collapsed")})})});$(".fac-form .close").on("click",function(){$(this).parent().parent().parent().parent().parent().find(".fac-form").fadeOut("fast",function(){$(this).addClass("collapsed");$(this).parent().parent().parent().parent().parent().find(".fac-block").fadeIn("slow",function(){$(this).removeClass("collapsed")})})})});$(window).on("load resize",function(){$(".viking-homepage .hero-gateway").length>0&&$(".viking-homepage .hero-gateway").each(function(){var n=$(this),t=n,i=n.find(".thumbnail");setComponentItemMaxHeight(t,i)});$(".viking-homepage .cta-block-two-up").length>0&&$(".viking-homepage .cta-block-two-up").each(function(){var n=$(this),t=n,i=n.find(".side");setComponentItemMaxHeight(t,i)})});var updateQueryStringParam=function(n,t){var o=[location.protocol,"//",location.host,location.pathname].join(""),r=document.location.search,u=n+"="+t,i="?"+u,f,e;r&&(f=new RegExp("([?&])"+n+"[^&]*"),e=new RegExp("([?&])"+n+"=[^&;]+[&;]?"),typeof t=="undefined"||t==null||t==""?(i=r.replace(e,"$1"),i=i.replace(/[&;]$/,"")):i=r.match(f)!==null?r.replace(f,"$1"+u):r+"&"+u);i=i=="?"?"":i;window.history.replaceState({},"",o+i)},muteHandler=function(){var t=$("#wvInlineVideoContainer").find("iframe").attr("id"),n=YT.get(t);n&&(n.unMute(),$(".video-controls-display").css("display","none"))},InlineVideo=function(n){var t=this;t.element=n;t.player=null;t.isSinglePlayer=!1;t.isMediaCapable=!1;t.playerInteraction=!1;t.done=!1;t.playerHasStarted=!1;t.isPaused=!1;t.isFirstRun=!0;t.mediaPlayerName="YouTubePlayer";t.videoPlayedPage="";t.mediaName="";t.firstPlay=!1;t.milestones=[];t.hasEnded=!1;t.videoPlayerInterval=null;t.updateSeoVideoParam=function(n,t,i,r,u,f){var s,e,h,o;$("#seoVideoDatablock").length>0&&(s=$("#seoVideoDatablock").html(),e=JSON.parse(s),e.name=n,h=new RegExp("(\r\n|\r|\n)+"),e.description=t.replace(h,"").trim(),e.thumbnailUrl=[location.protocol,"//",location.host,i].join(""),e.contentUrl=r,u.length>0&&(o=convertDurationToISO8601(u.trim()),o!=null&&(e.duration=o)),e.uploadDate=f,document.getElementById("seoVideoDatablock").innerHTML=JSON.stringify(e))};t.isPlayerInited=function(){return typeof t.player!="undefined"&&t.player!==null};t.stopVideo=function(){t.isPlayerInited()&&t.player.stopVideo&&!t.isSinglePlayer&&t.player.stopVideo()};t.pauseVideo=function(){t.player&&t.isPlayerInited()&&t.player.pauseVideo&&!t.isSinglePlayer&&t.player.pauseVideo()};t.replayVideo=function(){t.player&&t.isPlayerInited()&&t.player.seekTo&&(t.player.seekTo(0,!0),t.player.playVideo())};t.closeVideo=function(){t.stopVideo()};t.initVideo=function(n,i){var s,h,w;t.firstPlay=!1;var u=$(t.element),v=u.attr("data-video-id"),c=u.attr("data-target-id"),f=u.attr("data-video-title"),y=u.attr("data-video-type"),e=u.attr("data-vimeo-id"),l=!0,a=u.attr("data-has-image-placeholder");if(typeof a!="undefined"&&a==="false"&&(l=!1),e||(e=u.attr("data-vimeo2-id")),y==="vimeo"&&e){t.videoPlayedPage=f;var p=$("#"+c),r=new Vimeo.Player(p[0]),o=!1;r.off("play");r.off("ended");r.off("pause");r.on("play",function(){console&&console.log("vimeo ||| player PLAY event");t.trackVimeoMilestones(r);t.firstPlay||t.hasEnded||(t.firstPlay=!0,r.getDuration().then(function(n){tealium.fireLinkEvent({event_name:"video_start",video_name:tealium.codify(f),video_length:n.toString(),video_playhead:"0"})}))});r.on("pause",function(){if(!o){o=!0;return}console&&console.log("vimeo ||| player PAUSE event");t.hasEnded||(clearInterval(t.videoPlayerInterval),tealium.fireLinkEvent({event_name:"video_pause",video_name:tealium.codify(f)}))});r.on("ended",function(){console&&console.log("vimeo ||| player ENDED event");t.hasEnded||(t.hasEnded=!0,o=!1,r.getDuration().then(function(n){tealium.fireLinkEvent({event_name:"video_100",video_name:tealium.codify(f),video_length:n.toString(),video_playhead:n.toString()})}))});r.getVideoId().then(function(n){if(e==n){if(l||!IsiOS())try{r.play()}catch(t){console&&console.log(t)}}else r.loadVideo(e).then(function(){try{r.play()}catch(n){console&&console.log(n)}}).catch(function(n){switch(n.name){}})})}else i&&(s=document.createElement("script"),s.src="https://www.youtube.com/iframe_api",h=document.getElementsByTagName("script")[0],h.parentNode.insertBefore(s,h)),w=!1,t.player=new YT.Player(c,{height:"100%",width:"100%",host:"https://www.youtube-nocookie.com",type:"movie",videoId:v,playerVars:{showinfo:1,modestbranding:1,playsinline:1,rel:0,wmode:"opaque",autoplay:1,origin:"//"+document.domain},events:{onReady:function(i){t.setIsMediaCapable();t.isSinglePlayer=n;t.playerHasStarted=!1;t.videoPlayedPage=f;t.mediaName=f;t.componentIndex=InlineVideo.all.length;InlineVideo.all.push(t);n?(window.matchMedia("(max-width: 1024px)").matches&&(i.target.mute(),$(".video-controls-display").css("display","block"),document.getElementById("mute").addEventListener("click",muteHandler),document.getElementById("mute").addEventListener("touchstart",muteHandler,!1)),i.target.playVideo(),t.onPlay()):t.onPlay();$(window).trigger("resize")},onStateChange:t.onPlayerStateChange}})};t.initHandlers=function(){var i=$(t.element).attr("data-target-wrapper-id"),n=$(t.element).attr("data-placeholder-id");$(t.element).on("click",function(){var r=n?$("#"+n):$(this);r.hide();$("#"+i).show();t.initVideo();intervalDaemon(t,t.player).trackVideoProgress()})};t.initSingleHandlers=function(n){var i=$(t.element).attr("data-target-id");$(t.element).on("click",function(){var l;document.getElementById("mute").removeEventListener("click",muteHandler);document.getElementById("mute").removeEventListener("touchstart",muteHandler,!1);$(".inline-video").removeClass("now-playing");$("html, body").animate({scrollTop:0},"fast");$(this).closest(".inline-video").addClass("now-playing");var e=$(this).attr("data-video-id"),a=$(this).attr("data-tcmid"),v=$(this).attr("data-id"),o=$(this).attr("data-video-image-url"),y=$(this).attr("data-video-duration"),p=$(this).attr("data-video-upload-date"),s=document.createElement("div"),u=$(this).closest(".thumbnail").find(".text-column h3,.text-column h4").html(),r=u.replace(/<[^>]+>/g,""),f=$(this).closest(".thumbnail").find(".text-column p").html(),h=f.replace(/<[^>]+>/g,""),c=$("#wvInlineVideoContainer").find(".caption"),w=$(this).attr("data-video-type");s.setAttribute("id",i);$("#wvInlineVideoWrapper").children().children().html(s);c.find("h1,h2").find("span.video-title").html(u);c.find("p").html(f);var b=[location.protocol,"//",location.host,location.pathname].join(""),k=location.pathname.split("/"),d=location.pathname.split("/")[k.length-2];history.pushState(null,r+" | Videos | Viking Cruises",b.replace(d,v));t.updateSeoVideoParam(u,f,o,"https://youtu.be/"+e,y,p);$('link[rel="canonical"]').attr("href",window.location.href);document.title=r+" | Videos | Viking Cruises";$('meta[name="description"]').attr("content",h);$('meta[property="og:description"]').attr("content",h);$('meta[property="og:title"]').attr("content",r+" | Videos | Viking Cruises");$('meta[property="og:image"]').attr("content",o);$('meta[name="pageuri"]').attr("content",a);w==="vimeo"&&(l=$(this).attr("data-vimeo2-id"),l&&$("#vimeoInlineVideoContainer").attr("title",r));t.initVideo(!0);typeof n=="function"&&n(e)})};t.initSingleVideoHandlers=function(){var i=$(t.element).attr("data-target-id"),n=document.createElement("div");n.setAttribute("id",i);$("#wvInlineVideoWrapper").children().children().html(n);t.initVideo(!0,!0)};t.initSingleVideo=function(){t.initSingleVideoHandlers()};t.init=function(n){typeof n=="function"?t.initSingleHandlers(n):t.initHandlers()};t.onPlay=function(){typeof InlineVideo.activeIndex!="undefined"&&InlineVideo.activeIndex!==-1&&InlineVideo.all[InlineVideo.activeIndex].pauseVideo();InlineVideo.activeIndex=t.componentIndex};t.onNotPlay=function(){InlineVideo.activeIndex===t.componentIndex&&(InlineVideo.activeIndex=-1)};t.setIsMediaCapable=function(){typeof s!="undefined"&&typeof s.Media!="undefined"&&typeof s.Media.open=="function"&&typeof s.Media.play=="function"&&typeof s.Media.stop=="function"&&typeof s.Media.close=="function"&&(t.isMediaCapable=!0)};t.setOmniture=function(n){if(typeof s!="undefined")if(n){var t=n.replace(/<[^>]+>/g,"");typeof s.channel!="undefined"&&(s.pageName=s.channel+":"+t);s.eVar16=t;s.prop36=t;s.eVar51=t}else s.eVar16="[No MediaName Set]"};t.pauseAll=function(){};t.onPlayerStateChange=function(n){var i,r;if(t.initTealiumTracking(n),n.data===YT.PlayerState.ENDED&&n.target.playVideo(),n.data!==YT.PlayerState.PLAYING&&t.onNotPlay(),n.data===YT.PlayerState.UNSTARTED&&t.playerHasStarted&&t.isMediaCapable&&t.isPlayerInited()&&typeof t.player.getCurrentTime=="function"&&(t.playerHasStarted=!1,s.Media.stop(t.mediaName,t.player.getCurrentTime()),modalsLogger.log("GA EVENT: STOP"),typeof ga!="undefined"&&ga("send","event","Video","stop",t.mediaName),t.isPaused=!0),n.data===YT.PlayerState.PLAYING&&(t.isFirstRun?t.isFirstRun=!1:t.onPlay(),t.playerInteraction=!0),n.data!==!YT.PlayerState.PLAYING||t.done||(t.stopVideo(),modalsLogger.log("GA EVENT: STOP"),typeof ga!="undefined"&&ga("send","event","Video","stop",t.mediaName)),n.data===YT.PlayerState.CUED&&(console.log("CUED"),modalsLogger.log("GA EVENT: OPEN"),typeof ga!="undefined"&&ga("send","event","Video","open",t.mediaName)),n.data===YT.PlayerState.PLAYING){if(t.isMediaCapable===!1||t.isPlayerInited()===!1||typeof t.player.getCurrentTime!="function"||typeof t.player.getDuration!="function")return null;t.playerHasStarted===!1?(i=t.player.getDuration(),i>0&&(t.pauseAll(),t.setOmniture(t.mediaName,"from playing 2"),s.Media.open(t.mediaName,i,t.mediaPlayerName),modalsLogger.log("GA EVENT: OPEN"),typeof ga!="undefined"&&(ga("send","event","Video","open",t.mediaName),ga("set","dimension5",t.mediaName)),s.Media.play(t.mediaName,0),t.playerHasStarted=!0)):(t.pauseAll(),r=t.player.getCurrentTime(),s.Media.play(t.mediaName,r),modalsLogger.log("GA EVENT: PLAY"),typeof ga!="undefined"&&ga("send","event","Video","play",t.mediaName,Math.round(r)),t.isPaused=!1)}return n.data===YT.PlayerState.BUFFERING,n.data===YT.PlayerState.PAUSED&&t.playerHasStarted&&t.isMediaCapable&&t.isPlayerInited()&&typeof t.player.getCurrentTime=="function"&&(s.Media.stop(t.mediaName,t.player.getCurrentTime()),modalsLogger.log("GA EVENT: PAUSE"),typeof ga!="undefined"&&ga("send","event","Video","pause",t.mediaName,Math.round(t.player.getCurrentTime())),t.isPaused=!0),n.data===YT.PlayerState.ENDED&&t.playerHasStarted&&t.isMediaCapable&&t.isPlayerInited()&&(typeof t.player.getCurrentTime=="function"&&(s.Media.stop(t.mediaName,t.player.getCurrentTime()),typeof ga!="undefined"&&(ga("send","event","Video","end",t.mediaName),modalsLogger.log("GA EVENT: END"),ga("send","event","Video","watchedtime",t.mediaName,Math.round(t.player.getCurrentTime()))),s.Media.close(t.mediaName)),t.playerHasStarted=!1),!1};t.initTealiumTracking=function(n){var i=tealium.codify(t.videoPlayedPage),r=t.player.getDuration().toString();switch(n.data){case YT.PlayerState.PLAYING:t.trackMilestones();t.firstPlay||t.hasEnded||(t.firstPlay=!0,tealium.fireLinkEvent({event_name:"video_start",video_name:i,video_length:r,video_playhead:"0"}));break;case YT.PlayerState.PAUSED:t.hasEnded||(clearInterval(t.videoPlayerInterval),tealium.fireLinkEvent({event_name:"video_pause",video_name:i}));break;case YT.PlayerState.ENDED:t.hasEnded||(t.hasEnded=!0,tealium.fireLinkEvent({event_name:"video_100",video_name:i,video_length:r,video_playhead:r}))}};t.trackMilestones=function(){t.hasEnded||(t.videoPlayerInterval=setInterval(function(){var n=t.player.getCurrentTime(),i=t.player.getDuration(),r=parseInt((n/i*100).toFixed());t.parseMilestone(r,i.toString(),n.toString())},1e3))};t.trackVimeoMilestones=function(n){t.hasEnded||(t.videoPlayerInterval=setInterval(function(){n.getDuration().then(function(i){n.getCurrentTime().then(function(n){var r=parseInt(n/i*100).toFixed();t.parseMilestone(r,i.toString(),n.toString())})})},2e3))};t.parseMilestone=function(n,i,r){var u=t.milestones;n>=25&&u.indexOf("video_25")===-1?(u.push("video_25"),tealium.fireLinkEvent({event_name:"video_25",video_name:tealium.codify(t.videoPlayedPage),video_length:i,video_playhead:r})):n>=50&&u.indexOf("video_50")===-1?(u.push("video_50"),tealium.fireLinkEvent({event_name:"video_50",video_name:tealium.codify(t.videoPlayedPage),video_length:i,video_playhead:r})):n>=75&&u.indexOf("video_75")===-1&&(u.push("video_75"),tealium.fireLinkEvent({event_name:"video_75",video_name:tealium.codify(t.videoPlayedPage),video_length:i,video_playhead:r}))}};InlineVideo.all=[];InlineVideo.activeIndex=-1;intervalDaemon=function(n,t){function o(n){return n&&{}.toString.call(n)==="[object Function]"}var r=0,u=0,f,i=[];i.push(75);i.push(50);i.push(25);i.push(10);var s=function(n){return n/u*100},e=function(){r!==0&&(modalsLogger.log("Interval Cleared"),window.clearInterval(r))},h=function(){var h,a,r,c,l;typeof t!="undefined"&&t!==null&&o(t.getPlayerState)&&(h=n.mediaName,typeof h=="undefined"&&(h=n.MediaName),a=t.getPlayerState(),r=t.getCurrentTime(),u=t.getDuration(),a===YT.PlayerState.PLAYING)&&(r===f&&e(),f=r,c=s(r),modalsLogger.log(c),c>=i[i.length-1]&&(l=i.pop(),modalsLogger.log("GA PROGRESS EVENT: "+l),typeof ga!="undefined"&&ga("send","event","Video","video_progress_"+l+"perc",h,Math.round(r))))},c=function(){e();r=window.setInterval(h,2e3)};return{trackVideoProgress:c}};convertDurationToISO8601=function(n){try{var t=n.split(":"),i=t.length>0?parseInt(t[t.length-1]):0,r=t.length>1?parseInt(t[t.length-2]):0,u=t.length>2?parseInt(t[t.length-3]):0;return"PT"+(u>0?u+"H":"")+(r>0?r+"M":"")+(i>0?i+"S":"")}catch(f){return null}}