function checkWidth(){var n=$(window).width();mobile_viewport=n<768?!0:!1}function hide(n){document.getElementById(n).style.display="none"}function hideByClass(n){for(var i=document.getElementsByClassName(n),t=0;t<i.length;t++)i[t].style.display="none"}function showByClass(n){for(var i=document.getElementsByClassName(n),t=0;t<i.length;t++)i[t].style.display=""}function toggleByIdWithAnimation(n,t){$("#"+n).toggle(t)}function hideByIdWithAnimation(n,t){$("#"+n).hide(t)}function clearText(n){(n.value==="Search Term"||n.value==="Enter Email Here:"||n.value==="Search..."||n.value==="Start typing a postcode, street or address"||n.value==="Search our entire product range")&&(n.value="")}function checkSearchTerm(n){var t,i;return n!=="Search Term"&&n!=="Search..."&&n!==""?(dataLayer.push({event:"Search",Searchterm:n}),!0):(t=document.getElementById("ctl00$searchfield"),t===undefined&&(t=document.getElementById("ctl00$MainContent$landingSearchfield")),i=document.activeElement===t,i?(alert("Please enter a search term."),!1):!1)}function printPage(){dataLayer.push({event:"Print this page",url:document.URL});window.print()}function changeSort(){var t=document.getElementsByClassName("ais-SortBy-select"),n=Array.from(t)[0],i=n.options[n.selectedIndex].text;dataLayer.push({event:"Change Sort Order",sortOrder:i})}function changeTextSize(){offset=parseFloat(document.getElementById("tsmenu").value);offset>0&&dataLayer.push({event:"Adjust text size",offset:offset});nuvalue=current+offset;eval("document.getElementById('main').style.fontSize = '"+nuvalue+"em'");Set_Cookie("textsize",document.getElementById("tsmenu").value,365,"/","","")}function ChangePage(n){document.aspnetForm.ctl00$MainContent$PageNumber.value=n;__doPostBack("ctl00$MainContent$PageClick","")}function addToCartQtyPriceID(n,t,i){if(console.log(n,t,i),qtypriceqty=parseFloat(document.getElementById("ctl00_MainContent_hdnQtyPriceQty"+t).value),qty=document.getElementById("ctl00_MainContent_txtQty"+t).value,qty!=""&!isNaN(qty))if(parseInt(qty)<parseInt(document.aspnetForm.ctl00_MainContent_hidMin.value)||parseInt(qty)>parseInt(document.aspnetForm.ctl00_MainContent_hidMax.value))document.getElementById("ctl00_MainContent_txtQty"+t).value=document.aspnetForm.ctl00_MainContent_hidMin.value,alert("There are restrictions of the maximum and minimum number of this item you may order. Please try again."),document.getElementById("ctl00_MainContent_txtQty"+t).focus();else try{qty=qty*parseInt(i);var u={stockID:n},r=0;$.ajax({type:"POST",async:!1,cache:!1,url:"/productquery.asmx/getproductdetails",data:JSON.stringify(u),datatype:"json",contentType:"application/json; charset=utf-8",success:function(t){var i=JSON.parse(t.d);dataLayer=[];dataLayer.push({event:"addToCart",ecommerce:{currencyCode:"GBP",add:{products:[{name:i.ProductTitle,id:i.ProductCode,price:i.SellingPrice,brand:i.ManufacturerName,category:i.Category,variant:i.Variant,quantity:qty}]}},eventCallback:function(){if(r==0){document.location="/addtocartbylinkv3.aspx?stockid="+n+"&qty="+parseInt(qty)+"&returnto="+escape(location.href);r++;return}}})&&(document.location="/addtocartbylinkv3.aspx?stockid="+n+"&qty="+parseInt(qty)+"&returnto="+escape(location.href))},error:function(){document.location="/addtocartbylinkv3.aspx?stockid="+n+"&qty="+parseInt(qty)+"&returnto="+escape(location.href)}})}catch(f){document.location="/addtocartbylinkv3.aspx?stockid="+n+"&qty="+parseInt(qty)+"&returnto="+escape(location.href)}else alert("Please enter a numeric quantity to add to your cart"),document.getElementById("ctl00_MainContent_txtQty"+t).focus()}function addToWishlist(n){document.aspnetForm.ctl00_MainContent_txtWishQty.value!=""&!isNaN(document.aspnetForm.ctl00_MainContent_txtWishQty.value)?location.href="/users/addtowishlist.aspx?stockid="+n+"&qty="+document.aspnetForm.ctl00_MainContent_txtWishQty.value:(alert("Please enter a numeric quantity to add to your wishlist"),document.aspnetForm.ctl00_MainContent_txtWishQty.focus())}function addToCartQty(n,t){try{var r={stockID:n},i=0;$.ajax({type:"POST",async:!1,cache:!1,url:"/productquery.asmx/getproductdetails",data:JSON.stringify(r),datatype:"json",contentType:"application/json; charset=utf-8",success:function(r){var u=JSON.parse(r.d);dataLayer=[];dataLayer.push({event:"addToCart",ecommerce:{currencyCode:"GBP",add:{products:[{name:u.ProductTitle,id:u.ProductCode,price:u.SellingPrice,brand:u.ManufacturerName,category:u.Category,variant:u.Variant,quantity:t}]}},eventCallback:function(){if(i==0){document.location="/addtocartbylinkv3.aspx?stockid="+n+"&qty="+parseInt(t)+"&returnto="+escape(location.href);i++;return}}})&&(document.location="/addtocartbylinkv3.aspx?stockid="+n+"&qty="+parseInt(t)+"&returnto="+escape(location.href))},error:function(){document.location="/addtocartbylinkv3.aspx?stockid="+n+"&qty="+parseInt(t)+"&returnto="+escape(location.href)}})}catch(u){document.location="/addtocartbylinkv3.aspx?stockid="+n+"&qty="+parseInt(t)+"&returnto="+escape(location.href)}}function showSignup(n){$("#signupModal").modal("show");$("#signupText").html("To receive an email alert when product <strong>"+$("#code"+n).text()+": "+$("#title"+n).text()+"<\/strong> is available, please enter your details below.");$("#sid").val(n)}function signup(){if($("#signupemail").val()=="")$("#signupemail").addClass("error");else{$("#signupemail").removeClass("error");var n=$("#sid").val(),t=$("#signupemail").val();$.post("/stocklist/advance-post.aspx",{product:n,person:t});location.href="/advanceconfirm.aspx?SID="+$("#sid").val()}$("#signupModal").modal("hide")}function addOrderReferral(n){var t=document.getElementById("ctl00_MainContent_lstReferrals").value;return $.ajax({type:"POST",url:"https://www.hattons.co.uk/orderreferral.asmx/setorderreferral",data:{orderID:n,referralID:t},success:function(){document.getElementById("ctl00_MainContent_lblThankYouText").innerHTML="Thank you for providing this information. "}}),!1}function addToCartQtyPriceIDDCC(n,t,i,r){if(qtypriceqty=parseFloat(document.getElementById("ctl00_MainContent_hdnQtyPriceQty"+t).value),qty=document.getElementById("ctl00_MainContent_txtQty"+t).value,qty!=""&!isNaN(qty))if(parseInt(qty)<parseInt(document.aspnetForm.ctl00_MainContent_hidMin.value)||parseInt(qty)>parseInt(document.aspnetForm.ctl00_MainContent_hidMax.value))document.getElementById("ctl00_MainContent_txtQty"+t).value=document.aspnetForm.ctl00_MainContent_hidMin.value,alert("There are restrictions of the maximum and minimum number of this item you may order. Please try again."),document.getElementById("ctl00_MainContent_txtQty"+t).focus();else{qty=qty*parseInt(i);var f={stockID:n,sound:r},u=0;try{$.ajax({type:"POST",async:!1,cache:!1,url:"/productquery.asmx/getproductdetailsdcc",data:JSON.stringify(f),datatype:"json",contentType:"application/json; charset=utf-8",success:function(t){var i=JSON.parse(t.d);dataLayer=[];dataLayer.push({event:"addToCart",ecommerce:{currencyCode:"GBP",add:{products:[{name:i.ProductTitle,id:i.ProductCode,price:i.SellingPrice,brand:i.ManufacturerName,category:i.Category,variant:i.Variant,quantity:qty}]}},eventCallback:function(){if(u==0){document.location="/addtocartbylinkv3dcc.aspx?stockid="+n+"&qty="+parseInt(qty)+"&sound="+parseInt(r)+"&returnto="+escape(location.href);u++;return}}})&&(document.location="/addtocartbylinkv3dcc.aspx?stockid="+n+"&qty="+parseInt(qty)+"&sound="+parseInt(r)+"&returnto="+escape(location.href))},error:function(){document.location="/addtocartbylinkv3dcc.aspx?stockid="+n+"&qty="+parseInt(qty)+"&sound="+parseInt(r)+"&returnto="+escape(location.href)}})}catch(e){document.location="/addtocartbylinkv3.aspx?stockid="+n+"&qty="+parseInt(qty)+"&returnto="+escape(location.href)}}else alert("Please enter a numeric quantity to add to your cart"),document.getElementById("ctl00_MainContent_txtQty"+t).focus()}function TrackProductClick(n,t,i){var r={stockID:n};return $.ajax({type:"POST",url:"/productquery.asmx/getproductdetails",data:JSON.stringify(r),datatype:"json",contentType:"application/json; charset=utf-8",success:function(n){var r=JSON.parse(n.d);dataLayer=[];dataLayer.push({event:"productClick",ecommerce:{click:{actionField:{list:t.toString()},products:[{name:r.ProductTitle,id:r.ProductCode,price:r.SellingPrice,brand:r.Manufacturer,category:r.Category,variant:r.Variant,quantity:i}]}}})}}),!1}function TrackaddToCartQty(n,t){if(isNaN(t))return alert("Please enter a numeric quantity to add to your cart"),!1;var i={stockID:n};return $.ajax({type:"POST",url:"/productquery.asmx/getproductdetails",data:JSON.stringify(i),datatype:"json",contentType:"application/json; charset=utf-8",success:function(n){var i=JSON.parse(n.d);dataLayer.push({event:"addToCart",ecommerce:{currencyCode:"GBP",add:{products:[{name:i.ProductTitle,id:i.ProductCode,price:i.SellingPrice,brand:i.ManufacturerName,category:i.Category,variant:i.Variant,quantity:t}]}}})}}),!1}function TrackaddToTrunk(n,t){if(isNaN(t))return alert("Please enter a numeric quantity to add to your trunk"),!1;var i={qtyPriceID:n};return $.ajax({type:"POST",url:"/productquery.asmx/getproductdetailsbyqtypriceid",data:JSON.stringify(i),datatype:"json",contentType:"application/json; charset=utf-8",success:function(n){var i=JSON.parse(n.d);dataLayer=[];dataLayer.push({event:"addToTrunk",ProductCode:i.ProductCode,ProductTitle:i.ProductTitle,Price:i.SellingPrice,Brand:i.ManufacturerName,ProductCategory:i.Category,Variant:i.Variant,Quantity:t,ProductID:i.ProductID,ProductUrl:i.ProductURL,ProductType:i.ProductType.ProductTypeName,ProductImage:i.ImageLocation})}}),location.href="/addtotrunk.aspx?qid="+n+"&qty="+t,!1}function SendTrunk(){var n=JSON.parse(getParameterByName("id")),t;for(i=0;i<n.length;i++)t={orderdetailID:n[i]},$.ajax({type:"POST",url:"/productquery.asmx/getproductdetailsbyorderdetailid",data:JSON.stringify(t),datatype:"json",contentType:"application/json; charset=utf-8",success:function(n){var t=JSON.parse(n.d);dataLayer.push({event:"shipTrunk",ProductCode:t.ProductCode,ProductTitle:t.ProductTitle,Price:t.SellingPrice,Brand:t.ManufacturerName,ProductCategory:t.Category,Variant:t.Variant,Quantity:t.QtyInCart,ProductID:t.ProductID,ProductUrl:t.ProductURL,ProductType:t.ProductType.ProductTypeName,ProductImage:t.ImageLocation})}});return!1}function TrackaddToCartQtyDCC(n,t,i){if(isNaN(t))return alert("Please enter a numeric quantity to add to your cart"),!1;var r={stockID:n,sound:i};return $.ajax({type:"POST",async:!1,cache:!1,url:"/productquery.asmx/getproductdetailsdcc",data:JSON.stringify(r),datatype:"json",contentType:"application/json; charset=utf-8",success:function(n){var i=JSON.parse(n.d);dataLayer.push({event:"addToCart",ecommerce:{currencyCode:"GBP",add:{products:[{name:i.ProductTitle,id:i.ProductCode,price:i.SellingPrice,brand:i.ManufacturerName,category:i.Category,variant:i.Variant,quantity:t}]}}});dataLayer.push({event:"addToCartKlaviyo",AddedItemProductID:i.CartStockID,AddedItemProductName:i.ProductTitle,AddedItem_SKU:i.ProductCode,AddedItem_Price:i.SellingPrice,AddedItem_Categories:i.Category,AddedItem_Quantity:t,AddedItem_ImageURL:i.ImageLocation,AddedItem_URL:i.ProductURL})}}),!1}function newsletterSignup(){var n=document.getElementById("nl_signup").value;n==""?alert("Please enter your email address!"):(document.forms[0].action="//manage.kmail-lists.com/subscriptions/subscribe?a=JGQeXh&g=QJjsc5&email="+n,document.forms[0].method="POST",document.forms[0].target="_blank",document.forms[0].submit(),document.forms[0].action="",document.forms[0].target="")}function addToBuyBackList(){productId=parseInt($("#ctl00_MainContent_hdnMasterProductID").val());qty=parseInt($("#ctl00_MainContent_ddlQty").val());conditionId=parseInt($("#ctl00_MainContent_ddlCondition").val());document.location="/stocklistdatabase/addtobuybacklistbylink.aspx?productid="+productId+"&qty="+parseInt(qty)+"&conditionid="+parseInt(conditionId)+"&returnto="+escape(location.href)}function addToBuyBackListWithParameters(n,t,i){document.location="/stocklistdatabase/addtobuybacklistbylink.aspx?productid="+n+"&qty="+parseInt(t)+"&conditionid="+parseInt(i)+"&returnto="+escape(location.href)}function showDropOffMap(n,t){var i=document.getElementById("map");i.innerHTML="<iframe width='600' height='450' frameborder='0' style='border: 0' src='https://www.google.com/maps/embed/v1/directions?origin="+n+"&destination="+t+"&key=AIzaSyBXtzZbgIjHauKek6_khSXAfzM0SoeiO2U'><\/ iframe>";document.getElementById("map").scrollIntoView()}function TrackPromoClick(n,t,i,r){return dataLayer.push({event:"promotionClick",ecommerce:{promoClick:{promotions:[{id:n,name:t,creative:i,position:r}]}}}),!0}function TrackFileDownloadClick(n){return dataLayer.push({event:"DownloadFile",url:document.URL,file:n}),!0}function loginEvent(){dataLayer.push({event:"login",url:document.URL})}function ViewPortEvent(){dataLayer.push({event:"viewport",width:window.innerWidth})}function SelectAllCheckboxes(n){for(var i=document.getElementsByTagName("input"),t=0;t<i.length;t++)i[t].type=="checkbox"&&i[t].name.includes(n)&&(i[t].checked=!0)}var mobile_device,mobile_viewport,responsiveSwitch;jQuery.fn.exists=function(){return this.length>0};mobile_device=!1;/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(mobile_device=!0);mobile_viewport=!1;checkWidth();$(window).resize(checkWidth);$(function(){var n=$.jPanelMenu({menu:".mobile-nav",trigger:".js-open-mobile-nav",keyboardShortcuts:!1,excludedPanelContent:"style, .modal, script",direction:"right"});n.on()});$(document).ready(function(){$("#ctl00_MainContent_prodlistControl_chkImages").click(function(){dataLayer.push({event:"Show images",url:document.URL})});var n=Get_Cookie("textsize");n!=null&&(current=1.15,offset=parseFloat(n),nuvalue=current+offset,eval("document.getElementById('main').style.fontSize = '"+nuvalue+"em'"),document.getElementById("tsmenu").value=n)});$(document).ready(function(){$('[id$="chkPreowned"]').click(function(){dataLayer.push({event:"Show preowned",url:document.URL})})});current=1.15;responsiveSwitch=function(){function l(){var n=document.querySelector('meta[name="viewport"]');return n.getAttribute(i)==undefined&&n.setAttribute(i,n.getAttribute(t)),n.getAttribute(t)==n.getAttribute(i)?(document.cookie=e+"=true;path=/",n.setAttribute(t,"width="+f+", initial-scale="+document.documentElement.clientWidth/f)):(document.cookie=e+"=false;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT",n.setAttribute(t,n.getAttribute(i))),!1}function r(){for(var r=document.querySelectorAll("."+k),t,e,l,i=0;i<r.length;i++)t=r[i],t!=undefined&&(u(t,c),u(t,h),u(t,o),u(t,s),e=function(){return"ontouchstart"in window||"onmsgesturechange"in window},l=window.screenX!=0&&!e()?!0:!1,l?(n(t,o),t.innerHTML=""):y()?(n(t,c),n(t,s),t.innerHTML=t.getAttribute(w)):document.documentElement&&(document.documentElement.clientWidth<f||t.getAttribute(b)=="true")?(n(t,h),n(t,s),t.innerHTML=t.getAttribute(p)):(n(t,o),t.innerHTML=""),a||t.addEventListener("click",function(n){n=n||window.event;n.preventDefault();v()},!1));a=!0}function v(){l();r()}function d(){y()&&l();document.addEventListener&&(document.addEventListener("DOMContentLoaded",r,!1),document.addEventListener("orientationchange",r,!1),window.addEventListener("resize",r,!1))}function y(){return document.cookie.search(e+"=true")>-1}function n(n,t){n.className+=" "+t}function u(n,t){n.className=" "+n.className+" ";n.className=n.className.replace(" "+t+" ","")}var f=parseInt(window.responsiveSwitchBreakpoint)||1024,e="ResponsiveSwitch",t="content",i="data-rs",p="data-link-desktop",w="data-link-responsive",b="data-always-visible",k="rs-link",h="rs-link-to-desktop",c="rs-link-to-responsive",o="rs-link-inactive",s="rs-link-active",a=!1;return d(),{toggle:v}}()