window.jQuery = function() {} function getCookies(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for(var i = 0; i */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Validator=e():t.Validator=e()}(window,function(){return r={},n.m=i=[function(n,t,e){(function(t){function g(){return r.Date.now()}var s=NaN,a="[object Symbol]",o=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,h=parseInt,e="object"==typeof t&&t&&t.Object===Object&&t,i="object"==typeof self&&self&&self.Object===Object&&self,r=e||i||Function("return this")(),d=Object.prototype.toString,b=Math.max,E=Math.min;function S(t){var e=typeof t;return t&&("object"==e||"function"==e)}function k(t){if("number"==typeof t)return t;if("symbol"==typeof(e=t)||(i=e)&&"object"==typeof i&&d.call(e)==a)return s;var e,i,r;if(S(t)&&(t=S(r="function"==typeof t.valueOf?t.valueOf():t)?r+"":r),"string"!=typeof t)return 0===t?t:+t;t=t.replace(o,"");var n=u.test(t);return n||c.test(t)?h(t.slice(2),n?2:8):l.test(t)?s:+t}n.exports=function(r,n,t){var s,a,o,l,u,c,h=0,d=!1,f=!1,e=!0;if("function"!=typeof r)throw new TypeError("Expected a function");function v(t){var e=s,i=a;return s=a=void 0,h=t,l=r.apply(i,e)}function p(t){var e=t-c;return void 0===c||n<=e||e<0||f&&o<=t-h}function y(){var t,e,i=g();if(p(i))return m(i);u=setTimeout(y,(e=n-((t=i)-c),f?E(e,o-(t-h)):e))}function m(t){return u=void 0,e&&s?v(t):(s=a=void 0,l)}function i(){var t,e=g(),i=p(e);if(s=arguments,a=this,c=e,i){if(void 0===u)return h=t=c,u=setTimeout(y,n),d?v(t):l;if(f)return u=setTimeout(y,n),v(c)}return void 0===u&&(u=setTimeout(y,n)),l}return n=k(n)||0,S(t)&&(d=!!t.leading,f="maxWait"in t,o=f?b(k(t.maxWait)||0,n):o,e="trailing"in t?!!t.trailing:e),i.cancel=function(){void 0!==u&&clearTimeout(u),s=c=a=u=void(h=0)},i.flush=function(){return void 0===u?l:m(g())},i}}).call(this,e(2))},function(t,e,i){var r=i(5).default;r.plugin=r.prototype.plugin,r.plugin("match",i(3).default),r.plugin("email",i(4).default),t.exports=r},function(t,e){var i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";i.r(e),e.default={install:function(){},validate:function(t,e){return t.value===document.querySelector(e).value}}},function(t,e,i){"use strict";i.r(e),e.default={install:function(){},validate:function(t){return/^[_A-z0-9._%+-]+@[_A-z0-9.-]+\.[_A-z]{2,}$/.test(t.value)}}},function(t,e,i){"use strict";i.r(e),i.d(e,"default",function(){return l});var r=i(0),n=i.n(r);function s(t,e){for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),i=e.length;0<=--i&&e.item(i)!==this;);return-1I agree '; } catch (e) {} defer(function() { pjslider_init(); }) var pjslides; function pjslider_init() { pjslides = document.querySelectorAll('.project-slider'); if(pjslides.length > 0) { pjslides.forEach((slide, index) => { if(slide.getAttribute('data-slide') !== null) { return; } let autoplay = (slide.getAttribute('data-slide-autoplay') == 'Y') ? true : false; let arrows = (slide.getAttribute('data-slide-arrows') == 'Y') ? true : false; let trackscroll = (slide.getAttribute('data-slide-track-scroll') == 'Y') ? true : false; slide.setAttribute('data-slide', 0); let slides = slide.querySelectorAll('.slides > div'); slides.forEach((div, sindex) => { div.setAttribute('slidetabindex', sindex); }) if(arrows) { slide.insertAdjacentHTML('beforeend', ''); slide.insertAdjacentHTML('beforeend', ''); slide.querySelector('.slick-next').addEventListener('click', (e) => { let pj = e.target.parentNode.parentNode.parentNode; pj.setAttribute('data-slide', Number(pj.getAttribute('data-slide')) + 1); pjslider_redraw(pj); pjslider_matrix_async(pj); }) slide.querySelector('.slick-prev').addEventListener('click', (e) => { let pj = e.target.parentNode.parentNode.parentNode; pj.setAttribute('data-slide', Number(pj.getAttribute('data-slide')) - 1); pjslider_redraw(pj); pjslider_matrix_async(pj); }) } if(trackscroll) { pjslider_matrix_async(slide); slides.forEach((div) => { div.addEventListener('click', (e) => { let pj = e.target.parentNode.parentNode.parentNode; pj.setAttribute('data-slide', e.target.getAttribute('slidetabindex')); pjslider_redrawAll(); pjslider_matrix_async(pj); }) }) } }) } } function pjslider_redrawAll() { pjslides.forEach((slide) => { pjslider_redraw(slide); }) } function pjslider_redraw(pj) { console.log(pj); let tf = pj.querySelector('[slidetabindex="' + pj.getAttribute('data-slide') + '"]'); let newScrollLeft = Math.abs(pj.querySelector('.slides > div').clientWidth) * pj.getAttribute('data-slide'); //console.log(pj); //console.log(pj.querySelector(".slides")); animate({ duration: 500, timing: makeEaseOut(linear), draw(progress) { pj.querySelector(".slides").scrollLeft = progress * newScrollLeft; } }); //pj.querySelector(".slides").scrollLeft = Math.abs(150) * pj.getAttribute('data-slide'); } function pjslider_matrix_async(pj) { setTimeout(function() { pjslider_matrix(pj); }, 500); } function pjslider_matrix(pj) { let htmlslidepos = 0; let htmlslideleft = pj.querySelector(".slides").scrollLeft; var tmp = 9999; let slides = pj.querySelectorAll(".slides > div"); slides.forEach((slide, sindex) => { var pos = Math.abs(htmlslideleft - slide.offsetLeft); console.log(sindex, pos); if(pos < tmp) { tmp = pos; htmlslidepos = parseInt(slide.getAttribute("slidetabindex")); } }) console.log(htmlslidepos); let trackscroll = (pj.getAttribute("data-slide-track-scroll") == "Y") ? true : false; if(trackscroll) { slides.forEach((slide) => { slide.classList.remove("slideactive"); }); slides[htmlslidepos].classList.add("slideactive"); //updateParams(); } pj.setAttribute("data-slide", htmlslidepos); } function animate({duration = 500, draw, timing}) { let start = performance.now(); requestAnimationFrame(function animate(time) { let timeFraction = (time - start) / duration; if (timeFraction > 1) timeFraction = 1; let progress = timing(timeFraction) draw(progress); if (timeFraction < 1) { requestAnimationFrame(animate); } }); } function linear(timeFraction) { return timeFraction; } function makeEaseOut(timing) { return function(timeFraction) { return 1 - timing(1 - timeFraction); } } Validator.plugin("phone", { install() {}, validate(el, attribute) { console.log(el.value); return /^(\+44|01|02|03|04|05|06|07|08|09)[0-9 ()-]+$/.test(el.value); } }); Validator.plugin("spam", { install() {}, validate(el, attribute) { var a = el.getAttribute("data-validation-captcha").trim(); var b = el.value.trim(); return a == b; } }); var validator = new Validator(document.querySelector("form"), { // options here }); /* * Ajax driven forms with ajax errors and callbacks * */ function AUTOFORM_NODE(form) { var formData = new FormData(form); var fn_success = form.getAttribute("data-af-success"); var fn_fail = form.getAttribute("data-af-fail"); var loadingClass = form.getAttribute("data-af-loading"); var isFileUploader = form.classList.contains("af-mult"); var formvalid = false; /* Check if it has JQUERY validation */ if(typeof form.hasValidator !== "undefined") { form.hasValidator.runAllValidation(); if(document.querySelectorAll("form input.is-invalid").length == 0) { formvalid = true; } } else { formvalid = true; } if(formvalid) { if(loadingClass !== "") document.body.classList.add(loadingClass); form.querySelector("button.af-submit").classList.add("af-processing"); var ajaxConfig = { method: "POST", body: formData }; if(!isFileUploader) { ajaxConfig.headers = { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' } ajaxConfig.body = new URLSearchParams(formData); } fetch(form.getAttribute("action"), ajaxConfig) .then(response => { if(response.ok) { return response.json(); } else { throw response; } }) .then(data => { document.querySelectorAll(".error-message").forEach(el => el.remove()); form.querySelector("button.af-submit").classList.remove("af-processing"); var fn = window[fn_success]; if(typeof fn === 'function') { fn(form, data); } else { af_success(form, data); } setTimeout(function() { if(loadingClass !== "") document.body.classList.remove(loadingClass); }, 1500); }) .catch(error => { error.text().then(text => { var errJSON = JSON.parse(text); document.querySelectorAll(".invalid-feedback").forEach(el => el.innerHTML = ""); form.querySelector("button.af-submit").classList.remove("af-processing"); /* If error set error message text */ for (var errobj in errJSON.errors) { var field = form.querySelector('[name="' + errobj + '"]'); if(field) { field.classList.remove("is-valid"); field.classList.add("is-invalid"); //field.parentElement.classList.remove("has-success"); //field.parentElement.classList.add("has-error"); var invalidFeedbacks = []; var nextSibling = field.nextElementSibling; while (nextSibling) { if (nextSibling.classList.contains("invalid-feedback")) { invalidFeedbacks.push(nextSibling); break; } nextSibling = nextSibling.nextElementSibling; } var errorMessage = nextSibling; if(errorMessage) { errorMessage.innerHTML = errJSON.errors[errobj].msg; } } } /* Fail Callback */ var fn = window[fn_fail]; if(typeof fn === 'function') { fn(form, text); } else { console.log(errJSON); } }); }); } } document.addEventListener("DOMContentLoaded", function() { var forms = document.querySelectorAll('form[data-af-success] button.af-submit'); forms.forEach(function(btn) { btn.addEventListener("click", function(e) { if(e.target.classList.contains("af-processing")) return; var form = e.target.closest("form") || null; if(form) AUTOFORM_NODE(form); }); }); }); function af_success() { parent.showAlert("fa-check", "Success", "Thank you for your interest", "#FFFFFF", false); } function af_fail() { parent.showAlert("fa-times", "Fail", "There was an error with the form, please make sure all required information is entered and try again.", "#FFFFFF", false); } var overlay_EventAttached = false; var overlay_RefreshParent = false; var overlay_Loaded = false; /* Contained Files */ var overlay_CSS = '.modalo { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1050; display: none; overflow: hidden; -webkit-overflow-scrolling: touch; outline: 0; } body.overlay {overflow:hidden} body.overlay:after { content: ""; display: block; position: fixed; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; background-color: rgba(0,0,0,0.7); } body.overlay .modalo:not(.loaded) { background-image: url("data:image/gif;base64,R0lGODlhEAAQAPQAAAAAAP///wYGBsbGxnp6evj4+NjY2CgoKFZWVujo6IiIiJiYmBoaGmZmZjg4OLa2tqioqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+GkNyZWF0ZWQgd2l0aCBhamF4bG9hZC5pbmZvACH5BAAKAAAAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAAQAAAFUCAgjmRpnqUwFGwhKoRgqq2YFMaRGjWA8AbZiIBbjQQ8AmmFUJEQhQGJhaKOrCksgEla+KIkYvC6SJKQOISoNSYdeIk1ayA8ExTyeR3F749CACH5BAAKAAEALAAAAAAQABAAAAVoICCKR9KMaCoaxeCoqEAkRX3AwMHWxQIIjJSAZWgUEgzBwCBAEQpMwIDwY1FHgwJCtOW2UDWYIDyqNVVkUbYr6CK+o2eUMKgWrqKhj0FrEM8jQQALPFA3MAc8CQSAMA5ZBjgqDQmHIyEAIfkEAAoAAgAsAAAAABAAEAAABWAgII4j85Ao2hRIKgrEUBQJLaSHMe8zgQo6Q8sxS7RIhILhBkgumCTZsXkACBC+0cwF2GoLLoFXREDcDlkAojBICRaFLDCOQtQKjmsQSubtDFU/NXcDBHwkaw1cKQ8MiyEAIfkEAAoAAwAsAAAAABAAEAAABVIgII5kaZ6AIJQCMRTFQKiDQx4GrBfGa4uCnAEhQuRgPwCBtwK+kCNFgjh6QlFYgGO7baJ2CxIioSDpwqNggWCGDVVGphly3BkOpXDrKfNm/4AhACH5BAAKAAQALAAAAAAQABAAAAVgICCOZGmeqEAMRTEQwskYbV0Yx7kYSIzQhtgoBxCKBDQCIOcoLBimRiFhSABYU5gIgW01pLUBYkRItAYAqrlhYiwKjiWAcDMWY8QjsCf4DewiBzQ2N1AmKlgvgCiMjSQhACH5BAAKAAUALAAAAAAQABAAAAVfICCOZGmeqEgUxUAIpkA0AMKyxkEiSZEIsJqhYAg+boUFSTAkiBiNHks3sg1ILAfBiS10gyqCg0UaFBCkwy3RYKiIYMAC+RAxiQgYsJdAjw5DN2gILzEEZgVcKYuMJiEAOwAAAAAAAAAAAA=="); background-repeat: no-repeat; background-position: center; } body.overlay .modalo { color:#FFFFFF;position: fixed; border-radius: 5px; text-align: center; z-index: 9999; display:block; margin: auto; overflow: visible; width: 100%; } body.overlay .modalo #iframeOverlay { border: solid 0px; margin: auto; width: 100%; height: 100%; border-radius: 5px; } body.overlay .modalo.loaded #iframeOverlay { } /* Transition */ body.overlay .modalo { -webkit-transform: scale(0.7); -moz-transform: scale(0.7); -ms-transform: scale(0.7); transform: scale(0.7); -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; } body.overlay .modalo.loaded { -webkit-transform: scale(1); -moz-transform: scale(1); -ms-transform: scale(1); transform: scale(1);} body.overlay .modalo #iframeOverlay, body.overlay .modalo #close { opacity: 0; } body.overlay .modalo.loaded #iframeOverlay, body.overlay .modalo.loaded #close { opacity: 1; } /* Close button */ #close { color: #FFF; position: relative; position: absolute; right: 20px; top: 3px; cursor: pointer; } #close i { color: #E30000;font-size:42px; } #close:hover { color: #E30000; } #close:hover i { color: #CCC; } @media only screen and (max-width:750px){ #close { right: 20px; top: 3px; } body.overlay .modalo.loaded {overflow-y:auto;} }'; /* Events */ document.querySelectorAll(".a-overlay").forEach(function(element) { element.addEventListener("click", function(e) { showOverlay({}, e.currentTarget); }); }); /* */ function isIframe () { try { return window.self !== window.top; } catch (e) { return true; } } function showOverlay(Prop) { showOverlay(Prop, null); } function showOverlay(Prop, Elem) { if(typeof Prop === "undefined" || Prop == null) return; if(typeof Elem === "undefined" || Elem == null) { Elem = {}; } else { Elem = { URL: Elem.getAttribute("data-link") }; } if(!overlay_Loaded) { var style = document.createElement("style"); style.textContent = overlay_CSS; document.head.appendChild(style); overlay_Loaded = true; } /* Get configuration */ var URL = Prop.URL || Elem.URL || ""; var Contents = Prop.Contents || ""; var Width = Prop.W || 1024; var Height = Prop.H || 600 var Top = Prop.T || 10; var Right = Prop.R || 10; var Printing = Prop.hasPrint || false; var RedirectIfMobile = Prop.RIM || false; var NoExit = Prop.NoExit || false; /* Get screen dimensions */ var deviceDim = new Object(); deviceDim.W = screen.width; deviceDim.H = screen.height; if(typeof window.matchMedia !== "undefined") { if (window.matchMedia("(orientation: portrait)").matches) { deviceDim.W = screen.width; } else if (window.matchMedia("(orientation: landscape)").matches) { if(screen.height > deviceDim.W) { deviceDim.W = screen.height; deviceDim.H = screen.width; } } } var portWidth = Width; var portHeight = Height; if(portWidth > deviceDim.W) portWidth = deviceDim.W; if(portHeight > deviceDim.H) portHeight = deviceDim.H; /* Set dimensions and position */ if (NoExit) document.body.classList.add("noexit"); var modaloElement = document.querySelector(".modalo"); modaloElement.style.maxWidth = Width + "px"; modaloElement.style.maxHeight = Height + "px"; var CenterY = ((deviceDim.H / 2) - (Height / 2)) - (deviceDim.H / 2); if (CenterY < 0) CenterY = 0; modaloElement.style.top = CenterY + "px"; /* */ if(isIframe()) { window.location = URL; return; } if(RedirectIfMobile && portWidth < 360) { window.location = URL.replace("&App=true", ""); return; } /* */ var modaloElement = document.querySelector(".modalo"); modaloElement.classList.remove("loaded"); // Append HTML modaloElement.innerHTML = Contents; if (URL !== "") { var closeDiv = document.createElement("div"); closeDiv.id = "close"; closeDiv.style.top = Top + "px"; closeDiv.style.right = Right + "px"; closeDiv.innerHTML = ""; modaloElement.appendChild(closeDiv); var iframeElement = document.createElement("iframe"); iframeElement.width = portWidth; iframeElement.id = "iframeOverlay"; iframeElement.src = URL; modaloElement.appendChild(iframeElement); } /* Add Event Listeners */ if(URL !== "") { document.getElementById("iframeOverlay").addEventListener("load", function() { /* Inject CSS file */ var ifo = null; try { ifo = GetDoc(document.getElementById("iframeOverlay")); } catch (e) {} if (ifo === null && isIframe()) { ifo = document; } if (ifo !== null) { ifo.body.classList.add("isIframe"); modaloElement.classList.add("loaded"); } else { modaloElement.classList.add("loaded"); } }); } else { var modaloElements = document.getElementsByClassName("modalo"); for (var i = 0; i < modaloElements.length; i++) { modaloElements[i].classList.add("loaded"); } } if(!overlay_EventAttached) { document.body.addEventListener("click", clicked); overlay_EventAttached = true; } /* Show overlay */ setTimeout(function() { document.body.classList.add("overlay"); }, 0); } function clicked(e) { if (document.body.classList.contains("noexit")) return; var targ; if (!e) e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if (typeof targ !== "undefined" && targ.nodeType == 3) // defeat Safari bug targ = targ.parentNode; if (typeof targ === "undefined" || !targ.classList.contains("modal")) { if (overlay_RefreshParent) { parent.document.location.reload(true); return; } document.body.classList.remove("overlay"); if (parent.document.body) parent.document.body.classList.remove("overlay"); /* Unload Modal */ setTimeout(function() { if (!document.body.classList.contains("overlay")) { document.querySelector(".modalo").innerHTML = ""; } }, 5000); } } function GetDoc(x) { return x.contentDocument || x.contentWindow.document; } function showAlert(icon, title, desc, colour, closable) { if(closable) document.body.classList.add("noexit"); showOverlay({Contents: '

' + title + '

' + desc + '

'}); }