/** This function populates "s" with data stored in the omniData array
 *  defined below.
 */
 
//omniture.js 2.0
function populateOmnitureStructure() {
	s.server = omniData['server'];
	s.pageType = omniData['pageType'];
	// only used for 404 pages
	// override the pageName if set explicitely. Use the plugin function instead
	if (omniData['pageName'] != null) {
		s.pageName = omniData['pageName'];
	} else {
		s.pageName = s.getPageName();
	}

	// Channels
	s.channel = omniData['channel'];
	s.prop1 = omniData['prop1'];
	s.prop2 = omniData['prop2'];
	s.prop3 = omniData['prop3'];
	s.prop4 = omniData['prop4'];
	s.prop5 = omniData['prop5']; //referrer

	s.prop6 = "";	// set in s_code.js | prop6 = All Playoff Tab Selection Report
	s.prop7 = "";	// set in s_code.js | prop7 = Playoff T1 Tab Selection Report
	s.prop8 = "";	// set in s_code.js | prop8 = Playoff FEC Tab Selection Report
	s.prop9 = "";	// set in s_code.js | prop9 = Playoff Live@ Tab Selection Report
	s.prop10 = "";	
	// undefined

	// standalone properties
	s.prop11 = omniData['articleTitle'];
	s.prop12 = omniData['articleAuthor'];
	s.prop13 = omniData['articleDate'];
	s.prop14 = omniData['regUserFlag'];
	s.prop15 = omniData['year'];
	s.prop16 = omniData['tourCode'];
	s.prop17 = omniData['tournId'];
	s.prop18 = omniData['playerId'];
	s.prop19 = omniData['regUserId'];

	s.prop20 = omniData['majorPageType'];
	s.prop21 = omniData['specificPageType'];
	s.prop22 = omniData['playersHighlighted'];
	s.prop23 = s.getQueryParam('loc');
	// populate the link location property
	s.prop24 = omniData['tourCastUser'];

	s.prop25 = omniData['courseId'];
	s.prop26 = omniData['statId'];

	// populate the campain
	s.campaign = s.getQueryParam('pgat_cid');

	// search string if available
	s.eVar3 = s.getQueryParam('search_string');
}


var omniData = new Array();
omniData = {
	path: null, // set automatically but we aren't sending to omniture
	server: null, // set automatically
	pageType: null, // only for 404 page
	pageName: null, // will be set by s.getPageName, can be overridden

	channel: null,
	prop1: null,
	prop2: null,
	prop3: null,
	prop4: null,
	prop5: null,

	majorPageType: null,
	specificPageType: null,

	articleTitle: null, // prop11
	articleAuthor: null, // prop12
	articleDate: null, // prop13

	year: null,
	tourCode: null,
	tournId: null,
	courseId: null,
	playerId: null,
	primaryTour: null,
	statId: null,
	holeNo: null,

	regUserFlag: null, // prop14, either "Registered" or "Casual"
	regUserId: null,
	tourCastUser: null,

	playersHighlighted: null
};

/* Player related pages */
var PLAYERS = "Players";
var PAGE_PLAYERSHOMEPAGE = "Players Homepage";
var PLAYER_PROFILE = "Profile";
var PLAYER_MEDIAGUIDE = "Media Guide";
var PLAYER_STREAKS = "Streaks";
var PLAYER_CAREER = "Career Details";
var PLAYER_STATS = "Stats";
var PLAYER_RESULTS = "Results";
var PLAYER_ARCHIVEDSCORECARDS = "Archived scorecards";
var PLAYER_SCORECARD = "Scorecard";
// resides under r: Tournaments: r023: scorecards
var NO_PRIMARY_TOUR = "x";

/* Tournament related pages. */
var TOURNAMENTS = "Tournaments";
var TOURNAMENTCENTRAL = "Tournament-Central";
var EXPLORETHECOURSE = "Explore the Course";
var LEADERBOARD = "Leaderboard";
var LB_MAIN = "Main";
var LB_ALT = "Alt";

var MAJORS = "Majors";
var GENERAL_CONTENT = "General content";
var HOMEPAGE = "Homepage";
var SPECIAL_EVENTS = "Special events";
var WRITERS = "Writers";
var FANTASY = "Fantasy";
var PLAYOFFS = "Playoffs";
var MEMBERSVCS = "Member Services";

// sets path variable
// we don't send this to omniture but we use it
omniData['path'] = ( document.URL ).replace(/https?:\/\/([^\/]+)/, "");
omniData['path'] = ( omniData['path'] ).replace(/\/\//, "/");
if (omniData['path'].charAt(omniData['path'].length - 1) == "/") omniData['path'] += "index.html";
// make sure there's always a filename
if (omniData['path'].charAt(omniData['path'].length - 1) == "#") {
	omniData['path'] = omniData['path'].substr(0, omniData['path'].length - 1);
}  // take off any # from a href="#" links
var path_array = ( omniData['path'].substr(1) ).split("/");



// START FILLING ARRAY WITH CONTENT

// sets server variable
omniData['server'] = window.location.host;


/******************************
 START CATEGORIZING
 ******************************/

// www.pgatour.com
if ((omniData['server'] == "www.pgatour.com") || (omniData['server'] == "pgatour.com")) {

	// first check the homepage, as this page is probably viewed most often
	if (path_array[0] == 'index.html') {
		omniData['tourCode'] = "r";
//		omniData['tourCode'] = translateTourCode(omniData['tourCode']);
		omniData['channel'] = HOMEPAGE;
		omniData['prop1'] = HOMEPAGE;

		s.hier1 = omniData['tourCode'] + "/TOUR Home Page";
		s.hier2 = "Home Pages/" + omniData['tourCode'];
	}

	// tournaments
	else if (path_array[0] == 'tournaments') {

		// regular tournaments
		if (isRegularTournament(path_array[1])) {
			// the second level is the tourcode and tournId
			omniData['tourCode'] = path_array[1].substring(0, 1);
//			omniData['tourCode'] = translateTourCode(omniData['tourCode']);
			omniData['tournId'] = path_array[1].substring(1);

			omniData['channel'] = omniData['tourCode'];
			omniData['prop1'] = TOURNAMENTS;
			omniData['prop2'] = omniData['tournId'];
			s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/Homepage";
			
			// check the individual pages
			/*if (path_array[2].equals ('index.html') {
					omniData['prop3'] = TOURNAMENTHOMEPAGE;
				  }
				  else {*/
			// remove .html for pages that are not in a subdirectory (news, results, teetimes)
			var tmpString = path_array[2];
			var tmpLength = tmpString.length;
			if (tmpLength >= 5 && tmpString.substring(tmpLength - 5) == '.html') {
				omniData['prop3'] = tmpString.substring(0, tmpLength - 5);
			} else {
				omniData['prop3'] = path_array[2];
			}
			//}

			if (path_array[2] == 'tee-times.html') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Tee Times";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Live Scoring/Tee Times";
			} else if (path_array[2] == 'field') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Field";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Live Scoring/Field"				
			} else if (path_array[2] == 'local-info.html') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Tournament Pages/Local Info";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/Local Info";				
			} else if (path_array[2] == 'course.html') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Tournament Pages/Course";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/Course";				
			} else if (path_array[2] == 'tickets.html') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Tournament Pages/Tickets";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/Tickets";				
			} else if (path_array[2] == 'sponsors.html') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Tournament Pages/Sponsors";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/Sponsors";				
			} else if (path_array[2] == 'news') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Tournament Pages/News";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/News";			
			} else if (path_array[2] == 'schedule.html') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Tournament Pages/Schedule";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/Schedule";							
			} else if (path_array[2] == 'charity.html') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Tournament Pages/Charity";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/Charity";				
			} else if (path_array[2] == 'results') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Tournament Pages/Results";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/Results";				
			} else if (path_array[2] == 'winners.html') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Tournament Pages/Winners";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/Winners";				
			} else if (path_array[2] == 'volunteer-info.html') {
				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Tournament Pages/Volunteer Info";
				s.hier2 = omniData['tourCode'] + "/" + omniData['tournId'] + "/Tournament Pages/Volunteer Info";				
			}
		}

		// handle other tournaments differently
		else {
			// Majors: US Open, The Masters, PGA Championship, British open (the open championship)
			if (path_array[1] == 'usopen') {
				omniData['channel'] = MAJORS;
				omniData['prop1'] = 'U.S. Open';
			}
			else if (path_array[1] == 'britishopen') {
				omniData['channel'] = MAJORS;
				omniData['prop1'] = 'British Open';
			}
			else if (path_array[1] == 'pgachampionship') {
				omniData['channel'] = MAJORS;
				omniData['prop1'] = 'The PGA Championship';
			}
			else if (path_array[1] == 'masters') {
				omniData['channel'] = MAJORS;
				omniData['prop1'] = 'The Masters';
			}


			// other special tournaments
			else if (path_array[1] == 'theplayers') {
				omniData['channel'] = SPECIAL_EVENTS;
				omniData['prop1'] = 'The Players';
			}
			else if (path_array[1] == 'presidentscup') {
				omniData['channel'] = SPECIAL_EVENTS;
				omniData['prop1'] = 'Presidents Cup';
			}
			else if (path_array[1] == 'rydercup') {
				omniData['channel'] = SPECIAL_EVENTS;
				omniData['prop1'] = 'Ryder Cup';
			}
			// PENDING: this list is not complete, ryder cup for example is missing!
		}
	}

	// players
	else if ((path_array[0] == 'players') && (!(typeof playerId == 'undefined'))) {
		// get the player id
		omniData['playerId'] = playerId;
		//getPlayerIdFromPath (1);
		omniData['primaryTour'] = primaryTour;
		if (! (typeof year == 'undefined')) {
			omniData['year'] = year;
		}

		omniData['channel'] = getChannelForPlayer();
		omniData['prop1'] = PLAYERS;
		omniData['prop2'] = omniData['playerId'];

		if (path_array[4] == 'index.html') {
			omniData['prop3'] = PLAYER_PROFILE;

			s.hier1 = omniData['primaryTour'] + "/Players/" + omniData['playerId'] + "/Profile";
			s.hier2 = omniData['primaryTour'] + "/Profile/" + omniData['playerId'];
			s.hier3 = omniData['primaryTour'] + "/" + omniData['playerId'] + "/Profile";
		}
		else if (path_array[4] == 'media-guide.html') {
			omniData['prop3'] = PLAYER_MEDIAGUIDE;

			s.hier1 = omniData['primaryTour'] + "/Players/" + omniData['playerId'] + "/Media Guide";
			s.hier2 = omniData['primaryTour'] + "/Media Guide/" + omniData['playerId'];
			s.hier3 = omniData['primaryTour'] + "/" + omniData['playerId'] + "/Media Guide";
		}
		else if (path_array[4] == 'streaks') {
			omniData['prop3'] = PLAYER_STREAKS;

			if (! (typeof year == 'undefined')) {
				s.hier1 = omniData['primaryTour'] + "/Players/" + omniData['playerId'] + "/Streaks/" + year;
				s.hier2 = omniData['primaryTour'] + "/Streaks/" + year + "/" + omniData['playerId'];				
				s.hier3 = omniData['primaryTour'] + "/" + omniData['playerId'] + "/Streaks/" + year;
			}
		}
		else if (path_array[4] == 'career') {
			omniData['prop3'] = PLAYER_CAREER;

			if (! (typeof year == 'undefined')) {
				s.hier1 = omniData['primaryTour'] + "/Players/" + omniData['playerId'] + "/Career Details/" + year;
				s.hier2 = omniData['primaryTour'] + "/Career Details/" + year + "/" + omniData['playerId'];								
				s.hier3 = omniData['primaryTour'] + "/" + omniData['playerId'] + "/Career Details/" + year;
			}
		}
		else if (path_array[4] == 'stats') {
			omniData['prop3'] = PLAYER_STATS;

			if (! (typeof year == 'undefined')) {
				s.hier1 = omniData['primaryTour'] + "/Players/" + omniData['playerId'] + "/Stats/" + year;
				s.hier2 = omniData['primaryTour'] + "/Stats/" + year + "/" + omniData['playerId'];												
				s.hier3 = omniData['primaryTour'] + "/" + omniData['playerId'] + "/Stats/" + year;
			}
		}
		else if (path_array[4] == 'results') {
			omniData['prop3'] = PLAYER_RESULTS;

			if (! (typeof year == 'undefined')) {
				s.hier1 = omniData['primaryTour'] + "/Players/" + omniData['playerId'] + "/Results/" + year;
				s.hier2 = omniData['primaryTour'] + "/Results/" + year + "/" + omniData['playerId'];												
				s.hier3 = omniData['primaryTour'] + "/" + omniData['playerId'] + "/Results/" + year;
			}
		}

		else if (path_array[4] == 'fedexcup') {
			if (! (typeof year == 'undefined')) {
				s.hier1 = omniData['primaryTour'] + "/Players/" + omniData['playerId'] + "/FedExCup Performance/" + year;
				s.hier2 = omniData['primaryTour'] + "/FedExCup Performance/" + year + "/" + omniData['playerId'];																
				s.hier3 = omniData['primaryTour'] + "/" + omniData['playerId'] + "/FedExCup Performance/" + year;
			}
		}

		// Check scorecards
		else if (path_array[4] == 'scorecards') {
			if (path_array[5] == 'index.html') {
				omniData['prop3'] = PLAYER_ARCHIVEDSCORECARDS;
			}
			else {
				// scorecard is taken as part of tournaments, not of the player
				omniData['year'] = path_array[5];
				omniData['tourCode'] = path_array[6].substring(0, 1);
				omniData['tournId'] = path_array[6].substring(1, 4);

				omniData['channel'] = omniData['tourCode'];
				omniData['prop1'] = TOURNAMENTS;
				omniData['prop2'] = omniData['tournId'];
				omniData['prop3'] = PLAYER_SCORECARD;

				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Scorecards/" + omniData['playerId'];
				s.hier2 = "Live Scoring/Scorecards/" + omniData['tournId'] + "/" + omniData['playerId'];				
				s.hier3 = omniData['tourCode'] + "/" + omniData['playerId'] + "/Scorecards/" + omniData['year'] + "/" + omniData['tournId'];
			}
		}
	}

	else if (path_array[0] == 'leaderboards') {
		omniData['year'] = path_array[1];
		omniData['tourCode'] = path_array[2].substring(0, 1);
//		omniData['tourCode'] = translateTourCode(omniData['tourCode']);
		omniData['tournId'] = path_array[2].substring(1);

		omniData['channel'] = omniData['tourCode'];
		omniData['prop1'] = TOURNAMENTS;
		omniData['prop2'] = omniData['tournId'];
		omniData['prop3'] = LEADERBOARD;

		if (path_array[3] == 'index.html') {
			omniData['prop4'] = LB_MAIN;

			s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Leaderboards/Main Leaderboard";
			s.hier2 = "Live Scoring/Leaderboards/Main Leaderboard" + "/" + omniData['tourCode'] + "/" + omniData['tournId'];									
		} else {
			omniData['prop4'] = LB_ALT;

			s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Leaderboards/Alt Leaderboard";
			s.hier2 = "Live Scoring/Leaderboards/Alt Leaderboard" + "/" + omniData['tourCode'] + "/" + omniData['tournId'];									
		}
	}

	else if (path_array[0] == 'tournament-central') {
		setTournamentCentralVariables();

		omniData['channel'] = omniData['tourCode'];
		omniData['prop1'] = TOURNAMENTS;
		omniData['prop2'] = omniData['tournId'];
		omniData['prop3'] = TOURNAMENTCENTRAL;

		s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Tournament Central";
		s.hier2 = "Live Scoring/Tournament Central/" + omniData['tourCode'] + "/" + omniData['tournId'];

	}

	else if (path_array[0] == 'courses') {
		setCourseVariables();

		omniData['channel'] = omniData['tourCode'];
		omniData['prop1'] = TOURNAMENTS;
		omniData['prop2'] = omniData['tournId'];
		omniData['prop3'] = EXPLORETHECOURSE;
		//omniData['prop4'] = omniData['courseId'];

		if (path_array[2] == 'index.html') {
			s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Explore the Course/Course Overview";
			s.hier2 = "Live Scoring/Explore the Course/Course Overview" + "/" + omniData['tournId'];			
		} else {
			s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Explore the Course/Holes/Hole " + holeNo;
			s.hier2 = "Live Scoring/Explore the Course/Holes/Hole " + holeNo + "/" + omniData['tournId'];			
		}
	}

	// check the tour specific pages
	else if (path_array[0] == 'r' || path_array[0] == 's' || path_array[0] == 'h') {
		omniData['tourCode'] = path_array[0];

		// homepages
		if (path_array[1] == 'index.html') {
			omniData['channel'] = HOMEPAGE;
			omniData['prop1'] = HOMEPAGE;

			s.hier1 = omniData['tourCode'] + "/TOUR Home Page";
			s.hier2 = "Home Pages/" + omniData['tourCode'];
		}

		else if (path_array[1] == 'schedule') {
			omniData['channel'] = path_array[0];
			omniData['prop1'] = "Schedule";

			s.hier1 = omniData['tourCode'] + "/TOUR Schedule Page"
			s.hier2 = "Schedule Pages/" + omniData['tourCode'];
		}

		else if (path_array[1] == 'players') {
			omniData['channel'] = path_array[0];
			omniData['prop1'] = PLAYERS;
			omniData['prop2'] = "Players Homepage";

			s.hier1 = omniData['tourCode'] + "/Players/Player Index Page"
		}

		else if (path_array[1] == 'leaderboard') {
			setLeaderboardVariables();

			omniData['channel'] = path_array[0];
			omniData['prop1'] = TOURNAMENTS;
			omniData['prop2'] = omniData['tournId'];
			omniData['prop3'] = LEADERBOARD;

			if (path_array[2] == 'index.html') {
				omniData['prop4'] = LB_MAIN;

				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Leaderboards/Main Leaderboard";
				s.hier2 = "Live Scoring/Leaderboards/Main Leaderboard" + "/" + omniData['tourCode'] + "/" + omniData['tournId'];
			} else {
				omniData['prop4'] = LB_ALT;

				s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Leaderboards/Alt Leaderboard";
				s.hier2 = "Live Scoring/Leaderboards/Alt Leaderboard" + "/" + omniData['tourCode'] + "/" + omniData['tournId'];		
			}
		}

		else if (path_array[1] == 'tournament-central') {
			setTournamentCentralVariables();

			omniData['channel'] = omniData['tourCode'];
			omniData['prop1'] = TOURNAMENTS;
			omniData['prop2'] = omniData['tournId'];
			omniData['prop3'] = TOURNAMENTCENTRAL;

			s.hier1 = omniData['tourCode'] + "/Tournaments/" + omniData['tournId'] + "/Live Scoring/Tournament Central";
			s.hier2 = "Live Scoring/Tournament Central/" + omniData['tourCode'] + "/" + omniData['tournId'];		
		}

		else if (path_array[1] == 'stats') {
			setStatsVariables();
	
			omniData['channel'] = "Stats";
			omniData['prop1'] = omniData['statId'];
			s.hier2 = "Home Pages/" + omniData['tourCode'];

			if (path_array[2] == 'current') {
				s.hier1 = omniData['tourCode'] + "/Stats/Stats Recap";
				s.hier2 = "Stats/Stats Recap/" + omniData['tourCode'];
			} else if (statId == 'index') {
				s.hier1 = omniData['tourCode'] + "/Stats/Stats Index";
				s.hier2 = "Stats/Stats Index/" + omniData['tourCode'];
			} else {
				s.hier1 = omniData['tourCode'] + "/Stats/" + omniData['statId'] + "/" + omniData['year'];
				s.hier2 = "Stats/" + omniData['statId'] + "/" + omniData['tourCode'] + "/" + omniData['year'];
			}
		}

	}

	// writers
	else if (path_array[0] == 'writers') {
		omniData['channel'] = "Writers";
		omniData['prop1'] = path_array[1];
	}

	//Team Nationwide
	else if(path_array[0] == 'teamnationwide'){
		omniData['channel'] == "Team Nationwide";
		omniData['prop1'] == "Team Nationwide"
		omniData['prop2'] == path_array[1];
	}
	
	// FedExCup
	else if (path_array[0] == 'fedexcup') {
		omniData['channel'] = "FedExCup";
		omniData['prop1'] = "FedExCup";
	}

	// tourCast
	else if (path_array[0] == 'tourcast') {
		omniData['channel'] = "TourCast";
		omniData['prop1'] = "TourCast";
		omniData['prop2'] = path_array[1];
		omniData['prop3'] = path_array[2];
		s.hier2 = "TOURCast"
	}
	
	// playoffs
	else if (path_array[0] == 'playoffs'){
		omniData['channel'] = PLAYOFFS;
		omniData['prop1'] = PLAYOFFS;
		omniData['prop2'] = path_array[1];
		omniData['prop3'] = path_array[2];
	}
	/*else if (path_array[0] == 'video' && path_array[1] == 'player'){ //tracking video page views
		var videoURL = s.getQueryParam('url').toString();
		var videoURLArray = videoURL.split("/");
		var vidL = videoURLArray.length;
		var i = 2; //start at 1 to get rid of the extra 'video'
		for (i; i < vidL; i++){
			if(i == 2) {videoURL = "pgatour" + ":" + videoURLArray[2];}
			else {videoURL = videoURL + ":" + videoURLArray[i];}
		}

		omniData['channel'] = "VIDEO PLAYER";
		omniData['pageName'] = videoURL;
	}*/
	
	//Playoffs Live@ Player
	else if (path_array[0] == 'video' && path_array[1] == 'liveat'){
		omniData['channel'] = "LIVEAT (Playoffs)";
		omniData['prop1'] = "LIVEAT (Playoffs)";
		omniData['prop2'] = s.getQueryParam('tyr');
		omniData['prop3'] = s.getQueryParam('tid');
		omniData['pageName'] = "pgatour" + ":" + path_array[1] + ":" + "playoffs" + ":" + omniData['prop2']+ ":" + omniData['prop3'];
	}
	
	// other pages
	else {
		omniData['channel'] = GENERAL_CONTENT;
		omniData['prop1'] = path_array[0];
		omniData['prop2'] = path_array[1];
		omniData['prop3'] = path_array[2];

		s.hier1 = "General Content";
	}
	
	// capture the story attribute
	// NOTE: CMS needs to generate these
	if (typeof PGAArticleTitle != 'undefined') {
		omniData['articleTitle'] = PGAArticleTitle;
	}
	if (typeof PGAArticleAuthor != 'undefined') {
		omniData['articleAuthor'] = PGAArticleAuthor;
	}
	if (typeof PGAArticleDate != 'undefined') {
		omniData['articleDate'] = PGAArticleDate;
	}

}

// Search
else if (omniData['server'] == "search.pgatour.com") {
	//Player Search Vars
	omniData['channel'] = 'Player Search';
	omniData['tourCode'] = s.getQueryParam('tourCode');

	//Internal Search Vars
/*	var searchQuery = s.getQueryParam('query');
	
	searchQuery = unescape(searchQuery); //decodes characters [like %20 to a space, or %22 to a double-quote (")]
	searchQuery.replace('+',' '); //replace '+' with a space
	searchQuery.replace('"',''); //removes '"'
	
	//set eVar3 to the search query
	s.eVar3 = searchQuery;
*/	
}

else if (omniData['server'] == "fantasy.pgatour.com") {
	omniData['channel'] = "FANTASY";
	omniData['prop1'] = path_array[0];
	omniData['prop2'] = path_array[1];
	omniData['prop3'] = path_array[2];

}

else if (omniData['server'] == "fantasy2.pgatour.com") {
	omniData['channel'] = "FANTASY";
	omniData['prop1'] = path_array[0];
	omniData['prop2'] = path_array[1];
	omniData['prop3'] = path_array[2];

}

//Majors microsites
else if (omniData['server'] == "golfsurround.com" || omniData['server'] == "www.golfsurround.com" || omniData['server'] == "www.pga.com" || omniData['server'] == "pga.com") {
	//Masters
	if (path_array[0] == 'masters') {
		omniData['channel'] = "MAJORSMICRO";
		omniData['prop1'] = path_array[0];
		omniData['prop2'] = path_array[1];
		omniData['prop3'] = path_array[2];
		omniData['prop4'] = path_array[3];
	}
	//U.S. Open
	else if (path_array[0] == 'usopen') {
		omniData['channel'] = "MAJORSMICRO";
		omniData['prop1'] = path_array[0];
		omniData['prop2'] = path_array[1];
		omniData['prop3'] = path_array[2];
		omniData['prop4'] = path_array[3];
	}
	//British Open
	else if (path_array[0] == 'openchampionship') {
		omniData['channel'] = "MAJORSMICRO";
		omniData['prop1'] = path_array[0];
		omniData['prop2'] = path_array[1];
		omniData['prop3'] = path_array[2];
		omniData['prop4'] = path_array[3];
	}
	//PGA Championship
	else if (path_array[0] == 'pgachampionship') {
		omniData['channel'] = "MAJORSMICRO";
		omniData['prop1'] = path_array[0];
		omniData['prop2'] = path_array[1];
		omniData['prop3'] = path_array[2];
		omniData['prop4'] = path_array[3];
	}
}

else if (omniData['server'].substr(omniData['server'].length-7,7) == "pga.com"){

	// for liveat
	// here's the URL patterns:
	//pga3w1 and pga8w1
	//*.pga.com/liveat/2007/r005/pipeline/*

	if (path_array[0] == "liveat") {
		omniData['channel'] = "LIVEAT";
		omniData['prop1'] = path_array[1];
		omniData['prop2'] = path_array[2];
		omniData['pageName'] = "liveat" + ":" + path_array[1] + ":" + path_array[2];
	}
		
}
else if (omniData['server'].substr(omniData['server'].length-11,11) == "pgatour.com"){
	omniData['channel'] = 'GENERAL_CONTENT';
	omniData['prop1'] = omniData['server'];
}


//Members Services
if (omniData['server'] == "audience.pgatour.com") {
	omniData['channel'] = MEMBERSVCS;
	omniData['prop1'] = path_array[0];
	omniData['prop2'] = path_array[1];
	omniData['prop3'] = path_array[2];
	omniData['prop4'] = path_array[3];	
}

 

// Cookie based information
readCookiesInformation();


/******************************
 SETTING FUNCTIONS
 ******************************/

/** Sets the tournament central variables year, tourCode, tournId and courseId.
 * Those variables are generated and inserted into the page header.
 * 
 * Note that this function has to be called at the end of the page, not from
 * htmlHead (as this is inserted before the generated javascript)    
 */
function setTournamentCentralVariables() {
	omniData['year'] = currentYear;
	omniData['tourCode'] = tourCode;
	omniData['tournId'] = tournId;
	omniData['courseId'] = courseId;
}

/** Sets the leaderboard variables year, tourCode, and tournId
 * Those variables are generated and inserted into the page header.
 *
 */
function setLeaderboardVariables() {/*
	omniData['year'] = lb_year;
	omniData['tourCode'] = lb_tour;
	omniData['tournId'] = lb_tournId
	*/
}

function setCourseVariables() {
	omniData['year'] = year;
	omniData['tourCode'] = tourCode;
	omniData['tournId'] = tournId;
	omniData['courseId'] = courseId;
	if (! (typeof holeNo == 'undefined')) {
		omniData['holeNo'] = holeNo;
	}
}

function setStatsVariables() {
	omniData['tourCode'] = tourCode;
	omniData['year'] = year;
	omniData['statId'] = statId;
}

/** Reads all cookie related information into omniData. */
function readCookiesInformation() {

	// regUserFlag and regUserId
	var authid = getCookieValue("authid");
	omniData['regUserFlag'] = (authid != null) ? 'Registered' : 'Casual';
	omniData['regUserId'] = authid;

	// check highlighted players
	var lb_saved_highlights = getCookieValue("lb_saved_highlights");
	var lb_highlights = getCookieValue("lb_highlights");
	omniData['playersHighlighted'] = (lb_saved_highlights != null || lb_highlights != null) ?
									 'Has Highlighted Players' : 'No Highlighted Players';

	// check whether the user signed into tourcast
	var pid = getCookieValue("pid");
	omniData['tourCastUser'] = (pid != null) ? "TOURCast User" : "Non TOURCast User";
}

function getCookieValue(searchName) {
	var cookies = document.cookie.split( ';' );
	var cookieHolder = '';
	var cookieName = '';
	var cookieValue = '';
	var cookieFound = false;
	for ( i = 0; i < cookies.length; i++ )
	{
		cookieHolder = cookies[i].split( '=' );
		cookieName = cookieHolder[0].replace(/^\s+|\s+$/g, '');	
		if ( cookieName == searchName )
		{
			cookieFound = true;
			cookieValue = unescape( cookieHolder[1].replace(/^\s+|\s+$/g, '') );
			return cookieValue;
			break;
		}
		cookieHolder = null;
		cookieName = '';
	}
	if ( !cookieFound )
	{
		return null;
	}
}


/******************************
 HELPER FUNCTIONS
 ******************************/

/* Returns either the primary tour or x if the player doens't have
 * a primary tour.
 */
function getChannelForPlayer() {
	if (omniData['primaryTour'] != null) {
		return omniData['primaryTour'];
	} else {
		return NO_PRIMARY_TOUR;
	}
}

/** Returns true if the passed tournament identifier is a standard one
 * in the form of r023
 */
function isRegularTournament(name) {
	if (name.length != 4) {
		return false;
	}
	var tourCode = name.substring(0, 1);
	if (! (tourCode == 'r' || tourCode == 's' || tourCode == 'h')) {
		return false;
	}
	var id = parseInt(name.substring(1, 4));
	return (id != 0 && id != NaN);
}

/** Returns the five digit player id given from the path variable
 * The function starts at index in the path array to get the
 * three times two digits.
 */
function getPlayerIdFromPath(index) {
	// PENDING: make array index and content checks!
	return path_array[index].substring(1, 2) + path_array[index + 1] + path_array[index + 2];
}

/** Send microdata information
*
*
*/
function omniTrackLink(linkName) {
	var link_s = s_gi(s_account);
	link_s.linkTrackVars="None";
	link_s.linkTrackEvents="None";
	link_s.tl(this,'o',linkName);
}

/************************************
 *******  REFERRER FUNCTIONS ********
 ************************************/

function pageQuery( q ) {
 if( q.length > 1 ) this.q = q.substring( 1, q.length );
 else this.q = null;
 this.keyValuePairs = new Array();
 if( q ) {
  for( var i = 0; i < this.q.split( "&" ).length; i++ ) {
   this.keyValuePairs[i] = this.q.split( "&" )[i];
  }
 }
 this.getKeyValuePairs = function() { return this.keyValuePairs; }
 this.getValue = function( s ) {
  for( var j = 0; j < this.keyValuePairs.length; j++ ) {
   if( this.keyValuePairs[j].split( "=" )[0] == s )
   return this.keyValuePairs[j].split( "=" )[1];
  }
  return false;
 }
 this.getParameters = function() {
  var a = new Array( this.getLength() );
  for( var j = 0; j < this.keyValuePairs.length; j++ ) {
   a[j] = this.keyValuePairs[j].split( "=" )[0];
  }
  return a;
 }
 this.getLength = function() { return this.keyValuePairs.length; } 
}

function queryString( key ){
 var page = new pageQuery( window.location.search ); 
 return unescape( page.getValue( key ) ); 
}
