/* DO NOT CHANGE THIS - START */
PageType = {
	Home: "Home", 
	News: "News", 
	Biography: "Biography",
	SignUp: "SingUp", 
	Videos: "Videos", 
	Disco: "discography",
	Events: "Events", 
	PhotoGallery: "Photos", 
	Forums: "Forums",
	UserGeneratedContent: "from the user", 
	Blog: "from the artist", 
	Journal: "from the artist",
	ArtistInterview: "from the artist", 
	Links: "Links", 
	NonCommercialMusicDownload: "Music promo downloads",
	NonCommercialOtherDownload: "other promo downloads", 
	MembersOnly: "Member area", 
	Games: "interactive",
	Poll: "interactive", 
	Competitions: "interactive", 
	Shop: "Shop",
	Newsletter: "sign up start", 
	Registration: "sign up start", 
	DataCaptureStart: "sign up start",
	DataCaptureEnd: "sign up end", 
	Other: "Other", 
	Diary: "Diary",
	Mobile: "Mobile"
};
/* DO NOT CHANGE THIS - END */

/*  Channel and Page Id mapping with page type */
Mapping = [
	{Channel: 1,	Page: 0, 	GAPageName: PageType.Home},
	{Channel: 3,	Page: 12, 	GAPageName: PageType.Registration},
	{Channel: 3, 	Page: 0, 	GAPageName: PageType.Videos},
	{Channel: 4, 	Page: 0, 	GAPageName: PageType.Disco},
	{Channel: 5, 	Page: 0, 	GAPageName: PageType.News},
	{Channel: 19, 	Page: 0, 	GAPageName: PageType.News},
	{Channel: 6, 	Page: 0, 	GAPageName: PageType.Biography},
	{Channel: 7, 	Page: 0, 	GAPageName: PageType.NonCommercialMusicDownload},
	{Channel: 8, 	Page: 0, 	GAPageName: PageType.Photos},
	{Channel: 16, 	Page: 0, 	GAPageName: PageType.Shop},
	{Channel: 9, 	Page: 9, 	GAPageName: PageType.Registration},
	{Channel: 9, 	Page: 0,	GAPageName: PageType.DataCaptureStart}
];

GXPGAIntegration = {
	GetParameterAt : function(pos){
		var querystring = document.location.search.split(",");
		if (querystring.length > pos)
			return querystring[pos];
		else
			return null;
	},
	
	GetChannel : function(){
		if (document.location.href.indexOf("hgxpp001") > -1){
			var chanId = this.GetParameterAt(1);
			if (chanId  && isFinite(chanId))
				return chanId;
		}
		return 1;
	},
	
	GetPage : function(){
		if (document.location.href.indexOf("hgxpp001") > -1){
			var pagId = this.GetParameterAt(2);
			if (pagId  && isFinite(pagId))
				return pagId;
		}
		return 0;
	},
	
	GetGAPageName : function(channel, page){
		for (var i = 0; i < Mapping.length; i++){
			if (Mapping[i].Channel == channel){
				if (Mapping[i].Page == page || Mapping[i].Page == 0)
					return Mapping[i].GAPageName;
			}
		}
		return "";
	},
	
	GetPageName : function(){
		return this.GetGAPageName(this.GetChannel(), this.GetPage());
	}
};
