-->
-->
-->
jQuery(document).ready(function(){
jQuery(".toggle_btn").click(function(){
jQuery(".collapse-all").slideToggle();
});
});
var map = document.querySelector(".map-modal");
var mapBtn = document.querySelectorAll(".common-frames");
var mapClose = document.querySelectorAll(".map-close");
mapBtn.forEach(function(modalbtn){
modalbtn.addEventListener("click", function(){
map.style.display= "flex";
});
});
mapClose.forEach(function(modalclosebtn){
modalclosebtn.addEventListener("click", function(){
map.style.display= "none";
});
});
var yourArray = [];
$("#contact_dob").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "dd-mm-yy",
onSelect: function(dateText) {
$('#contact_question').html('');
$("input:checkbox[name=Cheltenham]:checked").each(function(){
yourArray.push($(this).val());
});
console.log(yourArray);
let text = yourArray.toString();
$('#contact_question').append('DOB: '+dateText+'\r\n');
if(yourArray.length > 0 ){
$('#contact_question').append('Are You A Member: '+text);
}
}
});
$('.valuefortrainer').click(function(){
if( $('.valuefortrainer').is(':checked') ){
var yourArray = []
$("input:checkbox[name=Cheltenham]:checked").each(function(){
yourArray.push($(this).val());
});
console.log(yourArray);
let text = yourArray.toString();
$('#contact_question').html('');
var dateVariable = $("input#contact_dob").val();
$('#contact_question').append('DOB: '+dateVariable+'\r\n');
$('#contact_question').append('Are You A Member: '+text);
}
else{
var yourArray = []
$("input:checkbox[name=Cheltenham]:checked").each(function(){
yourArray.push($(this).val());
});
console.log(yourArray);
let text = yourArray.toString();
$('#contact_question').html('');
var dateVariable = $("input#contact_dob").val();
if(dateVariable){
$('#contact_question').append('DOB: '+dateVariable+'\r\n');
}
if(yourArray.length > 0 ){
$('#contact_question').append('Are You A Member: '+text);
}
}
});
$(".valueforcremated").change(function() {
if(this.checked) {
$('#contact_question').html('');
$('#contact_question').html('The person signing up is for a person already cremated');
}
});
$(".valueforreservation").change(function() {
if(this.checked) {
$('#contact_question').html('');
$('#contact_question').html('It will serve as a reservation.');
}
});
// Get the button that opens the modal
var btn = document.querySelectorAll(".share-icon");
var icon_close = document.querySelectorAll(".icon-common");
btn.forEach(function(button){
button.addEventListener("click", function(){
this.style.display = "none"
let shareModal = this.closest(".share");
shareModal.querySelector(".share-modal").style.display = "flex";
})
});
icon_close.forEach(function(close){
close.addEventListener("click", function(){
let closeDiv = this.closest(".share-modal");
closeDiv.style.display = "none";
let mainDiv = closeDiv.closest(".share");
mainDiv.querySelector(".share-icon").style.display = "block";
})
});
$('body').on('click','a.share-icon', function(e){
e.stopPropagation();
$(this).attr('style','display:none;');
$(this).siblings(".share-modal").attr('style','display:flex;');
});
$('body').on('click',".klop .icon-common", function(){
$(this).parents(".share-modal").attr('style','display:none;');
$(this).parents(".share-modal").siblings('a').attr('style','display:block;');
});
function openWhatsApp() {
var gethref = $(location).attr('href');
console.log(gethref);
window.open('https://api.whatsapp.com/send?text=Please check this '+gethref);
}
function openEmailApp() {
var gethref = $(location).attr('href');
var title = 'You could have your ashes laid to rest at Cheltenham';
console.log(gethref);
console.log(title);
window.open('mailto:?subject='+title+'&body='+gethref);
}
function opentwitter() {
var gethref = $(location).attr('href');
console.log(gethref);
window.open('https://twitter.com/share?text=Im Sharing on Twitter&url='+gethref);
}
$('[data-layout-name="common__banner"] > div > div:nth-of-type(3) #buttonLink a').attr('onclick',"Calendly.initPopupWidget({url: 'https://calendly.com/d/zty-6zw-stm/spirit-of-sport-cheltenham-call'});return false;");
$('[data-layout-name="common__banner"] > div > div:nth-of-type(5) #buttonLink').append('');
$('[data-layout-name="common__banner"] > div > div:nth-of-type(5) #buttonLink > a').addClass("share-icon");
var btnFixed = document.querySelector('.btn-fixed');
var btnFixedTop = btnFixed.getBoundingClientRect().top - document.body.getBoundingClientRect().top;
window.addEventListener('scroll', function(){
if (document.documentElement.scrollTop > btnFixedTop){
btnFixed.classList.add("fixed-btns");
}
else
{
btnFixed.classList.remove("fixed-btns");
}
});
// Blog append
var getblog = $('.blog_main').html();
$('#blogs__append').html('');
$('#blogs__append').append(''+getblog+'
');
// equal column height
if($(window).width() > 767){
var blogDiv = document.querySelectorAll(".blog_main .blog");
var getColumnheight = 0;
blogDiv.forEach(function(column){
let columnGet = column.querySelectorAll(".blog_content_inner h3");
columnGet.forEach(function(columnHeading){
getColumnheight = Math.max(getColumnheight, columnHeading.offsetHeight);
});
});
blogDiv.forEach(function(items){
items.querySelector("h3").style.height = getColumnheight + "px"
});
}
$("[data-widget-id='0de3bc53-98a6-4661-a647-0346c48c1938']").click(function(){
$("#player-79e2e175-4534-41be-b351-58cdee939efc").trigger('click')
})