function enableButton(){var n=document.getElementById("submit-button");n.disabled=!1}function checkIfAbleToUpload(n){!canUseMultipleFile&&filesAttachedCount>=1&&n.preventDefault()}function tryAddNewFiles(n){var i,t,r;if(!canUseMultipleFile&&filesAttachedCount>1)return!1;for(i=filesAttachedSize,t=0;t<n.length;t++)r=n[t],i+=r.size,fileContainer.push(n[t]);return i>fileLimitSize?($(".max-file-size").show(),ClearFiles(),!1):($(".max-file-size").hide(),addNewFilesToDisplay(n),filesAttachedCount=filesAttachedCount+n.length,filesAttachedSize=i,!canUseMultipleFile&&filesAttachedCount>0&&$(".upload-file-button").attr("disabled",!0),!0)}function ClearFiles(){$("#upload").val(null);filesAttachedCount=0;filesAttachedSize=0;$(".upload-file-button").attr("disabled",!1);fileContainer=[];$("#attachment-list").children(".file-element").each(function(){$(this).remove()});$("#clear-attachments").addClass("hide");$("#attachment-list").removeClass("attachment-list-divider")}function addNewFilesToDisplay(n){for(var i,t=0;t<n.length;t++)i=n[t],$("#attachment-list").append('<div class="file-element"><div>'+i.name+"<\/div><\/div>");$("#attachment-list").addClass("attachment-list-divider");$("#clear-attachments").removeClass("hide")}function loadDropzone(){var n=$("#dropzone");n.on("drag dragstart dragend dragover dragenter dragleave drop",function(n){n.preventDefault();n.stopPropagation()});n.on("dragover dragenter",function(){$(this).addClass("is-dragover")});n.on("dragleave dragend drop",function(){$(this).removeClass("is-dragover")});n.on("drop",function(n){var t=n.originalEvent.dataTransfer.files;tryAddNewFiles(t)})}function detectIncompatibleBrowsers(){var t=window.navigator.userAgent,i=t.indexOf("MSIE "),n;return i>0?!1:(n=!!navigator.userAgent.match(/Trident.*rv\:11\./),n)?!1:!0}var canUseMultipleFile=!0,fileLimitSize=20971520,filesAttachedCount=0,filesAttachedSize=0,fileContainer=[];$(document).ready(function(){canUseMultipleFile=detectIncompatibleBrowsers();$("#enquiryform").submit(function(n){if(n.preventDefault(),$("#enquiryform").valid()){$("#submit-button").attr("disabled",!0);$("#submit-button").html='<i class="fas fa-circle-notch fa-spin"><\/i>  Sending enquiry';$("#upload").val(null);var t=new FormData(this);fileContainer.forEach(function(n){t.append("files",n)});$.ajax({url:"enquire",data:t,processData:!1,contentType:!1,type:"POST",success:function(n){window.location.href="enquirySuccess?"+$.param(n)},error:function(){window.location.href="enquire"}})}});$(document).on("click","#clear-attachments",function(){ClearFiles()});$(document).on("change","#upload",function(){this.files.length&&tryAddNewFiles(this.files)});canUseMultipleFile?loadDropzone():$("#drag-drop-text").hide()}),function(){var n=!1;$.validator.setDefaults({highlight:function(){n||(gtag("event","invoked",{event_category:"error",event_label:"enquiry form"}),n=!0)}})}()