var made={};var pageTracker={_trackPageview:function(){}};if(typeof _gaq!="undefined"){_gaq=[]}
function getUrlFilename(url){return url.substring(url.lastIndexOf("/")+1,url.length);}
made.tracking={scrolledDown:false,scrolledPastFold:false,scrolledToEnd:false,varSlotsUsed:[],addVariable:function(name,value,scope){var slot=0;for(i=1;i<6;i++){if(made.tracking.varSlotsUsed.indexOf(i)==-1){slot=i;break;}}
if(slot==0)
return;console.log('_setCustomVar',slot,name,value,scope);_gaq.push(['_setCustomVar',slot,name,value,scope]);made.tracking.varSlotsUsed.push(slot);},addEvent:function(element,category,action,label){var timestamp=new Date().getTime();console.log("mt_"+timestamp,category,action,label);_gaq.push(['_trackEvent',category,action,label,0]);setTimeout(function(){},100);},breadcrumbs:function(){var rawHtml=$$(".breadcrumbs ul li");return rawHtml;},addGlobalTracking:function(){$$(".header-container a span").each(function(curr){curr.observe("click",made.tracking.addEvent.curry(curr,"NavTop","Click",getUrlFilename(curr.up().href)));});$$(".footer-links a").each(function(curr){curr.observe("click",made.tracking.addEvent.curry(curr,"NavFooter","Click",getUrlFilename(curr.href)));});if($("newsletter-validate-detail"))
$("newsletter-validate-detail").observe("submit",made.tracking.addEvent.curry(this,"SubscribeFooter","Submitted","Yes"));if($("footer_fb_btn"))
$("footer_fb_btn").observe("click",made.tracking.addEvent.curry(this,"FooterFBLike","Click","Yes"));if($("sign-up-widget")){$("sign-up-widget").observe("mouseover",made.tracking.addEvent.curry(this,"Sidebar","MouseOver","Yes"));$("sign-up-widget").observe("click",made.tracking.addEvent.curry(this,"Sidebar","Click","Yes"));}
if($("popup-newsletter-validate-detail"))
$("popup-newsletter-validate-detail").observe("submit",made.tracking.addEvent.curry(this,"SubscribePopup","Submitted","Yes"));Event.observe(window,'scroll',function(){var scrollOffsets=document.viewport.getScrollOffsets();var scrollTop=scrollOffsets.top;if(scrollTop>1&&!made.tracking.scrolledDown){made.tracking.addEvent(null,"Window","ScrollBar","Down");made.tracking.scrolledDown=true;}
var viewport=document.viewport.getDimensions();var viewHeight=viewport.height;if(scrollTop>viewHeight&&!made.tracking.scrolledPastFold){made.tracking.addEvent(null,"Window","ScrollBar","PastFold");made.tracking.scrolledPastFold=true;}
var bodyHeight=document.body.getHeight();if((bodyHeight-viewHeight)-scrollTop<=1&&!made.tracking.scrolledToEnd){made.tracking.addEvent(null,"Window","ScrollBar","ToEnd");made.tracking.scrolledToEnd=true;}});},addHomepageTracking:function(){made.tracking.addVariable("PageType","Homepage",3);$$(".ico-next")[0].observe("click",made.tracking.addEvent.curry(this,"HomepageCarousel","ArrowClicked","Next"));$$(".ico-prev")[0].observe("click",made.tracking.addEvent.curry(this,"HomepageCarousel","ArrowClicked","Prev"));var slidenum=1;$$(".slide img").each(function(curr){curr.observe("click",made.tracking.addEvent.curry(curr,"HomepageCarousel","ImageClicked",slidenum+" "+getUrlFilename(curr.up().href)+" "+curr.src));slidenum++;});carousel.options.afterMove=function(){made.tracking.addEvent(null,"HomepageCarousel","HomepageImageDisplayed",(carousel.current._index+1)+" "+carousel.current.down().title);}
$$(".idTabs li a span").each(function(curr){curr.observe("click",made.tracking.addEvent.curry(curr,"HomepageTabs","TabClicked",curr.innerHTML));});$$("#products-grid-table a img").each(function(curr){curr.observe("click",made.tracking.addEvent.curry(curr,"HomepageBestsellersTab","ProductClicked",getUrlFilename(curr.up().href)));});$$(".top-five a img").each(function(curr){curr.observe("click",made.tracking.addEvent.curry(curr,"HomepageVoteTab","ProductClicked",curr.up(2).down(4).innerHTML));});},addCategoryTracking:function(){made.tracking.addVariable("PageType","Category",3);made.tracking.addVariable("Category",made.tracking.breadcrumbs()[1].innerHTML.trim(),3);$$(".product-image img").each(function(curr){if(curr.className=="preview")
curr.observe("click",made.tracking.addEvent.curry(curr,"CategoryProduct","ClickImage",getUrlFilename(curr.up().href)));});$$(".product-name a").each(function(curr){curr.observe("click",made.tracking.addEvent.curry(curr,"CategoryProduct","ClickDetails",getUrlFilename(curr.href)));});},addProductTracking:function(categoryName,productName){made.tracking.addVariable("PageType","Product",3);if(typeof categoryName=='undefined'&&made.tracking.breadcrumbs().length>2){made.tracking.addVariable("Category",made.tracking.breadcrumbs()[1].select("span")[0].innerHTML.trim(),3);}
if(typeof productName=='undefined'){made.tracking.addVariable("Product",made.tracking.breadcrumbs().last().innerHTML.trim(),3);}
if($$(".info-icon").length)
$$(".info-icon")[0].observe("mouseover",made.tracking.addEvent.curry(this,"ProductTimerInfo","MouseOver","Yes"));if($("image")&&$("nextLink")&&$("prevLink")){$("image").observe("click",made.tracking.addEvent.curry(this,"ProductHeroImage","Click","Yes"));$("nextLink").observe("click",made.tracking.addEvent.curry(this,"ProductLightbox","ClickNext","Yes"));$("prevLink").observe("click",made.tracking.addEvent.curry(this,"ProductLightbox","ClickPrev","Yes"));}
if($$(".price").length){$$(".price")[0].observe("mouseover",made.tracking.addEvent.curry(this,"ProductPrice","MouseOver","Yes"));}
if($("addtocart-button")){$("addtocart-button").observe("mouseover",made.tracking.addEvent.curry(this,"ProductOrderButton","MouseOver","Yes"));$("addtocart-button").observe("click",made.tracking.addEvent.curry(this,"ProductOrderButton","Click","Yes"));}
var i=0;$$(".gallery-image").each(function(curr){i++;curr.observe("click",made.tracking.addEvent.curry(curr,"ProductThumbnail"+i,"Click","Yes"));});if($$(".live_person a").length){$$(".live_person a")[0].observe("click",made.tracking.addEvent.curry(this,"ProductLiveperson","Click","Yes"));}
if($$(".contents-text iframe").length)
$$(".contents-text iframe")[0].observe("mouseover",made.tracking.addEvent.curry(this,"ProductVideo","MouseOver","Yes"));$$(".looks-great-with img").each(function(curr){curr.observe("click",made.tracking.addEvent.curry(curr,"ProductRelated","RelatedClick",getUrlFilename(curr.up().href)));});},addBasketTracking:function(){made.tracking.addVariable("PageType","Basket",3);$$(".remove img").each(function(curr){curr.observe("click",made.tracking.addEvent.curry(curr,"BasketRemove","Click","Yes"));});$$(".quantity select").each(function(curr){curr.observe("change",made.tracking.addEvent.curry(curr,"BasketQuantity","Change","Yes"));});if($("checkout_loginbtn"))
$("checkout_loginbtn").observe("click",made.tracking.addEvent.curry(this,"BasketButtons","LoginAttempted","Yes"));$$(".checkout_next span")[0].observe("click",made.tracking.addEvent.curry(this,"BasketButtons","Proceed","Yes"));$$(".checkout_back span")[0].observe("click",made.tracking.addEvent.curry(this,"BasketButtons","ContinueShopping","Yes"));},addAddressTracking:function(){made.tracking.addVariable("PageType","AddressEntry",3);$$("#shipping_address_input input, #shipping_address_input select").each(function(curr){curr.observe("focus",made.tracking.addEvent.curry(curr,"ShippingAddress","FieldFocus",curr.id));});$$("#billing_address_input input, #billing_address_input select").each(function(curr){curr.observe("focus",made.tracking.addEvent.curry(curr,"BillingAddress","FieldFocus",curr.id));});},addOrderSummaryTracking:function(){made.tracking.addVariable("PageType","OrderSummary",3);$$(".made-to-order a").each(function(curr){curr.observe("click",made.tracking.addEvent.curry(curr,"SummaryLeadtime","Click",curr.text));});$("apply-voucher").observe("focus",made.tracking.addEvent.curry(this,"SummaryVoucherField","Focus","Yes"));$("apply-voucher").observe("change",made.tracking.addEvent.curry(this,"SummaryVoucherField","Change","Yes"));$("apply-voucher-bttn").observe("click",made.tracking.addEvent.curry(this,"SummaryVoucherButton","Click","Yes"));},addPaymentTracking:function(){made.tracking.addVariable("PageType","Payment",3);$("payment:method_paypal_direct").observe("click",made.tracking.addEvent.curry(this,"PaymentByCard","Click","Yes"));$("payment:method_paypal_express").observe("click",made.tracking.addEvent.curry(this,"PaymentByPaypalExpress","Click","Yes"));$$(".verification-help")[0].observe("click",made.tracking.addEvent.curry(this,"PaymentCVVPopup","Click","Yes"));},addOrderConfirmationTracking:function(){made.tracking.addVariable("PageType","OrderConfirmation",3);}};$(document).observe('dom:loaded',made.tracking.addGlobalTracking);;document.observe("dom:loaded",function(){var slc=[];var rnd=parseInt(Math.random()*10000000000000000);var protocol=(document.location.protocol=="https:"?"https:":"http:");$$('.struq_SL_DF_container').each(function(type){var items=[];var ckey=type.readAttribute('title');type.select('.struq_SL_DF').each(function(val){var pn=val.readAttribute('title');var pv=val.innerHTML;items[items.length]=encodeURIComponent(pn)+'='+encodeURIComponent(pv);});slc[slc.length]=ckey+"="+(items.join('|'));if(slc.length==0)
return;var surl=protocol+'//app.struq.com/s/s/'+STRUQ_CODE+'/'
+'?v=2&qs='+encodeURIComponent(slc.join('&'))
+'&rnd='+rnd;var frame=document.createElement('iframe');frame.writeAttribute('style','width:0px; height:0px; border: 0px');frame.writeAttribute('src',surl);document.body.appendChild(frame);});});
