(function(d,g){d.execute(function(){d.when("A","RWDynamicModalFactory","ready").execute("RWDynamicModalBootstrapper",function(b,l){var i=b.state("rw-dynamic-modal"),h=b.state("rw-dynamic-modal-bootstrap"),e=b.$("#rwol-display-called"),f=function(){g.sessionStorage&&(sessionStorage.setItem("rwolLastPage",g.location.href),sessionStorage.setItem("rwolLastPageSet",Date.now()))},c=function(a){a.pageContent&&b.$("body").append(a.pageContent);a.data&&a.data.tracker?d.when(a.data.tracker).register("RWDynamicModal",
function(b){return l(a,b)}):d.register("RWDynamicModal",function(){return l(a)})},j=function(a){if(a&&/\S/.test(a))if(typeof a==="object")c(a);else try{c(b.parseJSON(a))}catch(d){b.$("body").append(a),b.state.parse(),b.ajax("/gp/overlay/update.html",{method:"post"})}};if(i)return f(),c(i);else if(h){if(g.sessionStorage&&!document.referrer&&(i=sessionStorage.getItem("rwolLastPageSet"))&&parseInt(i,10)>Date.now()-3E4)document.referrer=sessionStorage.getItem("rwolLastPage");if(document.referrer&&document.referrer.match(/^https?:\/\/([^\/]+\.)?amazon\.com(\/|$)/i))return f();
h.referrer=document.referrer;if(e.length>0){if(e.val()!=="0")return f();e.val(1)}f();return b.ajax("/gp/overlay/display.html",{method:"post",params:h,success:j})}});d.when("A","jQuery","a-modal-factory").register("RWDynamicModalFactory",function(b,d,g){var h,e,f;return function(c,j){if(c&&!h){var a=d('<span style="display:none;"></span>');d("body").append(a);h=g.create(a,c);e=c.data||{};if(j){if(e.countRef)b.on("a:popover:show:"+c.name,function(){j.track(e.countRef,e)});if(e.disButtonRef)b.on("a:popover:dismiss:"+
c.name,function(){j.track(e.disButtonRef,e);f=!0;b.off("a:popover:dismiss:"+c.name)});if(e.disRef)b.on("a:popover:afterHide:"+c.name,function(){f||j.track(e.disRef,e)});b.declarative("rw-popover-log-close","click",function(a){j.track(a.data.disRef,e);f=!0;h.hide()})}b.on("a:popover:afterShow:"+c.name,function(){b.ajax("/gp/overlay/update.html")});c.autoShow&&h.show();h.attrs("data",e);return h}}})})})(function(){var d=window.AmazonUIPageJS||window.P,g=d._namespace||d.attributeErrors;return g?g("RetailWebsiteOverlayAUIAssets"):
d}(),window);