(function(){"use strict";function n(){var h=trademe.ads.targeting.keyValues,i=trademe.ads.targeting.kvp,n=googletag.pubads(),o,t,e,c,s,l,a;for(o in h)h.hasOwnProperty(o)&&n.setTargeting(o,h[o]);for(t in i)i.hasOwnProperty(t)&&(i[t]instanceof Array?n.setTargeting(t,i[t].map(function(n){return n.toString()})):i[t]!==null&&n.setTargeting(t,i[t].toString()));if(n.setTargeting("altcat",trademe.ads.targeting.mCatPath),n.setTargeting("domain",document.location.hostname),u(n),r(n),e=document.location.pathname[0]==="/"?document.location.pathname.substring(1):document.location.pathname,e=e.trim(),c=decodeURIComponent(document.location.search).trim().replace("?","").replace(/&?[^&@]+@[^&]+&?/gi,"").replace(new RegExp("=","g"),"_"),s=window.localStorage,s)try{l=s.getItem("dealerid"),a=s.getItem("watchlistid"),l&&a&&(n.setTargeting("last_dealer",l),n.setTargeting("last_watchlist",a))}catch(v){}n.setTargeting("pageurl",e.length>0?e.split("/"):[]),n.setTargeting("querystring",c.length>0?c.split("&"):[]),n.setTargeting("protocol",document.location.protocol.replace(":","")),f(n)}function t(){var n=window.navigator.userAgent,t=/MSIE 9/i.test(n),i=/MSIE 10/i.test(n),r=/rv:11.0/i.test(n),u=/Edge\/\d./i.test(n);return t||i||r||u}function i(){googletag.pubads().collapseEmptyDivs(),googletag.pubads().enableSingleRequest(),googletag.pubads().enableVideoAds(),googletag.pubads().setForceSafeFrame(!0),t()||googletag.pubads().setSafeFrameConfig({sandbox:!0}),trademe.ads.targeting.ppid&&googletag.pubads().setPublisherProvidedId(trademe.ads.targeting.ppid);var n=trademe.ads.config.lazyLoadFetchMarginPercentage,i=trademe.ads.config.lazyLoadRenderMarginPercentage;typeof n=="number"&&typeof i=="number"&&n>=-1&&i>=-1&&googletag.pubads().enableLazyLoad({fetchMarginPercent:n,renderMarginPercent:i,mobileScaling:2}),googletag.enableServices()}function r(n){var t=window.Krux&&Krux.trademe&&Krux.trademe.segments;t&&t.length>0&&n.setTargeting("ksg",t)}function u(n){window.Krux&&Krux.trademe&&Krux.trademe.user&&n.setTargeting("kuid",Krux.trademe.user)}function f(n){document.referrer&&n.setTargeting("referrer",document.referrer)}window.googletag=window.googletag||{},window.googletag.cmd=window.googletag.cmd||[],window.Krux=window.Krux||{},googletag.cmd.push(function(){n(),i()}),googletag.cmd.push(function(){googletag.pubads().addEventListener("slotRenderEnded",function(){typeof doPageAdjustments==typeof Function&&doPageAdjustments(!1)})})})(),function(){"use strict";var r=document.getElementsByClassName("main--repeating-sticky"),t,i;if(r.length===1){var n=r[0].getElementsByClassName("skyscraper-container")[0],u=n.parentElement.offsetHeight-n.offsetTop,f=Math.floor(u/3500);for(t=1;t<f;t++)i=n.cloneNode(!0),i.getElementsByClassName("tm-display-ad")[0].id="clone_skyscraper_"+t,n.parentElement.appendChild(i)}}(),function(){"use strict";var n="main--temp-sticky",t=document.getElementsByClassName(n);t.length<1||googletag.cmd.push(function(){googletag.pubads().addEventListener("slotRenderEnded",function(t){var i=document.getElementById(t.slot.getSlotElementId()),r=i.closest&&i.closest("."+n);r&&setTimeout(function(){r.classList.remove("main--sticky-skyscraper")},1e4)})})}(),function(){"use strict";function n(){return window.trademe.ads.targeting.adUnitCode}function t(n,t){for(var u=1,i,r=0;r<n.length;r++)i=n[r].toString(),t.hasOwnProperty(i)?(t[i]+=1,u=Math.max(u,t[i])):t[i]=1;return u}function i(n){if(n.classList.contains("tm-display-ad--skyscraperwide")){if(window.innerWidth<1200)return[[160,600]];$(".skyscraper-container").addClass("tm-display-ad-wide")}return JSON.parse(n.getAttribute("tm-sizes"))}function r(n){var t=n.getAttribute("data-targeting");return t?JSON.parse(t):""}function u(n,t){t&&Object.keys(t).forEach(function(i){n.setTargeting(i,t[i])})}window.googletag=window.googletag||{},googletag.cmd=googletag.cmd||[],googletag.cmd.push(function(){for(var o=document.getElementsByClassName("tm-display-ad"),h={},f=0;f<o.length;f++){var e=o[f],s=i(e),c=r(e),l=googletag.defineSlot(n(),s,e.id).addService(googletag.pubads()).setTargeting("pos",t(s,h));u(l,c)}})}(),function(){"use strict";window.googletag=window.googletag||{},googletag.cmd=googletag.cmd||[],googletag.cmd.push(function(){for(var t=googletag.pubads().getSlots(),n=0;n<t.length;n++)googletag.display(t[n].getSlotElementId())})}()