// Old Code to open multiple at a time
// var acc = document.getElementsByClassName("accordion");
// var i;
// for (i = 0; i < acc.length; i++) {
// acc[i].addEventListener("click", function() {
// this.classList.toggle("active");
// var panel = this.nextElementSibling;
// if (panel.style.maxHeight) {
// panel.style.maxHeight = null;
// } else {
// panel.style.maxHeight = panel.scrollHeight + "px";
// }
// });
// }
// Making First One Active by default
// document.getElementsByClassName("accordion")[0].classList.add("active");
// document.getElementsByClassName("panel")[0].style.maxHeight = "717px";
// New Code to open one at a time
var acc = document.getElementsByClassName("accordion");
for (var i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
var panel = this.nextElementSibling;
var active = document.querySelector(".accordion.active");
if (active && active !== this) {
active.classList.remove("active");
active.nextElementSibling.style.maxHeight = null;
}
this.classList.toggle("active");
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
});
}
// Open image in wide view
// setTimeout(function(){
// var slides = document.querySelectorAll(".tos-slide img");
// for(let i = 0; i {
button.addEventListener('click', function() {
// hide all sections
$(".explore-more a span .elementor-button-text").html("Explore More");
$(".explore-more a span .elementor-button-icon svg").css({
"transform": "unset"
});
// sections.forEach(section => {
// section.classList.add('section-hidden');
// });
const sectionId = this.parentNode.parentNode.parentNode.id.replace('explore-more-', '');
// buttons.forEach(button => {
// button.classList.remove("section-activated");
// })
const activeBTN = document.getElementById(this.parentNode.parentNode.parentNode.id);
activeBTN.classList.toggle("section-activated");
$(".section-activated a span .elementor-button-text").html("Explore Less");
$(".section-activated a span .elementor-button-icon svg").css({
"transform": "rotate(180deg)"
});
const section = document.getElementById(`pess_car-overview-${sectionId}`);
section.classList.toggle('section-hidden');
});
});
$(document).on("click", "#train-section-item-1 .swiper-slide", function(){
$(".tosrus-lightbox-1 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-1 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-1 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#rl-gallery-container-1 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-1 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-1 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-gallery-1 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#train-section-item-2 .swiper-slide", function(){
$(".tosrus-lightbox-2 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-2 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-2 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#rl-gallery-container-2 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-2 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-2 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-gallery-2 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#train-section-item-3 .swiper-slide", function(){
$(".tosrus-lightbox-3 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-3 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-3 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#rl-gallery-container-3 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-3 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-3 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-gallery-3 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#train-section-item-4 .swiper-slide", function(){
$(".tosrus-lightbox-4 .tos-slide:nth-child(5)").removeClass("tos-loading");
$(".tosrus-lightbox-4 .tos-slide:nth-child(5)").addClass("tos-image");
$(".tosrus-lightbox-4 .tos-slide:nth-child(5)").html('');
})
$(document).on("click", "#rl-gallery-container-4 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-4 .tos-slide:nth-child(5)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-4 .tos-slide:nth-child(5)").addClass("tos-image");
$(".tosrus-lightbox-gallery-4 .tos-slide:nth-child(5)").html('');
})
$(document).on("click", "#train-section-item-7 .swiper-slide", function(){
$(".tosrus-lightbox-7 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-7 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-7 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#rl-gallery-container-7 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-7 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-7 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-gallery-7 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#train-section-item-8 .swiper-slide", function(){
$(".tosrus-lightbox-8 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-8 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-8 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#rl-gallery-container-8 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-8 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-8 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-gallery-8 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#train-section-item-9 .swiper-slide", function(){
$(".tosrus-lightbox-9 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-9 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-9 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#rl-gallery-container-9 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-9 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-9 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-gallery-9 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#rl-gallery-container-12 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-12 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-12 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-gallery-12 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#rl-gallery-container-13 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-13 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-13 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-gallery-13 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#rl-gallery-container-14 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-14 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-14 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-gallery-14 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#rl-gallery-container-15 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-15 .tos-slide:nth-child(5)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-15 .tos-slide:nth-child(5)").addClass("tos-image");
$(".tosrus-lightbox-gallery-15 .tos-slide:nth-child(5)").html('');
})
$(document).on("click", "#rl-gallery-container-18 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-18 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-18 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-gallery-18 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#rl-gallery-container-19 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-19 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-19 .tos3447-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-gallery-19 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#rl-gallery-container-20 .rl-gallery-item", function(){
$(".tosrus-lightbox-gallery-20 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-gallery-20 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-gallery-20 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#train-img-section-resp-1 .swiper-slide", function(){
$(".tosrus-lightbox-23 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-23 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-23 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#train-img-section-resp-2 .swiper-slide", function(){
$(".tosrus-lightbox-24 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-24 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-24 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#train-img-section-resp-3 .swiper-slide", function(){
$(".tosrus-lightbox-25 .tos-slide:nth-child(4)").removeClass("tos-loading");
$(".tosrus-lightbox-25 .tos-slide:nth-child(4)").addClass("tos-image");
$(".tosrus-lightbox-25 .tos-slide:nth-child(4)").html('');
})
$(document).on("click", "#train-img-section-resp-4 .swiper-slide", function(){
$(".tosrus-lightbox-26 .tos-slide:nth-child(5)").removeClass("tos-loading");
$(".tosrus-lightbox-26 .tos-slide:nth-child(5)").addClass("tos-image");
$(".tosrus-lightbox-26 .tos-slide:nth-child(5)").html('');
})
$(document).on("click", "#train-img-section-resp-7 .swiper-slide", function(){
$(".tosrus-lightbox-29 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-29 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-29 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#train-img-section-resp-8 .swiper-slide", function(){
$(".tosrus-lightbox-30 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-30 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-30 .tos-slide:nth-child(1)").html('');
})
$(document).on("click", "#train-img-section-resp-9 .swiper-slide", function(){
$(".tosrus-lightbox-31 .tos-slide:nth-child(1)").removeClass("tos-loading");
$(".tosrus-lightbox-31 .tos-slide:nth-child(1)").addClass("tos-image");
$(".tosrus-lightbox-31 .tos-slide:nth-child(1)").html('');
})
// Code for making the excursions tabs functional
const exButtons = document.querySelectorAll('.elementor-element-a153baa .elementor-inline-item');
const exSections = document.querySelectorAll('.train-section');
exButtons.forEach(button => {
button.addEventListener('click', function() {
// hide all sections
exSections.forEach(section => {
section.classList.add('section-hidden');
});
const exSectionId = this.id.replace('button-train-list-item-', '');
exButtons.forEach(button => {
button.classList.remove("excursion-activated");
})
const activeBTN = document.getElementById(this.id);
activeBTN.classList.add("excursion-activated");
const exSection = document.getElementById(`train-section-item-${exSectionId}`);
exSection.classList.toggle('section-hidden');
});
});
// Code for the scroll bottom sticky button
$(document).ready(function() {
var popupDisplayed = false;
$(document).scroll(function() {
if (!popupDisplayed) {
elementorProFrontend.modules.popup.showPopup({ id: 5013 });
popupDisplayed = true;
}
else if($("#elementor-popup-modal-5013 .dialog-lightbox-message").html() == ""){
popupDisplayed = false;
}
});
});
// Code for excursions form
$('.wpcf7').on('submit', function (event) {
$("#formsubmit").attr("disabled","disabled");
$("#formsubmit").attr("value","Please Wait...");
});
$('.wpcf7').on('wpcf7submit', function(event){
$("#formsubmit").removeAttr("disabled");
$("#formsubmit").attr("value","Submit");
});
// Opens sweet alert on success
$('.wpcf7').on('wpcf7mailsent', function (event) {
var res = event.detail.apiResponse;
// console.log(res);
if(res.message == "Thank you for your message. It has been sent."){
// $("#invalid-phone").css("display","none");
// $(".contactForm").slideToggle();
swal("Thank you for subscribing!", "You'll hear from one of our experts soon.", "success")
.then(function(){
window.location = "/excursions/";
});
}
});
$(document).ready(function() {
$('.formname').on('input', function() {
var inputVal = $(this).val();
if(inputVal.indexOf(" ") == 0) {
$(this).val("");
}
else{
$(this).val(inputVal.replace(/\s{2,}/g, ' '));
}
});
$('.formemail').on('input', function() {
var inputVal = $(this).val();
if(inputVal.indexOf(" ") == 0) {
$(this).val("");
}
else{
$(this).val(inputVal.replace(/\s{2,}/g, ' '));
}
});
});
function alphaOnly(input) {
input.addEventListener('keydown', (e) => {
let charCode = e.keyCode;
if ((charCode >= 65 && charCode <= 90) || charCode == 8 || charCode == 32 || charCode == 9 ) {
null;
} else {
e.preventDefault();
}
});
}
let fullname = document.querySelector(".formname");
alphaOnly(fullname);
let useLessLightboxes = [
'tosrus-christmas-lightbox-1',
'tosrus-christmas-lightbox-2',
'tosrus-lightbox-1',
'tosrus-lightbox-2',
'tosrus-lightbox-3',
'tosrus-lightbox-4',
'tosrus-lightbox-5',
'tosrus-lightbox-6',
'tosrus-lightbox-7',
'tosrus-lightbox-8',
'tosrus-lightbox-9',
'tosrus-lightbox-10',
'tosrus-lightbox-11',
'tosrus-lightbox-12',
'tosrus-lightbox-13',
'tosrus-lightbox-14',
'tosrus-lightbox-gallery-1',
'tosrus-lightbox-gallery-2',
'tosrus-lightbox-gallery-3',
'tosrus-lightbox-gallery-4',
'tosrus-lightbox-gallery-5',
'tosrus-lightbox-gallery-6',
'tosrus-lightbox-gallery-7',
'tosrus-lightbox-gallery-8',
'tosrus-lightbox-gallery-9',
'tosrus-lightbox-gallery-10',
'tosrus-lightbox-gallery-11',
'tosrus-lightbox-gallery-12',
'tosrus-lightbox-gallery-13',
'tosrus-lightbox-gallery-14',
];
$(document).ready(function(){
$(".rl-gallery-item").click(function(){
var releventLightbox = $(this).parent().attr("id").replace("rl-gallery-", "");
let lightBox = document.querySelector(".tosrus-lightbox-gallery-" + releventLightbox);
// console.log(lightBox);
lightBox.style.display = "none";
})
setTimeout(function(){
for(let i = 0; i < useLessLightboxes.length; i++){
document.getElementsByClassName(useLessLightboxes[i])[1].style.display = "none";
}
}, 3000)
})