;(function(){
/* Black Friday promo page: live countdown, and keeps the jump-to bar under the fixed header */
function run(){
var c=document.getElementById('bfp-count');if(!c)return;
var de=document.documentElement;function sbw(){de.style.setProperty('--bfp-sbw',Math.max(0,innerWidth-de.clientWidth)+'px')}sbw();window.addEventListener('resize',sbw);
/* full-bleed to the real screen edges on any device */
var bp=document.querySelector('.bfp');function bleed(){if(!bp||!bp.parentElement)return;var pl=bp.parentElement.getBoundingClientRect().left;bp.style.left='0';bp.style.marginLeft=(-pl)+'px';bp.style.marginRight='0';bp.style.width=de.clientWidth+'px'}bleed();window.addEventListener('resize',bleed);window.addEventListener('load',bleed);if(window.ResizeObserver)new ResizeObserver(bleed).observe(de);
var st=new Date(c.getAttribute('data-start')).getTime(),en=new Date(c.getAttribute('data-end')).getTime();
var lab=c.querySelector('[data-l]'),u={};['d','h','m','s'].forEach(function(k){u[k]=c.querySelector('[data-u="'+k+'"]')});
function pad(n){return (10 > n?'0':'')+n}
function tick(){var now=Date.now(),pre=st > now,t=Math.max(0,(pre?st:en)-now),s=Math.floor(t/1000);
if(lab)lab.textContent=pre?'Sale starts in':(t?'Sale ends in':'Sale has ended');
if(u.d)u.d.textContent=Math.floor(s/86400);if(u.h)u.h.textContent=pad(Math.floor(s%86400/3600));if(u.m)u.m.textContent=pad(Math.floor(s%3600/60));if(u.s)u.s.textContent=pad(s%60);
if(!t&&!pre){c.classList.add('bfp-ended');return}
setTimeout(tick,1005-now%1000)}
tick();
var nav=document.querySelector('.bfp-nav'),hdr=document.getElementById('ctl00_divHeader');
function top(){if(!nav||!hdr)return;var p=getComputedStyle(hdr).position,b=(p=='fixed'||p=='sticky')?Math.max(0,Math.round(hdr.getBoundingClientRect().bottom)):0;nav.style.setProperty('--bfp-top',b+'px');Array.prototype.forEach.call(document.querySelectorAll('.bfp-cat,.bfp-more'),function(x){x.style.scrollMarginTop=(b+nav.offsetHeight+16)+'px'})}
top();window.addEventListener('resize',top);window.addEventListener('scroll',top,{passive:true});
}
if(document.readyState=='loading')document.addEventListener('DOMContentLoaded',run);else run();
})();
(function(){
function vis(e){if(!e)return null;var r=e.getBoundingClientRect();return (r.width&&r.height)?r:null}
function go(){
var hdr=document.getElementById('ctl00_divHeader');
var bar=hdr&&hdr.querySelector('.mainMenu');
var ul=bar&&bar.querySelector('ul.mainMenuTop');
var a=document.getElementById('xgg-btn');
if(!a&&hdr){a=document.createElement('a');a.id='xgg-btn';a.href='/page/christmas-gift-guide.aspx';a.setAttribute('aria-label','Christmas Gift Guide');a.style.display='none';
a.innerHTML='\x3csvg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true">\x3crect x="3" y="9" width="18" height="12" rx="2" fill="#c2011a"/>\x3crect x="2" y="6.5" width="20" height="4" rx="1.5" fill="#e3142f"/>\x3crect x="10.6" y="6.5" width="2.8" height="14.5" fill="#1f7a3a"/>\x3cpath d="M12 6.5C9.5 2.5 6 3.2 6.6 5.3 7.1 6.8 10 6.6 12 6.5Zm0 0c2.5-4 6-3.3 5.4-1.2-.5 1.5-3.4 1.3-5.4 1.2Z" fill="#1f7a3a"/>\x3c/svg>\x3cspan class="xgg-t">Xmas Gift Guide\x3c/span>\x3cspan class="xgg-s">Gift\x3cbr>Guide\x3c/span>';hdr.appendChild(a)}
if(!hdr||!a)return;
/* the site can rebuild parts of the header after load, so always work on the live copy */
function cur(){var all=document.querySelectorAll('#xgg-btn'),i;for(i=1;i!==all.length;i++){all[i].parentNode.removeChild(all[i])}return all[0]||a}
function hide(){a.style.display='none'}
function desktop(){
if(!bar||!ul)return hide();
if(a.parentNode!==bar)bar.appendChild(a);
a.className='';a.style.display='flex';
var lis=ul.querySelectorAll('li'),last=null,i;
for(i=0;i!==lis.length;i++){if(lis[i].parentNode===ul&&vis(lis[i]))last=lis[i]}
if(!last)return hide();
var br=bar.getBoundingClientRect(),lr=last.getBoundingClientRect(),ar=a.getBoundingClientRect();
var left=br.width-28-ar.width;
if(lr.right-br.left+24>left)return hide();
a.style.left=Math.round(left)+'px';
/* centre on the menu text itself (the menu links have deep bottom padding) */
var lk=last.querySelector('a')||last,tw=document.createTreeWalker(lk,4),tn=null,n,tr;
while((n=tw.nextNode())){if(n.nodeValue.replace(/\s/g,'').length){tn=n;break}}
if(tn){var rg=document.createRange();rg.selectNodeContents(tn);tr=rg.getBoundingClientRect()}else{tr=lk.getBoundingClientRect()}
a.style.top=Math.round(tr.top+tr.height/2-br.top-ar.height/2)+'px';
}
function mobile(){
/* the visible logo in the header */
var imgs=hdr.querySelectorAll('.logo'),lg=null,i;
for(i=0;i!==imgs.length;i++){if(vis(imgs[i])){lg=imgs[i];break}}
if(!lg)return hide();
var box=lg.closest('.navbar-header')||hdr;
if(a.parentNode!==box){box.style.position='relative';box.appendChild(a)}
a.className='xgg-m';a.style.display='flex';
var hr=box.getBoundingClientRect(),lr=lg.getBoundingClientRect(),ar=a.getBoundingClientRect();
var space=hr.right-lr.right;
if(ar.width+16>space)return hide();
var left=lr.right+(space-ar.width)/2;
a.style.left=Math.round(left-hr.left)+'px';
a.style.top=Math.round(lr.top+lr.height/2-hr.top-ar.height/2)+'px';
}
function place(){a=cur();if(innerWidth>=992){desktop()}else{mobile()}}
place();window.addEventListener('resize',place);window.addEventListener('load',place);
setTimeout(place,400);setTimeout(place,1500);setTimeout(place,3500);
var li=hdr.querySelectorAll('.logo img'),k;for(k=0;k!==li.length;k++){li[k].addEventListener('load',place)}
if(window.ResizeObserver)new ResizeObserver(place).observe(hdr);
/* the mobile header is built after load: re-place when it changes */
var qt=0;if(window.MutationObserver)new MutationObserver(function(){if(!qt){qt=setTimeout(function(){qt=0;place()},60)}}).observe(hdr,{childList:true,subtree:true});
}
/* add the guide to the top level of the mobile side menu (CE and JH build their own menu lists) */
function sideMenu(){
var ls=document.querySelectorAll('ul.ce-ex-list,ul.jh-menu-list'),i,u,h,cls;
for(i=0;i!==ls.length;i++){u=ls[i];
if(u.querySelector('.xgg-row'))continue;
h=u.parentNode&&u.parentNode.querySelector('h2');
if(!h||h.textContent.replace(/\s/g,'')!=='Shop')continue;
cls=u.classList.contains('ce-ex-list')?'ce-ex-row':'jh-menu-row';
var li=document.createElement('li'),x=document.createElement('a');
x.className=cls+' xgg-row';x.href='/page/christmas-gift-guide.aspx';x.setAttribute('data-leaf','true');
x.innerHTML='\x3csvg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true">\x3crect x="3" y="9" width="18" height="12" rx="2" fill="#c2011a"/>\x3crect x="2" y="6.5" width="20" height="4" rx="1.5" fill="#e3142f"/>\x3crect x="10.6" y="6.5" width="2.8" height="14.5" fill="#1f7a3a"/>\x3cpath d="M12 6.5C9.5 2.5 6 3.2 6.6 5.3 7.1 6.8 10 6.6 12 6.5Zm0 0c2.5-4 6-3.3 5.4-1.2-.5 1.5-3.4 1.3-5.4 1.2Z" fill="#1f7a3a"/>\x3c/svg>\x3cspan>Christmas Gift Guide\x3c/span>';
li.appendChild(x);u.insertBefore(li,u.firstChild);
}
}
var mt=0;
function watchMenu(){sideMenu();if(window.MutationObserver)new MutationObserver(function(){if(!mt){mt=setTimeout(function(){mt=0;sideMenu()},80)}}).observe(document.body,{childList:true,subtree:true})}
if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',watchMenu)}else{watchMenu()}
if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',go)}else{go()}
})();