
if(typeof(analyticsJS)=="undefined"||!analyticsJS||!analyticsJS.topicNamespace){analyticsJS={storeId:0,catalogId:0,urlPath:null,miniShopCartTitle:"/webapp/wcs/stores/servlet/MiniShoppingCart",jsonPageView:"/webapp/wcs/stores/servlet/AnalyticsPageView",jsonProductView:"/webapp/wcs/stores/servlet/AnalyticsProductView",jsonElementView:"/webapp/wcs/stores/servlet/AnalyticsElementView",jsonShopcartView:"/webapp/wcs/stores/servlet/AnalyticsShopcartView",jsonRegistrationView:"/webapp/wcs/stores/servlet/AnalyticsRegistrationView",topicNamespace:"/wc/analytics/",pageView:"pageview",productView:"productview",cartView:"cartview",element:"element",registration:"registration",pageViewControl:false,cartViewActionIdList:["AjaxAddOrderItem","AjaxDeleteOrderItem","AjaxUpdateOrderItem","AjaxAddOrderItemWithShipingInfo"],myAccountPageIdList:["UserRegistrationUpdate","updateAddressBook","profileUpdate"],myAddressBookPageIdList:["updateAddress","AddressDelete"],wishlistPageIdList:["AjaxInterestItemAdd","InterestItemDelete"],registrationViewIdList:["UserRegistrationUpdate",],fastFinderEvents:[["filterResultsWithOrderBy","orderby",function(selectBoxNode){var optionText="";if(selectBoxNode&&selectBoxNode!=null&&selectBoxNode.options!=null)
optionText=selectBoxNode.options[selectBoxNode.selectedIndex].text;return optionText;}],["filterResultsWithPrice","price slider range",function(slider){var values=slider.getFormattedValues();return['[',values.lower,' - ',values.upper,']'].join("");}],["filterResultsWithView","view change"]],fastFinderCheckboxForms:[["BrandsForm","brands"],["FeatureNamesForm","features"]],publishAnalyticsView:function(jsonViewName,urlParams,publisher){var scope=this;var kw={url:jsonViewName,encoding:'utf-8',handleAs:'json',content:dojo.mixin({storeId:scope.storeId,catalogId:scope.catalogId},urlParams),error:function(type,errObj){},load:function(data,ioArgs){publisher.call(scope,data);}};dojo.xhrGet(kw);},publishTopic:function(topicName,topicData){var topic=this.makeTopic(topicName);dojo.publish(topic,topicData);},publishPageView:function(pageViewData){var scope=this;this.publishAnalyticsView(scope.jsonPageView,pageViewData,function(data){scope.publishTopic(scope.pageView,data);});},publishCartView:function(){var scope=this;this.publishAnalyticsView(scope.jsonShopcartView,{storeId:scope.storeId},function(data){scope.publishTopic(scope.cartView,data);});},publishRegistrationView:function(){var scope=this;this.publishAnalyticsView(scope.jsonRegistrationView,{storeId:scope.storeId},function(data){scope.publishTopic(scope.registration,data);});},makeTopic:function(topicName){return[this.topicNamespace,topicName].join("")},getMiniShopCartPageCategory:function(){return"MiniShoppingCart"},getMiniShopCartPageName:function(){return["MiniShoppingCart: ",document.title].join("");},getMiniShopCartPageViewData:function(miniShopCartTitle){var pageName=this.getMiniShopCartPageName();var pageCategory=this.getMiniShopCartPageCategory();return{pagename:pageName,category:pageCategory};},registerMiniShopCartPageView:function(shopCartTitle){dojo.connect(null,"showMiniShopCartDropDown",function(){analyticsJS.publishMiniShopCartPageView(shopCartTitle);});},publishMiniShopCartPageView:function(miniShopCartTitle){var scope=this;if(!scope.pageViewControl){scope.lockPageView();var pageViewData=this.getMiniShopCartPageViewData(miniShopCartTitle);}},lockPageView:function(){this.pageViewControl=true;setTimeout('analyticsJS.pageViewControl = false;',3000);},registerMiniShopCartCartView:function(){var scope=this;dojo.forEach(this.cartViewActionIdList,function(actionId){dojo.subscribe("modelChanged/"+actionId,function(){scope.publishCartView();});});},loadMiniShopCartHandler:function(){var scope=this;scope.registerMiniShopCartCartView();scope.registerMiniShopCartPageView(scope.miniShopCartTitle);},loadShopCartPaginationHandler:function(){var scope=this;scope.registerShopCartPaginationPageView();},registerShopCartPaginationPageView:function(){var scope=this;dojo.subscribe("ShopCartPaginationDisplay_Context/RenderContextChanged",function(){var pageViewData={pagename:document.title};scope.publishPageView(pageViewData);});dojo.subscribe("OrderItemPaginationDisplay_Context/RenderContextChanged",function(){var pageViewData={pagename:document.title};scope.publishPageView(pageViewData);});dojo.subscribe("MSOrderItemPaginationDisplay_Context/RenderContextChanged",function(){var pageViewData={pagename:document.title};scope.publishPageView(pageViewData);});},registerFastFinderEventHandlers:function(categoryId){var scope=this;dojo.forEach(scope.fastFinderEvents,function(pair){var func=pair[0];var elementType=pair[1];var valueFunc=pair[2];dojo.connect(fastFinderJS,func,function(value){scope.publishAnalyticsView(scope.jsonElementView,{elementId:valueFunc?valueFunc(value):value,category:["Fast Finder:",elementType].join(""),pageId:document.title,pageCategory:categoryId},function(data){scope.publishTopic(scope.element,data);});});});},registerFastFinderFormHandlers:function(){var scope=this;dojo.forEach(scope.fastFinderCheckboxForms,function(pair){var formName=pair[0];var category=pair[1];dojo.forEach(document.forms[formName].elements,function(input){scope.connectFastFinderInputs(input,category);});});},connectFastFinderInputs:function(input,category){var scope=this;dojo.connect(input,"onclick",function(){scope.publishAnalyticsView(scope.jsonElementView,{elementId:input.value,category:["Fast Finder: ",category].join(""),pageId:document.title,pageCategory:"Fast Finder",state:(function(input){if(input.checked){return"checked";}
return"unchecked";})(input)},function(data){scope.publishTopic(scope.element,data);});});},loadFastFinderHandlers:function(categoryId){var scope=this;dojo.addOnLoad(function(){scope.registerFastFinderEventHandlers(categoryId);scope.registerFastFinderFormHandlers();});},registerUserRegUpdateHandler:function(){var scope=this;var pageViewData={pagename:"My Account:"+document.title,category:"MyAccountPage"};dojo.forEach(this.registrationViewIdList,function(actionId){dojo.subscribe("modelChanged/"+actionId,function(){scope.publishRegistrationView();});});dojo.forEach(this.myAccountPageIdList,function(actionId){dojo.subscribe("modelChanged/"+actionId,function(){scope.publishPageView(pageViewData);});});},publishMyAccountPageView:function(myAccountContextId){var scope=this;var myAccountContext=wc.render.getContextById(myAccountContextId);var workAreaModeValue=myAccountContext.properties.workAreaMode;var pageName="";var pageCategory="MyAccountPage";if(workAreaModeValue=="myAccountMain"){pageName="My Account:"+document.title;}else if(workAreaModeValue=="personalInformation"){pageName="Personal Information:"+document.title;}else if(workAreaModeValue=="addressBook"){pageName="My Address Book:"+document.title;}else if(workAreaModeValue=="trackOrderStatus"){pageName="My Orders:"+document.title;}else if(workAreaModeValue=="checkoutProfile"){pageName="Quick checkout profile:"+document.title;}else if(workAreaModeValue=="wishList"){pageName="Personal Wishlist:"+document.title;}else if(workAreaModeValue=="couponWallet"){pageName="My Coupons:"+document.title;}
var pageViewData={pagename:pageName,category:pageCategory};scope.publishPageView(pageViewData);},registerMyAccountPageHandler:function(myAccountContextId){var scope=this;dojo.connect(MyAccountDisplay,"loadContentFromURL",function(){scope.publishMyAccountPageView(myAccountContextId);});dojo.connect(wc.render.getRefreshControllerById("MyAccountCenterLinkDisplay_Controller"),"postRefreshHandler",function(){cX("onload");});},registerMyAddressBookHandler:function(){var scope=this;var pageCategory="MyAccountPage";var pageName="My Address Book:"+document.title;var pageViewData={pagename:pageName,category:pageCategory};dojo.forEach(this.myAddressBookPageIdList,function(actionId){dojo.subscribe("modelChanged/"+actionId,function(){scope.publishPageView(pageViewData);});});dojo.subscribe("addressBookContext/RenderContextChanged",function(){scope.publishPageView(pageViewData);});},registerWishlistHandler:function(){var scope=this;var pageCategory="MyAccountPage";var pageName="Personal Wishlist:"+document.title;var pageViewData={pagename:pageName,category:pageCategory};dojo.forEach(this.wishlistPageIdList,function(actionId){dojo.subscribe("modelChanged/"+actionId,function(){scope.publishPageView(pageViewData);});});},loadMyAccountPageHandlers:function(){var scope=this;dojo.addOnLoad(function(){scope.registerUserRegUpdateHandler();scope.registerMyAccountPageHandler('MyAccountCenterLinkDisplay_Context');scope.registerMyAddressBookHandler();scope.registerWishlistHandler();});},registerProductQuickInfoView:function(productInfoId){var scope=this;dojo.connect(null,"populatePopUp",function(){var catEntryId=document.getElementById(productInfoId).innerHTML;scope.publishAnalyticsView(scope.jsonProductView,{productId:catEntryId,storeId:scope.storeId},function(data){scope.publishTopic(scope.productView,data);});});},loadProductQuickInfoHandler:function(productInfoId){var scope=this;dojo.addOnLoad(function(){scope.registerProductQuickInfoView(productInfoId);});},loadPagingHandler:function(){var scope=this;dojo.addOnLoad(function(){var movement={forward:"page forward",backward:"page backward"};var monitoredEvents=[["CatalogSearchDisplayJS","goBack",movement.backward],["CatalogSearchDisplayJS","goForward",movement.forward],["CatalogSearchDisplayJS.HistoryTracker.prototype","back",movement.backward],["CatalogSearchDisplayJS.HistoryTracker.prototype","forward",movement.forward],["fastFinderJS","goBack",movement.backward],["fastFinderJS","goForward",movement.forward],["fastFinderJS","filterResultsWithPrevIndex",movement.backward],["fastFinderJS","filterResultsWithNextIndex",movement.forward],["fastFinderJS.HistoryTracker.prototype","back",movement.backward],["fastFinderJS.HistoryTracker.prototype","forward",movement.forward],["MyAccountDisplay","goBack",movement.backward],["MyAccountDisplay","goForward",movement.forward],["MyAccountDisplay.HistoryTracker.prototype","back",movement.backward],["MyAccountDisplay.HistoryTracker.prototype","forward",movement.forward],["Common","goBack",movement.backward],["Common","goForard",movement.forward],["Common.HistoryTracker.prototype","back",movement.backward],["Common.HistoryTracker.prototype","forward",movement.forward],["categoryDisplayJS","loadContentURL","view change"]];dojo.forEach(monitoredEvents,function(target){var srcObj=dojo.getObject(target[0]);var srcFunc=target[1];var movement=target[2];dojo.connect(srcObj,srcFunc,function(){scope.publishPageView({pagename:document.title,category:movement});});});});},registerSearchResultPageView:function(refreshControllerId,resultInfoDivId,registerPageViewNow,advSearchFormDivId){var realSearch=true;var scope=this;if(registerPageViewNow){if(dojo.byId(resultInfoDivId)!=null){var resultInfo=eval('('+dojo.byId(resultInfoDivId).innerHTML+')').searchResult;var pageViewData;if(resultInfo.totalResultCount<1){pageViewData={pagename:"Search Result: Unsuccessful"};pageViewData.searchCount="0";}else{pageViewData={pagename:"Search Result: Successful: Page "+resultInfo.currentPageNumber};pageViewData.searchCount=resultInfo.totalResultCount;}
pageViewData.category="Search";pageViewData.searchTerms=resultInfo.searchTerms;scope.publishPageView(pageViewData);}else{var pageViewData={pagename:"Search Result: Unsuccessful"};pageViewData.category="Search";pageViewData.searchCount="0";scope.publishPageView(pageViewData);}}
dojo.connect(CatalogSearchDisplayJS,"goToResultPage",function(){realSearch=false;});dojo.connect(CatalogSearchDisplayJS,"showHideSearchMode",function(){if(dojo.byId(advSearchFormDivId).style.display=='block'){var pageViewData={pagename:"Search Result: Unsuccessful"};pageViewData.category="Search";pageViewData.searchCount="0";scope.publishPageView(pageViewData);}});dojo.connect(wc.render.getRefreshControllerById(refreshControllerId),"postRefreshHandler",function(){var resultInfo=eval('('+dojo.byId(resultInfoDivId).innerHTML+')').searchResult;var pageViewData;if(resultInfo.totalResultCount<1){pageViewData={pagename:"Search Result: Unsuccessful"};pageViewData.searchCount="0";}else{pageViewData={pagename:"Search Result: Successful Page "+resultInfo.currentPageNumber};pageViewData.searchCount=resultInfo.totalResultCount;}
if(resultInfo.searchTerms!=null){pageViewData.searchTerms=resultInfo.searchTerms;};pageViewData.category="Search";scope.publishPageView(pageViewData);});},loadSearchResultHandler:function(refreshControllerId,resultInfoDivId,registerPageViewNow,advSearchFormDivId){var scope=this;dojo.addOnLoad(function(){scope.registerSearchResultPageView(refreshControllerId,resultInfoDivId,registerPageViewNow,advSearchFormDivId);});},registerPaymentPageView:function(paymentController){var scope=this;dojo.connect(paymentController,"setNumberOfPaymentMethods",function(totalPaymentMethods,selection,divName){scope.publishPageView({pagename:selection.value,category:"payment method"});selection=null;});},loadPaymentPageView:function(paymentController){var scope=this;dojo.addOnLoad(function(){scope.registerPaymentPageView(paymentController);});}}}
