/* 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(); }); } $(".hamburgerButton").on("click",function(){ if($("nav ul").css('display') == 'none' ) { $("nav ul").fadeIn(); $(".hamburger").css("background","rgba(67,65,62,0.7)"); } else { $("nav ul").fadeOut(); setTimeout(function(){$('nav ul').css('display', '');},500); $(".hamburger").css("background","none"); } }); }); function fEventsSubscribe() { $("#facingMailInput").val($("#eventsAddress").val()); fOpenSubscribeModal(); } function fOpenSubscribeModal() { if(document.getElementById('facingMailInput').value=="") alert("Please enter an email address first."); else { $("#subscribeModal").modal("show"); $("#newMailInput").val($("#facingMailInput").val()); } } function fSubscribe() { // form fields var sYourEmail = document.getElementById('facingMailInput').value; var sGResponse = document.getElementById('g-recaptcha-response').value; if(sGResponse=="") alert("Please tick the box to prove you're not a robot."); else if(!$("#bMailingListPrivacyPolicy").is(":checked")) alert("Please tick the box to show you agree to the privacy policy."); else { // define AJAX url var sAjaxURL = "ajax/newsletter_exec.php?sYourEmail=" + sYourEmail + "&sResponse=" + sGResponse; // call ajax URL $.get(sAjaxURL, function(data) { // get the result $('.result').html(data); // alert the results $(data).insertAfter("#subscribeModal"); $("#subscribeModal").modal("toggle"); }); } } 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; } /* COOKIE CUTTER - The "I accept cookies" legal disclaimer */ $(function(){ $.cookieCuttr(); }); function fCloseModal(){ $('.mailing-list-popup-inner').hide(); $('.mailing-list-blackout').hide(); document.cookie = "bMailingListSubscribed=true"; }