jQuery.noConflict();
(function ($) {
$(document).ready(function (e) {
if (window.location !== window.parent.location) {
// The page is in an iframe
if ($("#uff").length > 0) {
submissionmessage = $("#uff").html();
$("body").html(
'
' +
submissionmessage +
"
"
);
}
}
if ($(".searchformsubmit").length > 0) {
$(".searchformsubmit").attr("aria-label", "Search");
}
$(":checkbox").on("keypress", function (event) {
if (event.which === 13) {
$(this).prop("checked", !$(this).prop("checked"));
}
});
function setmenustate() {
if ($(window).scrollTop() != 0) {
$(".topbar").addClass("scrolledmenu");
} else {
$(".topbar").removeClass("scrolledmenu");
}
}
setmenustate();
$(window).scroll(function () {
setmenustate();
});
if ($(".parallax").length > 0) {
disable = $(".parallax").css("position");
if (disable == "relative") {
window.addEventListener("scroll", function () {
const distance = window.scrollY;
document.querySelector(
".parallax"
).style.transform = `translateY(${distance * 0.5}px)`;
});
}
}
/* drop down subpages selector button script */
if ($(".subpagesubmit").length > 0) {
$(".subpagesubmit").click(function () {
newpage = $(this).prev(".subpagedropdownselect").val();
if (newpage.length > 0) {
window.location.href = newpage;
return false;
}
});
}
/* home switcher auto rotate scripts */
switcheron = 0;
numhomeswitcheritems = 0;
if ($(".homeswitcher .switcher").length > 0) {
numhomeswitcheritems = $(".homeswitcher .switcher input").length;
if (numhomeswitcheritems > 1) {
switchswitcher = setInterval(function () {
changeswitcher();
}, 5000);
}
}
function changeswitcher() {
switcheron++;
if (switcheron >= numhomeswitcheritems) {
switcheron = 0;
}
$(".homeswitcher .switcher input").attr("checked", false);
$(
".homeswitcher .switcher input:nth-of-type(" +
(switcheron + 1) +
")"
).attr("checked", true);
}
$(".homeswitcher .switcher label").click(function () {
clearInterval(switchswitcher);
});
/* GDPR Cookie */
$(".noticesblackout").click(function () {
$(this).hide();
$(".noticedialogwrapper").hide();
});
/* Set up scroll menu if one exists */
scrollhighlightoverride = false;
if ($(".scrollmenu").length > 0) {
$(".scrollmenu").show();
buildscrollmenu();
$(window).scroll(function () {
clearTimeout($.data(this, "scrollTimer"));
$.data(
this,
"scrollTimer",
setTimeout(function () {
scrollhighlightoverride = false;
}, 100)
);
resetscrollmenu();
});
$(".scrollmenu ul li").click(function () {
scrollhighlightoverride = true;
$(".scrollmenu ul li").removeClass("scrollmenuover");
$(this).addClass("scrollmenuover");
});
resetscrollmenu();
}
function buildscrollmenu() {
scrollmenuhtml = "";
scrollid = 0;
fullbase = $("body").attr("data-fullbase");
$(".main h1, [data-scroll-label]").each(function (index) {
if ($(this).attr("data-scroll-label")) {
$(this).prepend(
''
);
scrollmenuhtml +=
'' +
$(this).attr("data-scroll-label") +
"";
scrollid++;
} else if ($(this).is("h1") == true) {
if ($(this).is(":visible") == true) {
$(this).attr("id", "scrollid" + scrollid);
scrollmenuhtml +=
'' +
$(this).html() +
"";
scrollid++;
} else {
$(this).attr("id", "");
}
}
});
if (scrollmenuhtml != "") {
$(".scrollmenu").html("");
}
}
function resetscrollmenu() {
if (scrollhighlightoverride == false) {
linkon = 0;
scrollmenutop = $(".scrollmenu").offset().top;
$(".main h1, [data-scroll-label]").each(function (index) {
if ($(this).is(":visible") == true) {
if ($(this).offset().top < scrollmenutop) {
linkon++;
}
}
});
$(".scrollmenu ul li").removeClass("scrollmenuover");
$(".scrollmenu ul li:nth-child(" + linkon + ")").addClass(
"scrollmenuover"
);
}
}
/* animated switching tag lines */
if ($(".taganimtype_3").length) {
setTimeout(function () {
switchtagline(1);
}, 1000);
}
if ($(".taganimtype_4").length) {
setTimeout(function () {
switchtagline(2);
}, 1000);
}
if ($(".taganimtype_5").length) {
setTimeout(function () {
switchtagline(1);
}, 1000);
}
if ($(".taganimtype_6").length) {
$(".tagline")
.children(".taganim")
.children(".anim")
.css("opacity", "0");
setTimeout(function () {
switchtagline(2);
}, 1000);
}
taganimshowing = 0;
var hidetagletters;
var showtagletters;
temptagholderout = "";
temptagholder = "";
function switchtagline(anim) {
tottls = $(".tagline").children(".taganim").length;
fadeout = taganimshowing;
fadein = taganimshowing + 1;
if (fadein >= tottls) {
fadein = 0;
}
if (anim == 1) {
$(".tagline")
.children(".taganim:nth-child(" + (fadeout + 1) + ")")
.children(".anim")
.fadeOut(750, function () {
if ($(".tagline .taganim .top").length) {
$(".tagline")
.children(
".taganim:nth-child(" + (fadeout + 1) + ")"
)
.children(".top")
.hide();
$(".tagline")
.children(
".taganim:nth-child(" + (fadein + 1) + ")"
)
.children(".top")
.show();
}
$(".tagline")
.children(
".taganim:nth-child(" + (fadein + 1) + ")"
)
.children(".anim")
.fadeIn(750);
taganimshowing = fadein;
setTimeout(function () {
switchtagline(1);
}, 3000);
});
} else {
temptagholderout = $(".tagline")
.children(".taganim:nth-child(" + (fadeout + 1) + ")")
.children(".anim")
.html();
hidetagletters = setInterval(function () {
hidetaglets(fadeout, fadein);
}, 100);
}
}
function hidetaglets(fout, fin) {
textnow = "";
$(".tagline")
.children(".taganim:nth-child(" + (fout + 1) + ")")
.children(".anim")
.html(textnow);
if (textnow == "") {
clearInterval(hidetagletters);
$(".tagline")
.children(".taganim:nth-child(" + (fout + 1) + ")")
.children(".anim")
.hide();
$(".tagline")
.children(".taganim:nth-child(" + (fout + 1) + ")")
.children(".anim")
.html(temptagholderout);
temptagholder = $(".tagline")
.children(".taganim:nth-child(" + (fin + 1) + ")")
.children(".anim")
.html();
$(".tagline")
.children(".taganim:nth-child(" + (fin + 1) + ")")
.children(".anim")
.html("")
.show();
taganimshowing = fin;
if ($(".tagline .taganim .top").length) {
$(".tagline")
.children(".taganim:nth-child(" + (fout + 1) + ")")
.children(".top")
.hide();
$(".tagline")
.children(".taganim:nth-child(" + (fin + 1) + ")")
.children(".top")
.show();
}
showtagletters = setInterval(function () {
showtaglets(fin);
}, 130);
}
}
function showtaglets(fin) {
$(".tagline")
.children(".taganim")
.children(".anim")
.css("opacity", "1");
textnow = $(".tagline")
.children(".taganim:nth-child(" + (fin + 1) + ")")
.children(".anim")
.html();
if (temptagholder == textnow) {
clearInterval(showtagletters);
// setTimeout(function () {
// switchtagline(2);
// }, 3000);
} else {
nowlen = textnow.length;
textnew = temptagholder.slice(0, nowlen + 1);
$(".tagline")
.children(".taganim:nth-child(" + (fin + 1) + ")")
.children(".anim")
.html(textnew);
}
}
/* Set up all lazy animations */
if ($("[data-lazy]").length > 0) {
$("[data-lazy]").each(function (index) {
if (
$(this).offset().top - $(window).height() + 100 >
$(window).scrollTop()
) {
//is below page on load so prepare
$(this).css({ opacity: "0" });
if ($(this).attr("data-lazy") != "center") {
origpostype = $(this).css("position");
if (origpostype == "static") {
if ($(this).attr("data-lazy") == "left") {
$(this).css({
position: "relative",
left: "-100vw",
});
$(this).attr("data-return", "true");
} else {
$(this).css({
position: "relative",
left: "100vw",
});
$(this).attr("data-return", "true");
}
}
}
} else {
if ($(this).attr("data-lazy") == "leftforce") {
$(this).css({ opacity: "0" });
$(this).css({ position: "relative", left: "-100vw" });
$(this).animate({ opacity: 1, left: 0 }, 1000);
}
if ($(this).attr("data-lazy") == "centerforce") {
$(this).css({ opacity: "0" });
$(this).animate({ opacity: 1 }, 1000);
}
if ($(this).attr("data-lazy") == "rightforce") {
$(this).css({ opacity: "0" });
$(this).css({ position: "relative", left: "100vw" });
$(this).animate({ opacity: 1, left: 0 }, 1000);
}
}
});
$(window).scroll(function () {
checklazy();
});
$(window).resize(function () {
checklazy();
});
}
function checklazy() {
$("[data-lazy]").each(function (index) {
if (
$(this).offset().top - $(window).height() + 100 <=
$(window).scrollTop()
) {
//is on page
if ($(this).attr("data-return") == "true") {
$(this).animate({ opacity: 1, left: 0 }, 1000);
} else {
$(this).animate({ opacity: 1 }, 1000);
}
}
});
}
/* Set up animation triggers if exist */
triggered = [];
if ($("[data-anim]").length > 0) {
$(window).scroll(function () {
checktriggers();
});
$(window).resize(function () {
checktriggers();
});
}
function checktriggers() {
$("[data-anim]").each(function (index) {
if (
$(this).offset().top - $(window).height() <=
$(window).scrollTop()
) {
animtriggered = false;
for (t = 0; t < triggered.length; t++) {
if (triggered[t] == $(this).attr("data-anim")) {
animtriggered = true;
}
}
if (animtriggered == false) {
triggered[triggered.length] = $(this).attr("data-anim");
try {
animattr = $(this).attr("data-anim");
if (animattr.split("-").length > 1) {
getvars = animattr.split("-");
eval(getvars[0] + "(" + getvars[1] + ")");
} else {
eval(animattr + "()");
}
} catch (err) {
try {
window[$(this).attr("data-anim")]();
} catch (err) {}
}
}
}
});
}
checktriggers();
function uniq(a) {
return a.filter(function (item, pos, ary) {
return !pos || item != ary[pos - 1];
});
}
function cleanhtmldept(str) {
return String(str)
.replace(/&/g, "&")
.replace(//g, ">")
.replace(/"/g, """);
}
depton = 0;
stafffilters = [];
if ($(".stafffilter").length > 0) {
$(".stafffilter").each(function (index) {
bpos = $(this).attr("data-bloqpos");
thesedepts = [];
$("[data-bloqposstaff='" + bpos + "']").each(function (index) {
thesedepts[thesedepts.length] =
$(this).attr("data-department");
});
depts = uniq(thesedepts);
filterhtml = "";
for (i = 0; i < depts.length; i++) {
$(
"[data-department='" +
depts[i] +
"'][data-bloqposstaff='" +
bpos +
"']"
).addClass("bpos-" + bpos + "-dept-" + depton);
filterhtml +=
'' +
depts[i] +
"";
stafffilters[stafffilters.length] = [bpos, depton, 0];
depton++;
}
$(this).html(filterhtml);
});
$(".filterfilter").on("click", function () {
filterwhat = $(this).attr("data-filterwhat");
fsplit = filterwhat.split("-");
showall = true;
$("[data-bloqposstaff='" + fsplit[1] + "']").hide();
for (i = 0; i < stafffilters.length; i++) {
if (stafffilters[i][0] == fsplit[1]) {
if (stafffilters[i][1] == fsplit[3]) {
if (stafffilters[i][2] == 1) {
stafffilters[i][2] = 0;
$(this).removeClass("selected");
$("." + filterwhat).hide();
} else {
stafffilters[i][2] = 1;
showall = false;
$(this).addClass("selected");
$("." + filterwhat).show();
}
} else {
if (stafffilters[i][2] == 1) {
showall = false;
$(
".bpos-" +
stafffilters[i][0] +
"-dept-" +
stafffilters[i][1]
).show();
}
}
}
}
if (showall == true) {
$("[data-bloqposstaff='" + fsplit[1] + "']").show();
}
});
}
function loadhomepagecalendar() {
$('div[data-anim*="loadhomepagecalendar"]').animate(
{ opacity: 1 },
500
);
}
//Javascript click event for arrows to scroll events on each day - home calendar
eventpageon = 0;
showperpage = 3;
$("#downEvents").on("click", function () {
numeventsonpage = $(".dayscroll").children().length;
numpages = Math.ceil(numeventsonpage / showperpage);
if (eventpageon < numpages - 1) {
eventpageon++;
}
if (eventpageon > numpages - 1) {
eventpageon = numpages - 1;
}
rendereventspageon();
});
$("#upEvents").on("click", function () {
if (eventpageon > 0) {
eventpageon--;
}
rendereventspageon();
});
function rendereventspageon() {
$(".dayscroll").children().hide();
for (
i = eventpageon * showperpage + 1;
i <= eventpageon * showperpage + showperpage;
i++
) {
$(".dayscroll")
.children(":nth-child(" + i + ")")
.show();
}
}
/* housepoint spinners */
$(".SpinnerContainer").each(function (index) {
$(this).children(".spinner").show();
$(this).siblings(".spinnerperc").html("0");
});
var housepointcount;
function counthousepoints() {
largestpoints = 0;
$(".spinner").each(function (index) {
points = parseInt($(this).attr("data-measure"));
if (points > largestpoints) {
largestpoints = points;
}
});
$(".spinner").each(function (index) {
points = $(this).attr("data-measure");
perc = (points / largestpoints) * 100;
$(this)
.children(".spinnersvg")
.children(".spinnerresult")
.attr(
"style",
"stroke-dasharray: calc(3 * " +
perc +
"%) calc(3 * (100% - " +
perc +
"%))"
);
$(this).addClass("spingo");
});
housepointcount = setInterval(function () {
housepointscount();
}, 100);
}
function housepointscount() {
stophousepointscount = false;
$(".House").each(function (index) {
pointscounted = parseInt(
$(this).children(".spinnerperc").html()
);
points = parseInt(
$(this)
.children(".SpinnerContainer")
.children(".spinner")
.attr("data-measure")
);
if (pointscounted < points) {
newpoints = Math.round(pointscounted + points / 50);
if (newpoints >= points) {
newpoints = points;
stophousepointscount = true;
}
} else {
newpoints = points;
}
$(this).children(".spinnerperc").html(newpoints);
});
if (stophousepointscount == true) {
clearInterval(housepointcount);
$(".House").each(function (index) {
points = parseInt(
$(this)
.children(".SpinnerContainer")
.children(".spinner")
.attr("data-measure")
);
$(this).children(".spinnerperc").html(points);
});
}
}
/* bubbles */
function startcounting() {
$(".countthis").each(function (index) {
$(this).html(0);
});
timer = setInterval(function () {
countbubble();
}, 100);
}
const bubblescounted = [];
function countbubble() {
$(".countthis").each(function (index) {
let thispos = parseInt($(this).attr("data-pos"));
bubblescounted[thispos] = true;
console.log("BUBBLE");
let pointscounted = parseInt($(this).html());
console.log("Points counted: " + pointscounted);
let target = parseInt($(this).attr("data-measure"));
console.log("Target: " + target);
let increment = target / 100;
if (increment < 1) {
increment = 1;
}
console.log("Increment: " + increment);
pointscounted += increment;
if (pointscounted >= target) {
pointscounted = target;
bubblescounted[thispos] = false;
}
pointscountedpadded = pointscounted;
if (pointscounted < 10) {
pointscountedpadded = "0" + pointscounted;
}
$(this).html(Math.floor(pointscountedpadded));
stopcounting = true;
for (i = 0; i < bubblescounted.length; i++) {
if (bubblescounted[i] == true) {
stopcounting = false;
}
}
if (stopcounting == true) {
clearInterval(timer);
}
});
}
/* gallery set up lightbox */
if ($(".lightboxlink").length) {
$(".lightboxlink").each(function (index) {
$(this).attr("data-lightbox", $(this).attr("href"));
$(this).removeAttr("href");
$(this).click(function () {
lightbox(
$(this).attr("data-lightbox"),
$(this).attr("data-lightbox-gall"),
$(this).attr("data-lightbox-inline")
);
});
});
}
lightboxopen = false;
curimgsize = [0, 0];
curgallerybloq = 0;
function lightbox(imgurl, gallnumber, lightboxstyle) {
lightboxopen = true;
for (i = 0; i < lb_img.length; i++) {
for (p = 0; p < lb_img[i].length; p++) {
if (
lb_img[i][p][0] == imgurl &&
lb_img[i][p][4] == gallnumber
) {
curgallerybloq = i;
lasti = p - 1;
if (lasti < 0) {
lasti = lb_img[i].length - 1;
}
nexti = p + 1;
if (nexti >= lb_img[i].length) {
nexti = 0;
}
curimgsize[0] = lb_img[i][p][1];
curimgsize[1] = lb_img[i][p][2];
}
}
}
if (lightboxstyle == 1) {
$("#inlinelightboximage-" + gallnumber).html(
''
);
} else {
$(".lightboxinner").css(
"background-image",
"url(" + imgurl + ")"
);
$(".lightbox").show();
resizelightboximage();
$(".close, .last, .next").unbind();
$(".close").click(function () {
$(".lightbox").hide();
lightboxopen = false;
});
$(".last").click(function () {
lightbox(
lb_img[curgallerybloq][lasti][0],
gallnumber,
lightboxstyle
);
});
$(".next").click(function () {
lightbox(
lb_img[curgallerybloq][nexti][0],
gallnumber,
lightboxstyle
);
});
}
}
$(window).resize(function () {
if (lightboxopen == true) {
resizelightboximage();
}
});
function resizelightboximage() {
lbwidth = $(".lightboxinner").innerWidth();
lbheight = $(".lightboxinner").innerHeight();
if (curimgsize[0] >= lbwidth || curimgsize[1] >= lbheight) {
$(".lightboxinner").css("background-size", "contain");
} else {
$(".lightboxinner").css(
"background-size",
curimgsize[0] + "px, " + curimgsize[1] + "px"
);
}
}
/* Box sliders */
animating = false;
$("span.f").click(function () {
if (animating == false) {
animating = true;
slider = $(this).siblings(".sliderwrapper");
inner = $(this)
.siblings(".sliderwrapper")
.children(".sliderinner");
group = $(this)
.siblings(".sliderwrapper")
.children(".sliderinner")
.children(".slidergroup");
iteminner = $(this)
.siblings(".sliderwrapper")
.children(".sliderinner")
.children(".slidergroup")
.children(".iteminner");
var innerpos = inner.position();
vertspacing =
iteminner.outerHeight(true) - iteminner.outerHeight(false);
if (
inner.height() + innerpos.top - vertspacing >
slider.outerHeight(true)
) {
newtop = innerpos.top - group.outerHeight(true);
inner.animate(
{
top: newtop + "px",
},
500,
function () {
animating = false;
}
);
} else {
animating = false;
}
}
});
$("span.b").click(function () {
if (animating == false) {
animating = true;
inner = $(this)
.siblings(".sliderwrapper")
.children(".sliderinner");
item = $(this)
.siblings(".sliderwrapper")
.children(".sliderinner")
.children(".slidergroup");
var innerpos = inner.position();
if (innerpos.top < 0) {
newtop = innerpos.top + item.outerHeight(true);
inner.animate(
{
top: newtop + "px",
},
500,
function () {
animating = false;
}
);
} else {
animating = false;
}
}
});
$(window).resize(function () {
resetverticalsliders();
});
function resetverticalsliders() {
$(".slider_v")
.children(".sliderouter")
.children(".sliderwrapper")
.children(".sliderinner")
.css("top", "0px");
}
//remove side scrollbar when hamburger / mobile / splash menu displayed
$(".menutoggle").click(function (e) {
$("html,body").css("overflow", "hidden");
});
$(".menunotoggle, .searchtoggle").click(function (e) {
$("html,body").css("overflow", "hidden auto");
});
//header slideshow ticker selector
$(".ticker").click(function (e) {
if ($(".ticker").length == 1) {
if ($(".sliderfade").length) {
numslides = $(".sliderfade div").length;
} else {
numslides = $(".sliderslide div").length;
}
lrextra =
($(this).outerWidth() - parseInt($(this).css("width"))) / 2;
slidetoshow =
Math.floor(
(e.pageX - ($(this).offset().left + lrextra)) /
(parseInt($(this).css("width")) / numslides)
) + 1;
if (slidetoshow < 1) {
slidetoshow = 1;
}
if (slidetoshow > numslides) {
slidetoshow = numslides;
}
if ($(".sliderfade").length) {
$("div.sliderfade > div")
.css({ "animation-name": "none", opacity: "1" })
.hide();
$(
"div.sliderfade > div:nth-child(" + slidetoshow + ")"
).show();
} else {
$("div.sliderslide > div")
.css({ "animation-name": "none", opacity: "1" })
.hide();
$(
"div.sliderslide > div:nth-child(" + slidetoshow + ")"
).show();
}
}
});
//close and set timestamp cookie for notices
//if website setting has called for users who have accepted gdpr to see notices only once
if (
typeof setnewnoticecookie !== "undefined" &&
setnewnoticecookie == true
) {
//check to see if gdpr accepted - if so set close action to set new cookie for notices seen date
if (document.cookie.indexOf("gdprAccepted=") >= 0) {
$(".noticedialogclose").click(function () {
closebuttonid = $(this).attr("ID");
exploded = closebuttonid.split("Cookie");
homepageid = exploded[1];
date = new Date().getTime();
expiredate = new Date();
timestamp = Math.floor(date / 1000);
var expireTime = date + 1000 * 60 * 60 * 24 * 30;
expiredate.setTime(expireTime);
//alert( "set new cookie " + timestamp );
document.cookie =
"noticesseen" +
homepageid +
"=" +
timestamp +
";expires=" +
expiredate.toGMTString() +
";path=/";
});
}
}
/* accessibility */
if ($("#accessibilitymenu").length > 0) {
controls = [];
controls[0] = ["reset", "../?font=reset&viz=reset"];
controls[1] = ["text", "../?font=normal"];
controls[2] = ["large", "../?font=large"];
controls[3] = ["xlarge", "../?font=x-large"];
controls[4] = ["highviz", "../?viz=high"];
controls[5] = ["lowviz", "../?viz=reset"];
labels = [];
labels[0] = "Standard View";
labels[1] = "Text Only View";
labels[2] = "Large Text Only View";
labels[3] = "Extra Large Text Only View";
labels[4] = "High Visibility Mode";
labels[5] = "Standard Visibility Mode";
if (
(accessibilitymode[0] == "" && accessibilitymode[1] == "") ||
accessibilitymode.length == 0
) {
controls[0][0] = "";
controls[5][0] = "";
}
if (
accessibilitymode[0] == "" &&
accessibilitymode[1] == "highviz"
) {
controls[1][0] = "text selected";
controls[4][0] = "";
}
if (accessibilitymode[0] == "normal") {
controls[1][0] = "text selected";
}
if (accessibilitymode[0] == "large") {
controls[2][0] = "large selected";
}
if (accessibilitymode[0] == "x-large") {
controls[3][0] = "xlarge selected";
}
if (accessibilitymode[1] == "highviz") {
controls[4][0] = "";
}
if (accessibilitymode[1] == "") {
controls[5][0] = "";
}
controlshtml = "";
for (i = 0; i < controls.length; i++) {
if (controls[i][0] != "") {
controlshtml +=
'';
}
}
$("#accessibilitymenu").html(controlshtml);
}
function accessibility(fontsize, highviz) {
//modearray = [base font-size,images]
$('link[rel=stylesheet]:not([href*="accessibility"])').remove();
$(".sidebar, img, .topnav").hide();
$("fieldset").css({ border: "2px solid #999" });
$(".searchformsubmit span").html("Submit");
$(".mobilelevel1Menu li").css({ "list-style-type": "circle" });
$(".quicklinkImage, .usefulLinksImage").css({
"background-image": "none",
"background-color": "transparent",
});
$(".titleText, .eventcolor").css({
"background-color": "transparent",
});
$("div.gallery").hide();
$("header.header").css({ position: "static" });
$(
"input:checkbox, input:radio, div.homevideo, div.headerslider, div.map, div.SpinnerContainer"
).hide();
$("div.HouseName, div.spinnerperc").css({ color: "#000" });
if (highviz != "") {
$(
"div.main, blockquote, pre, div.letter, a.assetLink, a.assetInlineLink, label.expandertitle, body"
).css({ "background-color": "#000" });
$("*").css({ color: "#FFFF00" });
$("a, label.expandertitle").css({
color: "#FFFF00",
"font-weight": "bold",
});
$(".searchformsubmit span").css({
color: "#000",
"font-weight": "bold",
});
}
if (fontsize != "" && fontsize != "normal") {
if (fontsize == "large") {
$("body").css({
transform: "scale(1.25)",
"transform-origin": "0 0",
width: "calc(80% - 10px)",
});
}
if (fontsize == "x-large") {
$("body").css({
transform: "scale(2)",
"transform-origin": "0 0",
width: "calc(50% - 10px)",
});
}
}
$("#accessibilitymenu").css({
position: "fixed",
top: "0",
right: "0",
});
$("body").css({ margin: "0", padding: "5px" });
}
if (accessibilitymode.length > 0) {
accessibility(accessibilitymode[0], accessibilitymode[1]);
}
/* tab groups and home tab groups */
$(".tabgroup").each(function (index) {
$(this)
.children(".tabgrouptab")
.click(function () {
setTimeout(function () {
//pause videos
document
.querySelectorAll("video")
.forEach((vid) => vid.pause());
//reset calendar bloq
if (typeof stylewidths !== "undefined") {
if (Array.isArray(stylewidths)) {
widthstyle = new Array();
$("#calendarOuter").removeClass(
"cal_mobile cal_tablet"
);
for (sw = 0; sw < stylewidths.length; sw++) {
if (
$(".calendarWrapper").width() <=
stylewidths[sw][0]
) {
$("#calendarOuter").addClass(
stylewidths[sw][1]
);
}
}
setcalmonthcontainerheight();
if (
viewwidths[1] <
$(".calendarWrapper").width() &&
viewinglist == true
) {
renderCalendar();
}
if (
viewwidths[1] >=
$(".calendarWrapper").width() &&
viewinglist == false
) {
renderCalendar();
}
if (
viewwidths[1] >=
$(".calendarWrapper").width() &&
viewinglist == true
) {
$(".optionsWrapper").html(
togglefiltershtml
);
}
if (allowtoggle == true) {
if (
viewwidths[1] <
$(".calendarWrapper").width()
) {
$(".optionsWrapper").html(
'' +
togglefiltershtml
);
}
}
setcalendarevents();
}
}
}, 0);
});
});
toggletabclick = false;
$(".homegrouptablabels").each(function (index) {
$(this)
.children(".hometabgrouptab:first-child")
.addClass("selected");
$(this)
.children(".hometabgrouptab")
.click(function () {
$(this)
.parent()
.children(".hometabgrouptab")
.removeClass("selected");
$(this).addClass("selected");
setTimeout(function () {
//reset calendar
if (typeof stylewidths !== "undefined") {
if (Array.isArray(stylewidths)) {
widthstyle = new Array();
$("#calendarOuter").removeClass(
"cal_mobile cal_tablet"
);
for (sw = 0; sw < stylewidths.length; sw++) {
if (
$(".calendarWrapper").width() <=
stylewidths[sw][0]
) {
$("#calendarOuter").addClass(
stylewidths[sw][1]
);
}
}
setcalmonthcontainerheight();
if (
viewwidths[1] <
$(".calendarWrapper").width() &&
viewinglist == true
) {
renderCalendar();
}
if (
viewwidths[1] >=
$(".calendarWrapper").width() &&
viewinglist == false
) {
renderCalendar();
}
if (
viewwidths[1] >=
$(".calendarWrapper").width() &&
viewinglist == true
) {
$(".optionsWrapper").html(
togglefiltershtml
);
}
if (allowtoggle == true) {
if (
viewwidths[1] <
$(".calendarWrapper").width()
) {
$(".optionsWrapper").html(
'' +
togglefiltershtml
);
}
}
setcalendarevents();
}
}
});
});
});
////////////////////////////////////////////////////////////////////////
//SHOP SCRIPTS//////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
function getextrafields() {
ex1 = $("#recipient").val();
ex2 = $("#phone").val();
ex3 = $("#message").val();
return Array(ex1, ex2, ex3);
}
var itemschosen = [];
var totalnumberofitemstopurchase = 0;
$(".additem").click(function () {
okaytoadd = true;
obj = $(this).parent().parent();
itemprice = parseFloat(obj.children(".hiddenprice").html());
postprice = parseFloat(obj.children(".hiddenpostprice").html());
postperitem = parseFloat(obj.children(".hiddenpostperitem").html());
id = obj.attr("data-item");
if (obj.children(".availability").children(".remaining").length) {
remaining = parseInt(
obj.children(".availability").children(".remaining").html()
);
if (remaining > 0) {
remaining--;
obj.children(".availability")
.children(".remaining")
.html(remaining);
} else {
okaytoadd = false;
}
}
if (okaytoadd == true) {
added = false;
numbought = 1;
for (ic = 0; ic < itemschosen.length; ic++) {
if (itemschosen[ic][0] == id) {
itemschosen[ic][1]++;
added = true;
numbought = itemschosen[ic][1];
}
}
if (added == false) {
itemschosen[itemschosen.length] = [id, 1];
}
obj.children(".addremove").children(".bought").html(numbought);
changeshoptotal(itemprice, postprice, postperitem);
}
});
$(".removeitem").click(function () {
okaytoremove = true;
obj = $(this).parent().parent();
itemprice = parseFloat(obj.children(".hiddenprice").html());
postprice = parseFloat(obj.children(".hiddenpostprice").html());
postperitem = parseFloat(obj.children(".hiddenpostperitem").html());
id = obj.attr("data-item");
if (
parseInt(
obj.children(".addremove").children(".bought").html()
) > 0
) {
bought = parseInt(
obj.children(".addremove").children(".bought").html()
);
bought--;
if (
obj.children(".availability").children(".remaining").length
) {
remaining = parseInt(
obj
.children(".availability")
.children(".remaining")
.html()
);
remaining++;
obj.children(".availability")
.children(".remaining")
.html(remaining);
}
} else {
okaytoremove = false;
}
if (okaytoremove == true) {
for (ic = 0; ic < itemschosen.length; ic++) {
if (itemschosen[ic][0] == id) {
itemschosen[ic][1]--;
if (itemschosen[ic][1] == 0) {
itemschosen.splice(ic, 1);
}
}
}
obj.children(".addremove").children(".bought").html(bought);
changeshoptotal(-itemprice, postprice, postperitem);
}
});
function changeshoptotal(amount, postprice, postperitem) {
if (amount > 0) {
//adding item
totalnumberofitemstopurchase++;
itemprice = amount;
} else {
//removing item
totalnumberofitemstopurchase--;
itemprice = 0 - amount;
}
//totalpricenow = parseFloat($('#totalmonetaryvalue').html());
//totalpricenow += amount;
if (totalnumberofitemstopurchase == 0) {
//none selected
totalpricenow = 0;
}
if (totalnumberofitemstopurchase == 1) {
//one selected
totalpricenow = itemprice + postprice;
}
if (totalnumberofitemstopurchase > 1) {
//more selected selected
if (postperitem == 0) {
totalpricenow =
itemprice * totalnumberofitemstopurchase + postprice;
} else {
totalpricenow =
(itemprice + postprice) * totalnumberofitemstopurchase;
}
}
$("#totalmonetaryvalue").html(
(Math.round(totalpricenow * 100) / 100).toFixed(2)
);
}
$("#submitbutton").click(function () {
//alert(itemschosen);
if (itemschosen.length > 0) {
asURLString = encodeURI(JSON.stringify(itemschosen));
//alert('SEND THIS ARRAY TO PURCHASE FORM PAGE - ON LOAD CHECK THAT TICKETS STILL AVAILABLE AND THEN ADD THEM AND LOCK THEM WITH TIMESTAMP TO THE SHOP SOLD JSON ' + itemschosen);
newhref = window.location.href + "&buy=" + asURLString;
window.location.href = newhref;
} else {
alert("You must add some items to your purchase");
}
});
if ($("#totalprice").length > 0) {
$(window).scroll(function () {
setpurchasebar();
});
$(window).resize(function () {
setpurchasebar();
});
setpurchasebar();
}
function setpurchasebar() {
dockat = $("#hiddenpricedock").offset().top + 80;
if ($(window).height() + $(window).scrollTop() < dockat) {
$("#totalprice").css({
position: "fixed",
bottom: "0px",
top: "auto",
left: "0px;",
});
} else {
$("#totalprice").css({
position: "relative",
bottom: "auto",
top: "0px",
left: "0px;",
});
}
}
if ($("#card-element").length > 0) {
var card = elements.create("card", {
style: {
base: {
color: "#4d4d4d",
fontWeight: 100,
fontFamily: "sans-serif",
fontSize: "16px",
"::placeholder": {
color: "#888",
},
},
},
});
card.mount("#card-element");
card.addEventListener("change", function (errrrr) {
var error = errrrr.error;
var displayError = document.getElementById("card-errors");
if (error) {
displayError.textContent = error.message;
} else {
displayError.textContent = "";
}
});
var spinner = document.getElementById("paymentProcessing");
var success = document.getElementById("paymentSuccess");
var paymentForm = document.getElementById("paymentFormWrapper");
var submitButton = document.getElementById("submit");
submitButton.addEventListener("click", function (ev) {
//ajax call to check time on purchase hasn't expired (another person hasn't opened shop and item been removed because of 15 minute limit)
currentpage =
location.protocol +
"//" +
location.host +
location.pathname +
"?transid=" +
transid;
//alert(currentpage);
$.ajax({
url: currentpage,
}).done(function (data) {
if (data == "ALLOW") {
//check nonstripe fields validity
nameinput = document.getElementById("name");
emailinput = document.getElementById("email");
phoneinput = document.getElementById("phone");
recipientinput = document.getElementById("recipient");
add1input = document.getElementById("addressline1");
add2input = document.getElementById("addressline2");
towninput = document.getElementById("town");
countyinput = document.getElementById("county");
postcodeinput = document.getElementById("postcode");
messageinput = document.getElementById("message");
namevalue = nameinput.value;
var regName = /^[a-zA-Z0-9-\'\~ ]+$/g;
var regTransid = /^[a-zA-Z0-9-\,\.]+$/g;
if (
!regTransid.test(transid) ||
!regName.test(namevalue) ||
!nameinput.checkValidity() ||
!emailinput.checkValidity() ||
!phoneinput.checkValidity()
) {
const displayError =
document.getElementById("card-errors");
if (!regName.test(namevalue)) {
displayError.textContent =
"Name must be as on bank card";
} else if (!regTransid.test(transid)) {
displayError.textContent =
"Invalid purchase data error";
} else {
displayError.textContent =
"Please complete all fields";
}
} else {
emailvalue = emailinput.value;
phonevalue = phoneinput.value;
recipientvalue = recipientinput.value;
add1value = add1input.value;
add2value = add2input.value;
townvalue = towninput.value;
countyvalue = countyinput.value;
postcodevalue = postcodeinput.value;
messagevalue = messageinput.value;
paymentForm.style.display = "none";
spinner.style.display = "block";
stripe
.confirmCardPayment(clientSecret, {
payment_method: {
card: card,
billing_details: {
name: namevalue,
email: emailvalue,
phone: phonevalue,
},
},
shipping: {
name: recipientvalue,
phone: phonevalue,
tracking_number: messagevalue,
address: {
line1: add1value,
line2: add2value,
city: townvalue,
state: countyvalue,
postal_code: postcodevalue,
},
},
})
.then(function (result) {
//alert(payment_method);
if (result.error) {
paymentForm.style.display = "block";
spinner.style.display = "none";
// Show error to your customer (e.g., insufficient funds)
console.log(result.error.message);
const displayError =
document.getElementById(
"card-errors"
);
displayError.textContent =
result.error.message;
} else {
// The payment has been processed!
if (
result.paymentIntent.status ===
"succeeded"
) {
//spinner.style.display = 'none';
currentpage =
location.protocol +
"//" +
location.host +
location.pathname +
"?receiptid=" +
transid;
window.location.replace(
currentpage
);
}
}
});
}
} else {
//alert(data);
alert(
"Sorry - Your Purchase has taken too long, please reload this page to confirm that purchase items are still available"
);
}
});
});
}
////////////////////////////////////////////////////////////////////////
//END SHOP SCRIPTS//////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//////////////////////////////////
//****** RUN CRON TASKS ********//
//////////////////////////////////
if (runCron == true) {
if (window.location.href.indexOf(".html") == -1) {
//alert("scraping");
docorigin = document.location.origin;
$.ajax({
url:
docorigin +
"/scrape.php?key=cJ0sTtoq3XFmPu5yupE5fnfCi3lJlJoiWovUpZN5yGsaS7lyWj",
});
$.ajax({
url: docorigin + "/dev/tasks/UpdateCalendar",
});
}
}
});
// ---------------------------------------------------------
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
jQuery.uaMatch = function (ua) {
ua = ua.toLowerCase();
var match =
/(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
(ua.indexOf("compatible") < 0 &&
/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)) ||
[];
return {
browser: match[1] || "",
version: match[2] || "0",
};
};
matched = jQuery.uaMatch(navigator.userAgent);
browser = {};
if (matched.browser) {
browser[matched.browser] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if (browser.chrome) {
browser.webkit = true;
} else if (browser.webkit) {
browser.safari = true;
}
jQuery.browser = browser;
jQuery.sub = function () {
function jQuerySub(selector, context) {
return new jQuerySub.fn.init(selector, context);
}
jQuery.extend(true, jQuerySub, this);
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init(selector, context) {
if (
context &&
context instanceof jQuery &&
!(context instanceof jQuerySub)
) {
context = jQuerySub(context);
}
return jQuery.fn.init.call(this, selector, context, rootjQuerySub);
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
return jQuerySub;
};
// ---------------------------------------------------------
//js control of slideshow on ticker click
})(jQuery);