
reportingService.controller.viewManagers.commonViewManager = new reportingService.controller.AbstractReportViewManager();
reportingService.controller.reportingManager.setViewManagerToReportRegistry(reportingService.controller.viewManagers.commonViewManager);
	
Object.extend(
	reportingService.controller.viewManagers.commonViewManager, {
		reportName:reportingService.constants.viewTypes.COMMON_VIEW,
		model:{
			commonCurrentPageName:null,
			commonCurrentBusinessId:null,
			
			commonAffiliateSiteId:null,
			commonTrackingCode:null,
			commonAffiliateAdId:null,
			commonContentItemLinkReferringBusinessId:null,
			commonContentItemIdAndLink:null,
			commonContentItemId:null,
			commonEmailVersion:null,
			commonDigitalImpactEmailId:null,
			commonEmailCardType:null,
			commonSisterSiteId:null,
			
			commonBrandPrefix:null,
			commonChannelName:null,
			commonChannelNameFormatted:null,
			commonCurrentPath:null,
			commonHierarchy:null,
			commonContentItemIdList:null,
			commonPrevStyle:null,
			commonProductCountInBag:null,
			commonProductBrandCode:null,
			commonProductBrandAbbr:null,
			commonHasTransmittedClinkAndMlink:false,
			commonIsThirdPartyCookieBlocked:false,
			commonVariantId:null,
			commonVariantStyle:null,
			commonHierarchyProduct:null,
			commonUniqueDomainReference:null,
			
			profile:{
				unknownShopperId:null,
				sessionId:null,
				customerId:null,
				isRegistrationCheckActive:null,
				setProfileData:function() {
					this.sessionId = (getCookie("JSESSIONID") + "").replace(":-1","");
					this.unknownShopperId = (getCookie("unknownShopperId") + "").replace(/\|\|\|/,"");
					this.customerId = (getCookie("customerId") + "").replace(/\|\|\|/,""); 
					
					this.sessionId = this.sessionId == "null" ? "" : this.sessionId; 
					this.sessionId = this.sessionId == "0" ? "" : this.sessionId; 
					this.unknownShopperId = this.unknownShopperId == "null" ? "" : this.unknownShopperId; 
					this.unknownShopperId = this.unknownShopperId == "0" ? "" : this.unknownShopperId; 
					this.customerId = this.customerId == "null" ? "" : this.customerId; 
					this.customerId = this.customerId == "0" ? "" : this.customerId; 
				}
			},
			performance:{
				timeToReadyFromPreviousPageFormatted:null,
				timeToLoadFromPreviousPageFormatted:null
			},
			shoppingBag:{
				products:null
			},
			order:{
				zip:null,
				state:null,
				products:null,
				orderId:null,
				duplicateProducts:null,
				cardTypeName:null
			},
			AbstractMerchandising:null,
			setReferringStyle:function (prevStyle) {
				setCookieVar("omniSession","prevStyle",prevStyle);
			},
			getProductsEncoded:function (strProducts) {
				
				var arrayProducts = strProducts.split("||");
				var strProducts = arrayProducts.join("....");
				var arrayProducts = strProducts.split("^,^");
				var strProducts = arrayProducts.join("--");
				
				return strProducts;
			},
			getProductsDecoded:function (strProducts) {
				
				var arrayProducts = strProducts.split("....");
				var strProducts = arrayProducts.join("||");
				var arrayProducts = strProducts.split("--");
				var strProducts = arrayProducts.join("^,^");
				
				return strProducts;
			},
			getHierarchy1:function () {
				var model = reportingService.controller.viewManagers.commonViewManager.model;
				var hierarchy1 = model.commonHierarchy||'';

				if (hierarchy1 == '') {
					hierarchy1 = model.commonCurrentPageName||'';
                    model.commonChannelName = model.commonChannelName||'';
                    model.commonCurrentPageName = model.commonCurrentPageName||'';
                    if (model.commonChannelName.toLowerCase() == "home") {
						hierarchy1 = model.commonCurrentPageName.substring(0, model.commonCurrentPageName.indexOf(":"));
					}
					
					var arrayStripStrings = [":product:",":outfit:",":quicklook:",":null"];
					for (var i=0; i < arrayStripStrings.length; i++) {
						if (hierarchy1.indexOf(arrayStripStrings[i]) != -1) {
							var arrayHierarchy = model.commonCurrentPageName.split(arrayStripStrings[i]);
							hierarchy1 = arrayHierarchy[0];
						}
					}
					model.commonHierarchy = hierarchy1;
				}
				return hierarchy1;
			},
			getShortPageName:function () {
				var pageNameArray = this.getHierarchy1().split(':');
				return pageNameArray[0] + (pageNameArray[1] ? ":" + pageNameArray[1] : '');
			},
			getDuplicateProducts:function (strProducts, strProductBusinessId) {
				var hasDuplicateProducts = false;
				var intFirstDelim, intSecondDelim;
				var intFirstDelim = strProducts.indexOf(strProductBusinessId);
				var intSecondDelim = (strProducts.indexOf(strProductBusinessId, (intFirstDelim + 1)));
				if (intSecondDelim != -1) {
					var hasDuplicateProducts = true;
				}
				return hasDuplicateProducts;
			},
			getOrderConfirmMerchandizing:function (
				strProductBusinessId,
				strProductName,
				strQuantity,
				strPrice,
				strColorDescription,
				strSkuDescription,
				strEvents,
				productBrandAbbr) {

				var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
                var merchandising = new commonModel.AbstractMerchandising();
				if (strProductBusinessId.indexOf("gross") != -1) {
					merchandising.strEventIncrementor = strProductName;
				}
				else {
					
					
					merchandising.strBrand = productBrandAbbr;
					merchandising.strProductName = strProductBusinessId;
					merchandising.strQuantity = strQuantity;
					merchandising.strPrice = strPrice;
					merchandising.strEventIncrementor = strEvents;
				}
				return merchandising;
			},
			parseMerchandisingVariable:function (strVariable) {
				if (strVariable != null) {
					return strVariable;
				}
				else {
					return "";
				}
			},
			getTid:function() {
				var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
				var commonTrackingCode = commonModel.commonTrackingCode;
				var returnValue = null;
				
				if (commonTrackingCode != null) {
					returnValue = commonTrackingCode;
				}
				else {
					returnValue = gidLib.getCookieVar("omniSession","strTid");
					if (returnValue!='') {
						gidLib.setCookieVar("omniSession","strTid","");
						
					}
					else {
						returnValue = gidLib.getQuerystringParam("tid");
					}
					if (returnValue!='') {
						commonModel.commonTrackingCode = returnValue;	
					}
				}
				
				if (window['commonTid'] != undefined) {
					if (commonTid != "") {
						returnValue = commonTid;
					}
				}
				return returnValue;
			},
            getAffiliateAdId:function() {
            	var tid = gidLib.getQuerystringParam("tid");
				var returnValue = null;
            	if (tid != '') {
					var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
					var commonAffiliateAdId = commonModel.commonAffiliateAdId;
					
					if (commonAffiliateAdId != null) {
						returnValue = commonAffiliateAdId;
					}
					else {
						var adid = getQuerystringParam("adid",true); 
						returnValue = (tid != '' && adid !='') ? adid : "other channel";
						commonModel.commonAffiliateAdId = returnValue;	
					}
				}
				return returnValue;
            },
            getAffiliateSiteId:function(){
            	var tid = gidLib.getQuerystringParam("tid");
				var returnValue = null;
            	if (tid != '') {
					var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
					var commonAffiliateSiteId = commonModel.commonAffiliateSiteId;
					
					if (commonAffiliateSiteId != null) {
						returnValue = commonAffiliateSiteId;
					}
					else {
						var siteID = getQuerystringParam("siteID",true);
						returnValue = (tid != '' && siteID !='') ? siteID : "other channel";
						commonModel.commonAffiliateSiteId = returnValue;	
					}
				}
				return returnValue;
            },
            getClickThroughProdIdPath:function(pid) {
                var clickThrough = (gidLib.getCookieVar("globalSession","omniClickThrough") + '>' + pid).match(/\d+>\d+/);
                return clickThrough ? clickThrough : 'no cross-sell';
			},
			
            getMerchandisingVariables:function (merchandising) {
				var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
				var strMerchandisingVariables = commonModel.parseMerchandisingVariable(merchandising.strBrand) + ";" +
				commonModel.parseMerchandisingVariable(merchandising.strProductName) + ";" +
				commonModel.parseMerchandisingVariable(merchandising.strQuantity) + ";" +
				commonModel.parseMerchandisingVariable(merchandising.strPrice) + ";" +
				commonModel.parseMerchandisingVariable(merchandising.strEventIncrementor) + ";" +
				commonModel.parseMerchandisingVariable(merchandising.strMerchandisingEvar);
				
				return strMerchandisingVariables;
			},
            getPreviousStyleId:function () {
				var previousStyleId = getQuerystringParam("refpid");
				if (previousStyleId == "") {
					previousStyleId = "no suggested item";
				}
				return previousStyleId;
			},
			getSProductsFromBag:function(strProducts, reportName) {
				var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
				var order = commonModel.order;
				var strSProducts = "";
				var arrayProducts = strProducts.split("||");
				
				
				for (var i=0;i<arrayProducts.length;i++) {
					var strProduct = arrayProducts[i];
					var arrayProductAttributes = strProduct.split("^,^");
					var strProductBusinessId = arrayProductAttributes[0];
					var hasDuplicateProducts = false;
					var isSingleProduct = false;
                    var strOrderConfirmEvents = null;
					var productBrandCode = arrayProductAttributes[1];
					var productBrandSite = gidLib.reporting.getBrandSite(productBrandCode);
					var productBrandAbbr = (productBrandSite ? productBrandSite.brandAbbr : "");
					if (productBrandAbbr == "") {
						productBrandAbbr = commonModel.commonProductBrandAbbr;
					}

                    if (strProductBusinessId.indexOf("gross") == -1) {
						
						var isMultiProduct = commonModel.getDuplicateProducts(strProducts, strProductBusinessId);
						if (!isMultiProduct) {
							isSingleProduct = true;
						}
						if (order.duplicateProducts == null) {
							order.duplicateProducts = "";
						}
						if (order.duplicateProducts.indexOf(strProductBusinessId) == -1) {
							
							hasDuplicateProducts = commonModel.getDuplicateProducts(strProducts, strProductBusinessId);
							if (hasDuplicateProducts) {
								if (order.duplicateProducts.length == 0) {
									order.duplicateProducts = strProductBusinessId;
								}
								else {
									order.duplicateProducts = order.duplicateProducts + "," + strProductBusinessId;
								}
							}
						}
					}
					/*
					logger.debug("omni.objOrder.strDuplicateProducts = " + omni.objOrder.strDuplicateProducts +
							"\n\rhasDuplicateProducts (>1 style number present for " + strProductBusinessId + ") = " + hasDuplicateProducts +
							"\n\risSingleProduct (1 style number present for " + strProductBusinessId + ") = " + isSingleProduct);
					}
					*/
					if (hasDuplicateProducts || isSingleProduct) {
						strOrderConfirmEvents = "event16=1";
					}
					
					var strProductName = arrayProductAttributes[2];
					var strQuantity = arrayProductAttributes[3];
					var strPrice = arrayProductAttributes[4];
					var strColorDescription = (arrayProductAttributes[5] ? commonModel.parseVars(arrayProductAttributes[5], ",") : "");
					var strSkuDescription = (arrayProductAttributes[6] ? commonModel.parseVars(arrayProductAttributes[6], ",") : "");
					
					switch (reportName) {
						case "inlineBagAdd":
							var inlineBagAddViewManager = reportingService.controller.viewManagers.inlineBagAddViewManager;
							var inlineBagAddModel = inlineBagAddViewManager.model;
							var merchandising = new commonModel.AbstractMerchandising();
							var activeSPageName = inlineBagAddModel.activeSPageName;
							merchandising.strBrand = productBrandAbbr;
							merchandising.strProductName = strProductBusinessId;
							merchandising.strQuantity = strQuantity;
							merchandising.strPrice = strPrice;
							merchandising.strMerchandisingEvar = "evar3=" + activeSPageName;
							break;
						case "quicklook":
							var merchandising = new commonModel.AbstractMerchandising();
							merchandising.strBrand = productBrandAbbr;
							merchandising.strProductName = strProductBusinessId;
							merchandising.strEventIncrementor = "event8=1",
							merchandising.strMerchandisingEvar = "evar2=" + commonModel.commonHierarchy;
							break;
						case "outfit":
							var merchandising = new commonModel.AbstractMerchandising();
							merchandising.strBrand = productBrandAbbr;
							merchandising.strProductName = strProductBusinessId;
							merchandising.strEventIncrementor = "event1=1",
							merchandising.strMerchandisingEvar = "evar2=" + commonModel.commonHierarchy;
							break;
						case "orderConfirm":
							var merchandising = commonModel.getOrderConfirmMerchandizing(
								strProductBusinessId,
								strProductName,
								strQuantity,
								strPrice,
								strColorDescription,
								strSkuDescription,
								strOrderConfirmEvents,
								productBrandAbbr);
							break;
						case "checkoutOrderModule":
							var merchandising = commonModel.getOrderConfirmMerchandizing(
								strProductBusinessId,
								strProductName,
								strQuantity,
								strPrice,
								strColorDescription,
								strSkuDescription,
								null,
								productBrandAbbr);
							break;
						default:
							var merchandising = new commonModel.AbstractMerchandising();
							merchandising.strBrand = productBrandAbbr;
							merchandising.strProductName = strProductBusinessId;
							merchandising.strQuantity = strQuantity;
							merchandising.strPrice = strPrice;
							break;
					}
					if (strSProducts == "") {
						
						strSProducts = commonModel.getMerchandisingVariables(merchandising);
					}
					else {
						strSProducts = strSProducts + "," + commonModel.getMerchandisingVariables(merchandising);
					}
					
				}
				return strSProducts;
			},
			parseVars:function (strVariable, strDelimeter) {
				if (strVariable != "") {
					if (strVariable.indexOf(strDelimeter) > -1) {
						var arrayParsedString = strVariable.split(strDelimeter);
						strVariable = arrayParsedString.join(" ");
					}
					return strVariable;
				}
				return "";
			},
            getSearchSelectedRefinementsFixedOrder:function() {
                var refinements = (window['objSearch']||{}).strSelectedRefinementsFixedOrder||'no refinements';
                return (this.getSearchSelectedRefinementsFixedOrder = function() { return refinements; })();
            },
			getSearchSortByDesc:function() {
                var sortBy = (window['objSearch']||{}).strSortByDesc||'no sort by';
                return (this.getSearchSortByDesc = function() { return sortBy; })();
            },
			getContentItemIdList:function() {
				var contentItemIdArray = gidLib.reporting.getContentItemIds();
				var contentDelimited  = contentItemIdArray.join(",");
				return contentDelimited;
			},
			getReferringStyleId:function () {
				var previousStyleId = getQuerystringParam("refpid");
				if (previousStyleId == "") {
					previousStyleId = "no suggested item";
				}
				return previousStyleId;
			},
			getSisterSiteId:function() {
				var sisterSiteId = "";
				try {
					sisterSiteId = parent.getQuerystringParam("ssiteID").toLowerCase();
				} catch(e) {
					/* failure to get the any info from the parent.
					 *  -- where the parent is a secure URL and the page is insecure
					 *  -- where the parent is a different domain
					 */
				}
				return sisterSiteId;
			},
			getCurrentPathFormatted:function(currentPath) {
				currentPathFormatted = null;
				if (currentPath != null) {
					currentPathFormatted = currentPath.replace("/","");
				}
				return currentPathFormatted;
			},
			getChannelNameFormatted:function(channelName, brandPrefix) {
				var channelNameFormatted = brandPrefix ||'';
				if ((channelName != null) && channelName != '') {
					channelNameFormatted +=  ":" + channelName;
				}
				return channelNameFormatted;
			},
			setProductCountInBag:function (strProductCountInBag) {
				var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
				if ((strProductCountInBag != null) && (strProductCountInBag != "")) {
					setCookieVar("omniSession","strProductCountInBag",strProductCountInBag);
					commonModel.productCountInBag = getCookieVar("omniSession","strProductCountInBag");
					
				}
			},
			getProductCountInBag:function() {
				var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
				return commonModel.productCountInBag;
			},
			getEntrySite:function() {
				var returnValue = "";
				if (window["gidBrandSiteConstruct"] && gidBrandSiteConstruct.hasGIDBrandSites) {
					var visitedSites = gidBrandSiteConstruct.visitedSites;
					var entrySite = (visitedSites.split(","))[0];
					if (entrySite && entrySite != "") {
						var brandSite = gidBrandSiteConstruct.gidBrandSites[Number(entrySite)];
						if (brandSite) returnValue = brandSite.brandAbbr;
					}
				}
				return returnValue;
			},
            /**
			 * checkFirstVisit returns the brand abbreviation on the first visit to the site within a session.
			 * @return the brand abbreviation if the conditions are met.
			 * 
			 * @author Byung Kim
			 * @date 12/06/2007
			 */
			checkFirstVisit:function() {
				var returnValue = "";
				var cookieVal = gidLib.getCookieVar("omniSession","firstVisit");
				if (cookieVal != "true" && window["gidBrandSiteConstruct"]) {
					if (window["gidBrandSiteConstruct"] && gidBrandSiteConstruct.hasGIDBrandSites) {
						var brandSite = gidBrandSiteConstruct.gidBrandSites[gidBrandSiteConstruct.currentBrandCode];
						if (brandSite) {
							returnValue = brandSite.brandAbbr;
							gidLib.setCookieVar("omniSession","firstVisit","true");
						}
					}
				}
				return returnValue;
			},
			setMarketingLinkModelValues:function() {
				var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
				if (!commonModel.commonHasTransmittedClinkAndMlink) {
					var strMarketingLink = getQuerystringParam("mlink");
					var strBusinessId = "";
					var strContentItemId = "";
					var strLinkId = "";
					var isLinkValid = false;
					var isBusinessIdValid = false;
					var isContentItemIdValid = false;
					var hasLinkId = false;
					var isLinkIdValid = false;
					/*
					s_eVar5 = "";
					s_eVar6 = "";
			        s_eVar7 = "";         
					*/
					
					if (strMarketingLink.indexOf(",") != -1) {
						
						var intFirstDelim = strMarketingLink.indexOf(",");
						var strBusinessId = strMarketingLink.substring(0, intFirstDelim);
						if (strBusinessId != "") {
							var isBusinessIdValid = true;
						}
						if (isBusinessIdValid) {
							
							if (strMarketingLink.indexOf(",", intFirstDelim + 1) != -1) {
								var intSecondDelim = strMarketingLink.indexOf(",", intFirstDelim + 1);
							}
							else {
								var intSecondDelim = strMarketingLink.length;
							}
							var strContentItemId = strMarketingLink.substring(intFirstDelim + 1, intSecondDelim);
							/*
							alert("strContentItemId = " + strContentItemId +
								"\n\rintFirstDelim = " + intFirstDelim + 
								"\n\rintSecondDelim = " + intSecondDelim);
							*/
							if (strContentItemId != "") {
								var isContentItemIdValid = true;
							}
							if (isContentItemIdValid) {
								
								if ((intSecondDelim != -1) && ((intSecondDelim + 1) < strMarketingLink.length)) {
									var hasLinkId = true;
									var strLinkId = strMarketingLink.substring(intSecondDelim + 1,strMarketingLink.length);
									if (strLinkId != "") {
										var isLinkIdValid = true;
									}
								}
							}
						}
					}
					if ((isBusinessIdValid) && (isContentItemIdValid)) {
						var isLinkValid = true;
						commonModel.commonHasTransmittedClinkAndMlink = (reportingService.model.reportRegistry.length != 0 || this.isWaitReport) ? false : true ; 
						commonModel.commonContentItemLinkReferringBusinessId = strBusinessId;
						if (isLinkIdValid) {
							
							commonModel.commonContentItemIdAndLink = strContentItemId + "," + strLinkId;
						}
						else {
							
							commonModel.commonContentItemIdAndLink = strContentItemId;
						}
			            
			            commonModel.commonContentItemId = getQuerystringParam("clink");
					}
			        
				}
				else {
					
					commonModel.commonContentItemLinkReferringBusinessId = null;
					commonModel.commonContentItemIdAndLink = null;
					commonModel.commonContentItemId = null;
				}
			},
			getCommonIsThirdPartyCookieBlocked:function() {
				var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
				var returnValue = null;
				if (commonModel.commonIsThirdPartyCookieBlocked == true) {
					returnValue = commonModel.commonIsThirdPartyCookieBlocked;
				}
				return returnValue;
			},
			setPidTrackRevenue : function () {
				var strTid = getQuerystringParam("tid");
				var strPid = getQuerystringParam("pid");
				if ((strTid != "") && (strPid != "")) {
					return strPid;
				}
				else {
					return "";
				}
			},
			getURLParam : function () {
				var commonDomainRedirect = getQuerystringParam("redirect");
				if (commonDomainRedirect != "") {
					if (commonDomainRedirect == "true"){ 
						return "redirect";
					} else {
						return "";
					}
				} else {
					return "";
				}
			}
        },
		controller:{
            setReportModel:function(strVariantId) {
                var model = reportingService.controller.viewManagers.commonViewManager.model;
                var searchAppManager = reportingService.controller.appManagers.searchAppManager;
                var timeToReadyFromPreviousPageFormatted = null;
                var timeToLoadFromPreviousPageFormatted = null;
                if (window['performanceMonitor'] != undefined) {
                	timeToReadyFromPreviousPageFormatted = performanceMonitor.reporting.timeToReadyFromPreviousPageFormatted;
                	timeToLoadFromPreviousPageFormatted = performanceMonitor.reporting.previousPage.timeToLoadFromPreviousPageFormatted;
                }
                
                var product = (strVariantId) ? quickLook.objP : null;
            	model.commonVariantId = (strVariantId) ? strVariantId : (product) ? product.strDefaultVariantId : '';
                if (product) {
	                var variant = product.arrayVariantStyles[model.commonVariantId];
	            } 
                var variantStyle = (variant && variant.strVariantName != '') ? (":" + variant.strVariantName.toLowerCase()) : '';
                var currentPath = model.getCurrentPathFormatted(model.commonCurrentPath)||'';
                if (currentPath.toLowerCase() == 'info' || document.body.className == 'popup') {
                	var hier = model.commonBrandPrefix + ":" + currentPath;
                	if (document.body.className == 'popup') {
                		hier += ":popup";
                	}
                	if (getQuerystringParam("cid") != '') {
                		hier += ":content:cid=" + getQuerystringParam("cid");
                	}
                	model.commonHierarchy = hier;
                	model.commonCurrentPageName = hier + variantStyle;
                } else {
                	model.commonHierarchy = model.getHierarchy1();
                }
		        model.commonHierarchyProduct = (product) ? model.commonHierarchy + variantStyle + '|' + product.productId : '';
            	model.commonVariantStyle = variantStyle;

                
                /*
                if (omni.strViewType == "categorySearch" || omni.strViewType == "siteSearch" || omni.strViewType == "product" || omni.strViewType == "quicklook" || omni.strViewType == "outfitLoader" || omni.strViewType == "outfit") {
					if (omni.strCurrentBusinessId && (omni.strCurrentBusinessId != "") && (searchAppManager.getCurrentBusinessIdCookie() != omni.strCurrentBusinessId)) {
						if (searchAppManager.getRefinementsFixedOrderCookie() != "") {
							searchAppManager.setRefinementsFixedOrderCookie(false);
						}
						if (searchAppManager.getSortByDescCookie() != "") {
							searchAppManager.setSortByDescCookie(false);
						}
					}
				}*/
	
                model.commonContentItemIdList = model.getContentItemIdList();
                model.commonPreviousStyle = model.getPreviousStyleId();
                model.commonSisterSiteId = model.getSisterSiteId();
                model.profile.setProfileData();
                model.setMarketingLinkModelValues();
                model.commonChannelNameFormatted = model.getChannelNameFormatted(model.commonChannelName, model.commonBrandPrefix);
                model.commonCurrentPath = currentPath;
                model.commonEntrySite = model.getEntrySite();
                model.commonFirstVisit = model.checkFirstVisit();
                model.performance.timeToReadyFromPreviousPageFormatted = timeToReadyFromPreviousPageFormatted;
                model.performance.timeToLoadFromPreviousPageFormatted = timeToLoadFromPreviousPageFormatted;
				model.commonAffiliateSiteId = model.getAffiliateSiteId();
				model.commonTrackingCode = model.getTid();
				model.commonAffiliateAdId = model.getAffiliateAdId();
				model.commonEmailVersion = gidLib.getQuerystringParam("ev");
				model.commonDigitalImpactEmailId = gidLib.getQuerystringParam("di");
				model.commonEmailCardType = gidLib.getQuerystringParam("cd");
				model.commonIsThirdPartyCookieBlocked = model.getCommonIsThirdPartyCookieBlocked();
				model.commonPidTrackRevenue = model.setPidTrackRevenue();
				model.commonUniqueDomainReference = model.getURLParam();
			},
			setReportTransmissionVars:function() {
                var model = reportingService.controller.viewManagers.commonViewManager.model;
                s.pageName = model.commonCurrentPageName + model.commonVariantStyle;
                s.campaign = model.commonTrackingCode;
				s.channel = model.commonChannelNameFormatted;
				s.hier1 = model.commonHierarchy + model.commonVariantStyle;
				s.prevStyle = model.commonPreviousStyle;
				
								
				s.prop8 = model.profile.unknownShopperId;
				s.prop9 = model.profile.sessionId;
				s.prop10 = model.profile.customerId;
				s.prop11 = model.commonContentItemIdList;
				s.prop32 = model.commonBrandPrefix;
				s.prop33 = model.commonCurrentPath;
				s.prop35 = model.commonFirstVisit;
				s.prop42 = model.performance.timeToLoadFromPreviousPageFormatted
				s.prop45 = model.performance.timeToReadyFromPreviousPageFormatted;
				
				s.eVar1 = model.commonAffiliateSiteId;
				s.eVar5 = model.commonContentItemLinkReferringBusinessId;
				s.eVar6 = model.commonContentItemIdAndLink;
				s.eVar7 = model.commonContentItemId;
				s.eVar10 = model.commonEmailCardType;
				s.eVar11 = model.commonEmailVersion;
				s.eVar13 = model.commonPidTrackRevenue;
				s.eVar16 = model.commonTrackingCode;
				s.eVar18 = model.commonTrackingCode;
				s.eVar22 = model.profile.unknownShopperId;
				s.eVar25 = model.commonSisterSiteId;
				s.eVar35 = model.commonEntrySite;
				s.eVar39 = model.commonHierarchyProduct;
				s.eVar41 = model.commonIsThirdPartyCookieBlocked;
				s.eVar43 = model.commonDigitalImpactEmailId; 
				s.eVar48 = model.commonAffiliateAdId;
				s.eVar50 = model.commonUniqueDomainReference;
			},
			setCleanUp:function() {
				s.eVar5 = "";
				s.eVar6 = "";
		        s.eVar7 = ""; 
			},
			getReportRequest:function() {
				var reportingManager = reportingService.controller.reportingManager;
				var commonViewManager = reportingService.controller.viewManagers.commonViewManager;
				commonViewManager.isWaitComplete = true;
				reportingManager.getReportingRequest(commonViewManager);
			}
		}	
	}
);






reportingService.controller.viewManagers.commonViewManager.model.AbstractMerchandising = Class.create();
reportingService.controller.viewManagers.commonViewManager.model.AbstractMerchandising.prototype = {
	strBrand:null,
	strProductName:null,
	strQuantity:null,
	strPrice:null,
	strEventIncrementor:null,
	strMerchandisingEvar:null,
	initialize:function() {
		
	}
}







reportingService.controller.viewManagers.inlineBagAddViewManager = new reportingService.controller.AbstractReportViewManager();

Object.extend(
	reportingService.controller.viewManagers.inlineBagAddViewManager, {
		reportName:reportingService.constants.viewTypes.INLINE_BAG_ADD_VIEW,
		isWaitReport:true,
		isWaitComplete:false,
		model:Object.extend(gidLib.clone(reportingService.controller.viewManagers.commonViewManager.model),{
			inlineShoppingBag:{
				products:null
			},
			inlineBagAddPageName:null,
			activeSPageName:null,
			reportName:reportingService.constants.viewTypes.INLINE_BAG_ADD_VIEW,
			getInlineBagPageName:function () {
				var activePageNameInSObject = s.pageName;
				var pageName = activePageNameInSObject + ":Inline Shopping Bag";
				return pageName;
			}
		}),
		controller:{
			setReportModel:function() {
				var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
				var inlineBagAddViewManager = reportingService.controller.viewManagers.inlineBagAddViewManager;
				var inlineBagAddModel = inlineBagAddViewManager.model;
				var products = inlineBagAddModel.inlineShoppingBag.products;
				var reportName = inlineBagAddViewManager.reportName;
				
				inlineBagAddModel.activeSPageName = s.pageName;
				inlineBagAddModel.originalSProducts = s.products;
				inlineBagAddModel.originalSEvent = s.events;
				inlineBagAddModel.inlineBagAddPageName = inlineBagAddModel.getInlineBagPageName();
				
				
				
				
				
				
				
				/*
				if (omni.objDebug.isDebugEnabled && (omni.objDebug.isInlineBagAddDebugEnabled || omni.objDebug.isActivateAllDebugEnabled)) {
					alert("omni.objInlineShoppingBag.strProducts = " + omni.objInlineShoppingBag.strProducts);
				}
				*/ 
				
				inlineBagAddModel.inlineShoppingBag.sProducts = commonModel.getSProductsFromBag(products, reportName);
				
				if (commonModel.getProductCountInBag() == "1") {
					if (getCookieVar("omniSession","hasOpenBag") == "true") {
						
						inlineBagAddModel.events = "scAdd";
					}
					else {
						
						inlineBagAddModel.events = "scAdd,scOpen";
						setCookieVar("omniSession","hasOpenBag","true");
					}
				}
				else {
					
					inlineBagAddModel.events = "scAdd";
				}
				/*
				if (omni.objDebug.isDebugEnabled && (omni.objDebug.isInlineBagAddDebugEnabled || omni.objDebug.isActivateAllDebugEnabled)) {
					omni.objDebug.displayDebugMsg("BEFORE send: s_pageName = " + s_pageName + "\r\ns_products = " + s_products + "\r\ns_events = " + s_events)
				}
				
				if (omni.objCurrentServer != null) {
					if (omni.objCurrentServer.isActiveReportingServer) {
						omni.sendAnalyticsEvent();
					}
				}
				*/
				
				
				
				/*
				s_pageName = omni.strCurrentPageName;
				s_products = strOriginalSProducts;
				s_events=strOriginalSEvent;
				if (omni.objDebug.isDebugEnabled && (omni.objDebug.isInlineBagAddDebugEnabled || omni.objDebug.isActivateAllDebugEnabled)) {
					omni.objDebug.displayDebugMsg("AFTER send: s_pageName = " + s_pageName + "\n\rs_products = " + s_products + "\n\rs_events = " + s_events);
				}
				*/
			},
			setReportTransmissionVars:function() {
				var inlineBagAddModel = reportingService.controller.viewManagers.inlineBagAddViewManager.model;
				s.pageName = inlineBagAddModel.inlineBagAddPageName;
				s.events = inlineBagAddModel.events;
				s.products = inlineBagAddModel.inlineShoppingBag.sProducts;
				
				s.prop11 = "";
				s.prop33 = inlineBagAddModel.reportName;
				s.prop45 = "";
				
				
				s.eVar4 = "";
				s.eVar12 = "";
				s.eVar15 = "";
				s.eVar19 = "";
				s.eVar23 = "";
				s.eVar31 = "";
				s.eVar39 = "";
				s.eVar44 = "";			
			},
			getReportRequest:function(strProductCountInBag, strOmniInlineBagJS) {
				var reportingManager = reportingService.controller.reportingManager;
				var commonViewManager = reportingService.controller.viewManagers.commonViewManager;
				var inlineBagAddViewManager = reportingService.controller.viewManagers.inlineBagAddViewManager;
				var commonModel = reportingService.controller.viewManagers.commonViewManager.model;
				var inlineBagAddModel = inlineBagAddViewManager.model;
				var viewManagers = new Array();
				
				inlineBagAddModel.inlineShoppingBag.products = strOmniInlineBagJS;
				commonModel.setProductCountInBag(strProductCountInBag);
				inlineBagAddViewManager.isWaitComplete = true;
				
				viewManagers.push(commonViewManager);
				viewManagers.push(inlineBagAddViewManager);
				reportingManager.getReportingRequest(inlineBagAddViewManager);
			},
            setCleanUp:function() {
            	var inlineBagAddModel = reportingService.controller.viewManagers.inlineBagAddViewManager.model;
				
				
				
				s.products = inlineBagAddModel.originalSProducts;
				
				s.events = inlineBagAddModel.originalSEvent;
				/*
				if (omni.objDebug.isDebugEnabled && (omni.objDebug.isInlineBagAddDebugEnabled || omni.objDebug.isActivateAllDebugEnabled)) {
					omni.objDebug.displayDebugMsg("AFTER send: s_pageName = " + s_pageName + "\n\rs_products = " + s_products + "\n\rs_events = " + s_events);
				}
				*/
				
			}
		}
	}
);
