/* THIS IS GLOBALLY INCLUDED ON EVERY PAGE. SO PUT STUFF HERE YOU NEED TO BE ON *EVERY* PAGE OF THE WEBSITE Previously called inc-htmlheader.js */ $(document).ready(function(){ if($('.datePicker').length) { $('.datePicker').datepicker({ minDate: 0, dateFormat: 'dd/mm/yy' }); } if($('.LangClose').length) { $('.LangClose').click(function(){ document.cookie="LanguageWidgetClose=1;path=/"; $("#LangSelect").remove(); }); } if($("#CurrencySelector").length) { $("#CurrencySelector").on("change",function(){ var oDate = new Date(); oDate.setTime(oDate.getTime() + (30*24*60*60*1000)); var sExpires = "expires="+oDate.toUTCString(); document.cookie="nCurrency_ID="+$(this).val()+"; path=/"; location.reload(); }); } }); // Google Recaptcha Code (Supports up to 3 recaptchas) var verifyCallback = function(response) { alert(response); }; var widgetId1; var widgetId2; var widgetId3; var onloadCallback = function() { // Renders the HTML element with id 'example1' as a reCAPTCHA widget. // The id of the reCAPTCHA widget is assigned to 'widgetId1'. if($("#recaptcha1").length > 0) { widgetId1 = grecaptcha.render('recaptcha1', { 'sitekey' : '6LeGbBcTAAAAALH1g5ih1bRAgZ4o79YPT7IqAbLl', 'theme' : 'light' }); } if($("#recaptcha2").length > 0) { widgetId2 = grecaptcha.render('recaptcha2', { 'sitekey' : '6LeGbBcTAAAAALH1g5ih1bRAgZ4o79YPT7IqAbLl' }); } if($("#recaptcha3").length > 0) { widgetId3 = grecaptcha.render('recaptcha3', { 'sitekey' : '6LeGbBcTAAAAALH1g5ih1bRAgZ4o79YPT7IqAbLl' }); } }; function fLangChange($sLangAbbr, $sSURL) { $bChange = 0; $sNewURL = window.location.href; aLanguages.forEach(function($sTempLangAbbr){ console.log($sTempLangAbbr); if(window.location.href.indexOf("/"+$sTempLangAbbr+"/")>=0) { $sNewURL = $sNewURL.replace("/"+$sTempLangAbbr+"/","/"+$sLangAbbr+"/"); $bChange = 1; } }); if(!$bChange) { $sNewURL=$sSURL+$sLangAbbr+"/"; } window.location = $sNewURL; } // EMAIL CHECK // ============== function fCheckEmail(email) { var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if(!re.test(email)) return "invalid"; else return true; } function validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } // NEWSLETTER SUBSCRIPTION // ==================== $("#newsletterButton").click(function() { $("#newsletterModal").modal("show"); }); $('#newsletterSubmit').click(function(e) { // stop form submitting (page load) e.preventDefault(); // Check if recaptcha has been ticked if(grecaptcha.getResponse(widgetId1) != "") { // get email addresss var emailAddress = $('input[name="sNewsEmailAddress"]').val(); if(validateEmail(emailAddress)) { if (document.getElementById('bMailingList_Privacy').checked==true) { $.ajax({ data: 'sEmailAddress=' + escape(emailAddress), type: 'post', url: 'ajax/newsletter_exec.php', success: function( r ) { if(r.length<10) { alert("Please provide an email address."); grecaptcha.reset(widgetId1); } else { $("head").append(r); alert("Thank you.\r\n\r\nYou have successfully subscribed to our mailing list."); $('input[name="sNewsEmailAddress"]').val(''); grecaptcha.reset(widgetId1); } } }); $('#newsletterModal').modal('hide'); } else { alert("Please check the box to agree to our privacy policy"); } } else { alert("That is not a valid email address, please review and try again."); // Reset recaptcha grecaptcha.reset(widgetId1); $('input[name="sNewsEmailAddress"]').focus(); $('#newsletterModal').modal('hide'); } } }); var fixedTopHeader = null; var bHeaderShowing = 0; var nBottomHeaderWrapperBottom = 0; var bottomHeaderWrapper = $(".bottom-header-wrapper"); $(document).ready(function(){ fixedTopHeader = $(".top-header-wrapper").clone().addClass("top-header-fixed").insertAfter(".top-header-wrapper"); }); $(window).scroll(function(){ if(fixedTopHeader) { var nScrollAmount = window.scrollY || window.pageYOffset; if(nScrollAmount > nBottomHeaderWrapperBottom && !bHeaderShowing) { fixedTopHeader.addClass("top-header-show"); bHeaderShowing = 1; } else if(nScrollAmount <= nBottomHeaderWrapperBottom && bHeaderShowing) { fixedTopHeader.removeClass("top-header-show"); $(".dropdown-menu").hide(); bHeaderShowing = 0; } } }); //caching resize selectors to improve performance /* var eventbanner = $('.event-banner'); var headerMenuCol = $('#header-menu-col'); var topHeaderSecureSpan = $('#top-header-secure-span'); var topHeaderSlogan = $("#header-slogan"); var headerMenuCol = $('#header-menu-col'); var navbarCollapse = $('#bs-example-navbar-collapse-1'); var logoCol = $('#logo-col'); var socialCol = $('#social-col'); var navbarCol = $('#navbar-col'); var hamburgerMenuID = $('#hamburger-menu-id'); var hamburgerSpanContainer = $('#hamburger-span-container'); var bottomHeaderWrapper = $(".bottom-header-wrapper"); var hmbgl1 = $('#hmbg-line-3'); var hmbgl2 = $('#hmbg-line-2'); var hmbgl3 = $('#hmbg-line-1'); var nBottomHeaderWrapperBottom = 0; var bHeaderShowing = 0; //when the dom loads $(document).ready(function(){ fSocialHeightAdjust(); fNavbarReposition(); fHamburgerHeightAdjust(); // Fixed header fixedTopHeader = $(".top-header-wrapper").clone().addClass("top-header-fixed").insertAfter(".top-header-wrapper"); fRecalculateBottomHeaderWrapperBottom(); }); //on window resize $(window).resize(function(){ fRecalculateBottomHeaderWrapperBottom(); fSocialHeightAdjust(); fNavbarReposition(); fHamburgerHeightAdjust(); }); $(window).load(function(){ fStopPop(); }); $(window).scroll(function(){ if(fixedTopHeader) { var nScrollAmount = window.scrollY || window.pageYOffset; if(nScrollAmount > nBottomHeaderWrapperBottom && !bHeaderShowing) { fixedTopHeader.addClass("top-header-show"); bHeaderShowing = 1; } else if(nScrollAmount <= nBottomHeaderWrapperBottom && bHeaderShowing) { fixedTopHeader.removeClass("top-header-show"); $(".dropdown-menu").hide(); bHeaderShowing = 0; } } }); function fRecalculateBottomHeaderWrapperBottom() { nBottomHeaderWrapperBottom = bottomHeaderWrapper.offset().top+bottomHeaderWrapper.outerHeight(); } function fHeaderProductsPosition(){ $('#header-slogan').css('left', ($('#header-logo').width()+35) + 'px'); } function fSocialHeightAdjust(){ $('#social-col').height($('#navbar-col').height()); } function fHamburgerHeightAdjust(){ $('#hamburger-col').height($('#logo-col').height()); } function fNavbarReposition(){ // using $('window').width sucks because it doesnt take into account the // scrollbar. instead i trigger the js class changes based on css attributes // that happen at specific media queries. This ensures your css and js breakpoints // are the same //this is the 1200px breakpoint if(eventbanner.css("display")=='none') { headerMenuCol.removeClass('col-xs-9').addClass('col-xs-12'); //this is the 992px breakpoint if($(".middle-header-wrapper").outerWidth(true)<=992) { //all of these work by swapping out the bootstrap class headerMenuCol.removeClass('col-xs-9').addClass('col-xs-12'); navbarCollapse.appendTo('#navbar-col'); logoCol.removeClass('col-xs-8').addClass('col-xs-4'); socialCol.removeClass('col-xs-9').addClass('col-xs-3'); navbarCol.removeClass('col-xs-3').addClass('col-xs-9'); //this is the 768 breakpoint if(headerMenuCol.css("display")=='none') { navbarCollapse.appendTo('#secret-navbar-container'); socialCol.removeClass('col-xs-3').addClass('col-xs-9'); navbarCol.removeClass('col-xs-9').addClass('col-xs-3'); logoCol.removeClass('col-xs-4').addClass('col-xs-8'); } } } else { navbarCollapse.appendTo('#navbar-col'); headerMenuCol.removeClass('col-xs-12').addClass('col-xs-9'); logoCol.removeClass('col-xs-8').addClass('col-xs-4'); socialCol.removeClass('col-xs-9').addClass('col-xs-3'); navbarCol.removeClass('col-xs-3').addClass('col-xs-9'); } } function fStopPop(){ $('#hamburger-col').css('opacity', '1'); } // a simple function to toggle the dropdowns //controller for the hamburger animation hamburgerMenuID.click(function(){ document.getElementById('hamburger-menu-id').style.pointerEvents = 'none'; hamburgerSpanContainer.toggleClass("span-container-rotate"); hmbgl1.toggleClass("hmbg-span-3-trans"); hmbgl2.toggleClass("hmbg-span-2-trans"); hmbgl3.toggleClass("hmbg-span-1-trans"); setTimeout(function(){ document.getElementById('hamburger-menu-id').style.pointerEvents = 'auto'; }, 300); }); */ function fDropdownToggleHandler(oElement){ //buttons only have effect after the collapse point of the icons if($(window).width() < 671) { var $oDropdown = $(oElement).find(".dropdown-menu"); if($oDropdown.is(":visible")) { $(".dropdown-menu").hide(); } else { $(".dropdown-menu").hide(); $oDropdown.show(); } } else if($(window).width() < 768) { var $oDropdown = $(oElement).find(".dropdown-menu-tablet"); if($oDropdown.is(":visible")) { $(".dropdown-menu").hide(); } else { $(".dropdown-menu").hide(); $oDropdown.show(); } } } /* cookie-consent.js ================= A modern alternative and more page friendly version of jquery.cookiecuttr.js taken from cookie-consent.js and minified. put in this file to reduce call stack */ // Set the display type sCookieDisplayType = "fixed"; // Set the display position (only supports top or bottom) sCookieDisplayPosition = "top"; // Store the page that goes to our privacy policy sLinkToPrivacyPolicy = "privacy/page_901"; (function ($) { // If we have consented to cookie usage already, don't display the cookie stuff and just exit if( $.cookie('cc_cookie_accept') == "cc_cookie_accept" || $.cookie('cc_cookie_accept') == "cc_cookie_reject" ) { // Exit the function return; } // If the cookie display position isn't a supported type if( sCookieDisplayPosition != "top" && sCookieDisplayPosition != "bottom" ) { // Default to bottom sCookieDisplayPosition = "bottom"; } // Store the style tag, as loading an entire css file for this would be pointles sStyle = "margin : 0px; width : 100%; position : " + sCookieDisplayType + "; " + sCookieDisplayPosition + " : -600px; left : 0px;"; sStyle += "z-index : 999999999; color : #000000; background-color : #f0f0f0; border-top : solid 1px #c2c2c2"; // Button styling sButtonClasses = "visible-xs-block visible-sm-inline-block visible-md-inline-block visible-lg-inline-block d-block d-sm-inline xs-mb-1"; // Create the cookie clicker wrapper var oCookieWrapper = $(""); // Store the cookie consent content wrapper var oCookieContent = $("
"); // Cookie clicker wrapper text var oCookieText = $("We use cookies on this website for ads personalisation, personalised content and to analyse traffic. To use the website as intended, please...
"); // Cookie clicker wrapper text var oCookieAcceptButton = $("Accept"); var oCookieRejectButton = $("Reject"); // Append the data oCookieWrapper.append(oCookieContent); oCookieContent.append(oCookieText); oCookieContent.append(oCookieAcceptButton); oCookieContent.append(oCookieRejectButton); oCookieWrapper = $("body").append(oCookieWrapper); // Store what we want to animate var oToAnimate = {} // Set the animation speed var nAnimationSpeed = 0; // If we are working with a fixed display type if( sCookieDisplayType == "fixed" ) { // Set the animation speed nAnimationSpeed = 2000; } // Animate the cookie display position oToAnimate[ sCookieDisplayPosition ] = "0px"; // Animate the consent box $("#cookie-consent").animate( oToAnimate, nAnimationSpeed ); })(jQuery); /* OnCookieConsent =============== What happens when the 'accept' button is pressed. Logic is done here. */ function OnCookieConsent(e) { // Prevent e.preventDefault(); // Store what we want to animate var oToAnimate = {} // If we are working with a fixed display type if( sCookieDisplayType == "fixed" ) { // Animate the cookie display position oToAnimate[ sCookieDisplayPosition ] = "-600px"; // Animate the consent box $("#cookie-consent").animate( oToAnimate, 1000, function() { // Remove it as it's no longer needed $("#cookie-consent").remove(); }); } // If we are not in fixed type, don't bother animating just remove else { // Remove it as it's no longer needed $("#cookie-consent").remove(); } // Set the cookies accept (This is called this as the old cookie consenter we used had this cookie name so we don't break anything) $.cookie("cc_cookie_accept", "cc_cookie_accept", { expires: 365, path: '/' }); // Update the gtag to access mode gtag("consent", 'update', { 'ad_storage' : 'granted', 'analytics_storage' : 'granted', 'personalization_storage' : 'granted', 'functionality_storage' : 'granted', 'security_storage' : 'granted', 'ad_user_data' : 'granted', 'ad_personalization' : 'granted', }); } /* OnCookieReject =============== What happens when the 'rejext' button is pressed. Logic is done here. */ function OnCookieReject(e) { // Prevent e.preventDefault(); // Store what we want to animate var oToAnimate = {} // If we are working with a fixed display type if( sCookieDisplayType == "fixed" ) { // Animate the cookie display position oToAnimate[ sCookieDisplayPosition ] = "-600px"; // Animate the consent box $("#cookie-consent").animate( oToAnimate, 1000, function() { // Remove it as it's no longer needed $("#cookie-consent").remove(); }); } // If we are not in fixed type, don't bother animating just remove else { // Remove it as it's no longer needed $("#cookie-consent").remove(); } // Set the cookies accept (This is called this as the old cookie consenter we used had this cookie name so we don't break anything) $.cookie("cc_cookie_accept", "cc_cookie_reject", { expires: 14, path: '/' }); // Update the gtag to not access anything gtag("consent", 'update', { 'ad_storage' : 'denied', 'analytics_storage' : 'denied', 'personalization_storage' : 'denied', 'functionality_storage' : 'denied', 'security_storage' : 'denied', 'ad_user_data' : 'denied', 'ad_personalization' : 'denied', }); } // IE PLACEHOLDER FIX // ================== // $('input, textarea').placeholder();