"use strict";
var fullServices = document.getElementById("full-services"),
sliderArtistHome = document.getElementById("artists-destacadas"),
initKore = function () {
var i = document.body.classList.contains("page-template-template-beach-cruises"),
isMobile = window.innerWidth < 850;
if (fullServices !== null) {
var j = fullServices.firstElementChild.querySelectorAll(".columns");
Array.from(j).forEach(function (a) {
var b = a.querySelector("img"),
tit = a.querySelector(".gdlr-item-title").innerHTML;
a.style.height = a.offsetWidth + "px";
a.style.backgroundImage = "url('" + b.getAttribute("src") + "')";
a.innerHTML = "" + tit + ""
});
var k = function () {
Array.from(j).forEach(function (a) {
a.style.height = a.offsetWidth + "px"
})
};
window.addEventListener("resize", k)
}
if (sliderArtistHome !== null) {
var l = function () {
var c = Array.from(sliderArtistHome.querySelectorAll(".slide")),
margin = 20,
wSlide = c[0].offsetWidth + margin,
navSlider = Array.from(document.getElementById("nav-artists-destacadas").querySelectorAll("span")),
prevSlideArtist = function () {
TweenMax.to(c, 0.3, {
left: "-=" + wSlide,
onComplete: function () {
setTimeout(function () {
c[0].style.left = (wSlide * c.length) + "px";
c[0].parentElement.appendChild(c[0]);
c = Array.from(sliderArtistHome.querySelectorAll(".slide"))
}, 150)
}
})
},
nextSlideArtist = function () {
var a = c[(c.length - 1)];
c[0].parentElement.insertBefore(a, c[0]);
a.style.left = -wSlide + "px";
TweenMax.to(c, 0.3, {
left: "+=" + wSlide,
onComplete: function () {
c = Array.from(sliderArtistHome.querySelectorAll(".slide"))
}
})
};
sliderArtistHome.style.height = (isMobile ? 350 : wSlide) + "px";
c.forEach(function (a, b) {
a.style.left = (wSlide * b) + "px"
});
navSlider.forEach(function (a) {
if (a.classList.contains("prev")) a.addEventListener("click", prevSlideArtist);
else a.addEventListener("click", nextSlideArtist)
})
};
l();
window.addEventListener("resize", l)
}
if (i) {
document.getElementById("mc4wp_form_widget-2").firstChild.innerHTML = "Newsletter";
var m = document.querySelector("#official-movie iframe"),
ourFleet = document.querySelector("#gallery-highlights > div > div"),
highlights = document.querySelector("#highlights .twelve.columns"),
photos = document.getElementById("utopia-photos"),
resizeSliderFYB = function (c, d, e) {
var f = c,
images = Array.from(f.querySelectorAll("li")),
margin = 20,
navSlider = Array.from(f.nextElementSibling.querySelectorAll("span")),
wItem = isMobile ? c.offsetWidth : ((c.offsetWidth - ((e - 1) * margin)) / e),
hItem = 300,
prevImg = function () {
TweenMax.to(images, 0.3, {
left: "-=" + (wItem + margin),
onComplete: function () {
setTimeout(function () {
images[0].style.left = (((wItem + margin) * (images.length - 1)) - ((d && !isMobile) ? (wItem / 2) : 0)) + "px";
images[0].parentElement.appendChild(images[0]);
images = Array.from(f.querySelectorAll("li"))
}, 150)
}
})
},
nextImg = function () {
var a = images[(images.length - 1)];
images[0].parentElement.insertBefore(a, images[0]);
a.style.left = (((d && !isMobile) ? -(wItem / 2) : 0) - (wItem + margin)) + "px";
TweenMax.to(images, 0.3, {
left: "+=" + (wItem + margin),
onComplete: function () {
images = Array.from(f.querySelectorAll("li"))
}
})
};
navSlider.forEach(function (a) {
if (a.classList.contains("prev")) a.addEventListener("click", prevImg);
else a.addEventListener("click", nextImg)
});
if (!isMobile) f.style.width = c.offsetWidth + "px";
images.forEach(function (a, b) {
a.style.left = (b * (wItem + margin)) - ((d && !isMobile) ? (wItem / 2) : 0) + "px";
a.style.height = hItem + "px"
})
},
createSliderFYB = function (c, d, e, f, g) {
var h = document.createElement("ul"),
navGal = document.createElement("div"),
images = Array.from(c.querySelectorAll("." + d));
h.id = e;
h.classList.add("sliderFYB", "col-" + f);
navGal.classList.add("navSliderFYB");
if (g) navGal.classList.add("center");
navGal.innerHTML = '';
images.forEach(function (a) {
var b = a.querySelector("img").getAttribute("src"),
tit = a.querySelector(".feature-media-title"),
itemList = document.createElement("li");
itemList.style.backgroundImage = 'url("' + b + '")';
if (tit !== null) itemList.innerHTML = '' + tit.innerHTML + '';
h.appendChild(itemList);
a.remove()
});
c.appendChild(h);
c.appendChild(navGal);
resizeSliderFYB(h, g, f);
window.addEventListener("resize", function () {
resizeSliderFYB(h, g, f)
})
};
if (ourFleet !== null) createSliderFYB(ourFleet, "gdlr-feature-media-ux", "ourFleet", 3, false);
if (highlights !== null) createSliderFYB(highlights, "gdlr-feature-media-ux", "slHighlights", 6, true);
if (photos !== null) createSliderFYB(photos, "gallery-column", "utopiaPhotos", 6, true);
if (m !== null) m.style.height = m.offsetWidth * (9 / 16) + "px"
}
if (isMobile) {
var n = function () {
var a = window.pageYOffset
};
window.addEventListener("scroll", n)
}
var o = Array.from(document.getElementById("menu-final-menu").querySelectorAll("a"));
o.forEach(function (a, b) {
var c = b + 1;
a.addEventListener("click", function (e) {
if (this.title === "") {
console.log("click");
if (!document.body.classList.contains("home")) window.location.href = "/";
else {
e.preventDefault();
if (c < o.length) TweenMax.to(window, 0.5, {
scrollTo: {
y: document.getElementById("content-section-" + c).offsetTop,
offsetY: 85,
autoKill: false
}
})
}
}
})
});
Array.from(document.querySelectorAll(".btn-reservation")).forEach(function (a) {
a.addEventListener("click", function (e) {
e.preventDefault();
TweenMax.to(window, 0.5, {
scrollTo: {
y: document.getElementById("contact-book").offsetTop,
offsetY: 85,
autoKill: false
}
})
})
})
};
initKore();