// Namespace for Webstore analytics, to avoid conflicts with other global objects
var WSA = window.WSA || {};
WSA.omniturePageMap = {
	prefix: "US:WS",
	eVar16:"US",
	"home": {
	    pageName:"Homepage",
		 channel:"Main",
		   prop4:"Main",
		   prop5:"Main"
	},
	"2980635011": {
	    pageName:"",
		 channel:"Why Amazon Webstore",
		   prop5:"Site Section"
	},
	"2980643011": {
	    pageName:"Generate More Sales",
		 channel:"Why Amazon Webstore",
		   prop5:"Sub"	
	},
	"2980644011": {
	    pageName:"Generate More Traffic",
		 channel:"Why Amazon Webstore",
		   prop5:"Sub"	
	},
	"2980646011": {
	    pageName:"Do More With Amazon",
		 channel:"Why Amazon Webstore",
		   prop5:"Sub"
	},
	"2980648011": {
	    pageName:"Partner with eCommerce Leader",
		 channel:"Why Amazon Webstore",
		   prop5:"Sub"
	},
	"2980649011": {
	    pageName:"Leverage Security and Scalability",
		 channel:"Why Amazon Webstore",
		   prop5:"Sub"
	},
	"2980641011": {
	    pageName:"",
		 channel:"Features",
		   prop5:"Site Section"
	},
	"2988392011": {
	    pageName:"Website Design",
		 channel:"Features",
		   prop5:"Sub"
	},
	"2988402011": {
	    pageName:"Shopping Cart",
		 channel:"Features",
		   prop5:"Sub"
	},
	"2988406011": {
	    pageName:"Credit Card Processing",
		 channel:"Features",
		   prop5:"Sub"
	},
	"2988407011": {
	    pageName:"Ecommerce Hosting",
		 channel:"Features",
		   prop5:"Sub"
	},
	"3052705011": {
	    pageName:"Inventory Management",
		 channel:"Features",
		   prop5:"Sub"
	},
	"3052709011": {
	    pageName:"",
		 channel:"Solutions",
		   prop5:"Site Section"
	},
	"3052712011": {
	    pageName:"New To Ecommerce",
		 channel:"Solutions",
		   prop5:"Sub"
	},
	"3086366011": {
	    pageName:"Existing Online Seller",
		 channel:"Solutions",
		   prop5:"Sub"
	},
	"3052714011": {
	    pageName:"Individual Sellers",
		 channel:"Solutions",
		   prop5:"Sub"
	},
	"3052715011": {
	    pageName:"Small Business Ecommerce",
		 channel:"Solutions",
		   prop5:"Sub"
	},
	"3052716011": {
	    pageName:"Mid-Sized Business",
		 channel:"Solutions",
		   prop5:"Sub"
	},
	"3052717011": {
	    pageName:"Enterprise Ecommerce",
		 channel:"Solutions",
		   prop5:"Sub"
	},
	"3052760011": {
	    pageName:"Manufacturing",
		 channel:"Solutions",
		   prop5:"Sub"
	},
	"2980636011": {
	    pageName:"",
		 channel:"Resources",
		   prop5:"Site Section"
	},
	"2988355011": {
	    pageName:"Webstore Solution Providers",
		 channel:"Resources",
		   prop5:"Sub"
	},
	"2988356011": {
	    pageName:"How to Build a Website",
		 channel:"Resources",
		   prop5:"Sub"
	},
	"2988388011": {
	    pageName:"Ecommerce Templates",
		 channel:"Resources",
		   prop5:"Sub"
	},
	"2988389011": {
	    pageName:"Webinars & Demos",
		 channel:"Resources",
		   prop5:"Sub"
	},
	"2988390011": {
	    pageName:"FAQ",
		 channel:"Resources",
		   prop5:"Sub"
	},
	"2988391011": {
	    pageName:"Press Releases",
		 channel:"Resources",
		   prop5:"Sub"
	},
	"2980637011": {
	    pageName:"",
		 channel:"Seller Showcase",
		   prop5:"Site Section"
	},
	"2983699011": {
	    pageName:"Webstore Gallery",
		 channel:"Seller Showcase",
		   prop5:"Sub"
	},
	"2983700011": {
	    pageName:"Case Studies",
		 channel:"Seller Showcase",
		   prop5:"Sub"
	},
	"2980642011": {
	    pageName:"",
		 channel:"Pricing Options",
		   prop5:"Site Section"
	},
	"3073471011": {
	    pageName:"Webstore Newsletter",
		 channel:"Support",
		   prop5:"Sub"
	},
	"2994969011": {
	    pageName:"Help",
		 channel:"Support",
		   prop5:"Sub"
	},
	"2991255011": {
	    pageName:"Contact Us",
		 channel:"Support",
		   prop5:"Sub"
	},
	"3060239011": {
	    pageName:"Contact Us Confirmation",
		 channel:"Support",
		   prop5:"Sub"
	},
	"3090394011": {
	    pageName:"EcommerceWebsite",
		 channel:"Main",
		   prop4:"Main",
		   prop5:"Main"
	},
	"3090477011": {
	    pageName:"EcommerceHosting",
		 channel:"Main",
		   prop4:"Main",
		   prop5:"Main"
	},
	"3090479011": {
	    pageName:"ShoppingCart",
		 channel:"Main",
		   prop4:"Main",
		   prop5:"Main"
	},
	"3090478011": {
	    pageName:"Payments",
		 channel:"Main",
		   prop4:"Main",
		   prop5:"Main"
	},
	"3215712011": {
	    pageName:"EcommerceWebsiteStore",
		 channel:"Main",
		   prop4:"Main",
		   prop5:"Main"	
	}
}
WSA.mapURI = {
    submitOmniture : false,
    init : function() {
        var url      = decodeURI(document.location.href),
			urlArray = url.split(/\/b\/|\?/);
		if(WSA.omniturePageMap[urlArray[1]]) {
			this.page = urlArray[1];
			s.pageName = WSA.omniturePageMap.prefix + ":" + WSA.omniturePageMap[this.page].channel;
			if(WSA.omniturePageMap[this.page].pageName != "") {
				s.pageName += ":" + WSA.omniturePageMap[this.page].pageName;
				s.prop4 = WSA.omniturePageMap[this.page].pageName;
			}
			else{
				s.prop4 = WSA.omniturePageMap[this.page].channel;
			}
			s.channel = WSA.omniturePageMap.prefix + ":" + WSA.omniturePageMap[this.page].channel;			
			s.prop5 = WSA.omniturePageMap[this.page].prop5;
			if(this.page == "3060239011") s.event13 = "event13";
			this.submitOmniture = true;
		}
		else if(jQuery("body").attr("id") == "pageId0") {
			s.pageName = WSA.omniturePageMap.prefix + ":" + WSA.omniturePageMap["home"].pageName;
			s.channel = WSA.omniturePageMap.prefix + ":" + WSA.omniturePageMap["home"].channel;
			s.prop4 = WSA.omniturePageMap["home"].prop4;
			s.prop5 = WSA.omniturePageMap["home"].prop5;
			this.submitOmniture = true;
		}
		s.eVar16 = WSA.omniturePageMap.eVar16;
	}	
}
WSA.omnitureFlush = {
    init : function() {
        s_code = s.t();
		if (s_code) {
			document.write(s_code);
		}
    }
};

jQuery(document).ready(function() {
	WSA.mapURI.init();
	jQuery(".pricingLayout .wsOnly, .pricingLayout .wsStartSelling, .pricingLayout .bottom2").click(function(){
	  s.products = ";webstore";
	  s.scAdd = "scAdd";
	  WSA.omnitureFlush.init();
	});
	jQuery(".pricingLayout .wsSoaFba, .pricingLayout .allStartSelling, .pricingLayout .bottom4, .newBoxMain .gsnButton").click(function(){
	  s.products = ";webstore_am_fba";
	  s.scAdd = "scAdd";
	  WSA.omnitureFlush.init();
	});		
	if(WSA.mapURI.submitOmniture) WSA.omnitureFlush.init();	
});
