// 	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-

var IE = (document.all) ? 1 : 0;
var DOM = (document.getElementById) ? 1 : 0;
var NS4 = (document.layers) ? 1 : 0;
var MAC = ((navigator.appVersion.indexOf("PPC") >0) || (navigator.appVersion.indexOf("Mac") >0)) ? 1 : 0;
var ua = '$User_Agent';
var OPERA = (ua.indexOf("Opera") > 0) ? 1 : 0;

var Browser = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) { if (dataString.indexOf(data[i].subString) != -1) return data[i].identity; }
			else if (dataProp) return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ string: navigator.userAgent, subString: "OmniWeb", versionSearch: "OmniWeb/", identity: "OmniWeb" },
		{ string: navigator.vendor, subString: "Apple", identity: "Safari" },
		{ prop: window.opera, identity: "Opera" },
		{ string: navigator.vendor, subString: "iCab", identity: "iCab" },
		{ string: navigator.vendor, subString: "KDE", identity: "Konqueror" },
		{ string: navigator.userAgent, subString: "Firefox", identity: "Firefox" },
		{ string: navigator.vendor, subString: "Camino", identity: "Camino" },
		{ string: navigator.userAgent, subString: "Netscape", identity: "Netscape" },
		{ string: navigator.userAgent, subString: "IE", identity: "Explorer", versionSearch: "MSIE" },
		{ string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv" },
		{ string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla" }
	],
	dataOS : [
		{ string: navigator.platform, subString: "Win", identity: "Windows" },
		{ string: navigator.platform, subString: "Mac", identity: "Mac" },
		{ string: navigator.platform, subString: "Linux", identity: "Linux" }
	]

};
Browser.init();



// Video Player detection variables
var agt = navigator.userAgent.toLowerCase();
var cnnSiteWideCurrDate = new Date();
var cnnHasOpenPopup = 0;

// *****************************************************************************
// 1.0 UTILITY FUNCTIONS
// *****************************************************************************
	
	function $(e) { return document.getElementById(e); }
	function show(e) { e.style.display = "block"; }
	function hide(e) { e.style.display = "none"; }
	function rand(lo,hi) { return Math.floor(Math.random()*(hi-lo+1))+lo; }
	function find(srch,str) { if (str.indexOf(srch)>=0) return true; else return false; }

	function printFriendly() {
		/* 
			The reason I didn't make this a popup is because it would be a cross browser 
			scripting issue: http://www.learningcircuits.org/2003/mar2003/
		*/	
		var outhtml = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
		outhtml += '<html lang="en">';
		outhtml += '<head></head>';
		outhtml += '<body style="background-color: white !important; background: none !important;" onload="window.print();">';
		outhtml += '<div style="padding: 10px; width: 700px;">';
		outhtml += '<div style="padding:15px; border-bottom: solid 2px black; margin-bottom: 10px;">';
		outhtml += '<div style="float:left; width: 350px;"><img src="http://i.pgatour.com/pgatour/.element/img/1.0/main/print_logo.gif" with="52" height="67" alt="PGA TOUR" align="left" /><span style="font-size 14pt;">PGA TOUR</span></div>';
		outhtml += '<div style="float:right; width: 350px; font-size: 12pt; text-align: right;"><a href="#" onclick="window.print();"><span style="font-size: 12pt;">Print Page</span></a>&nbsp|&nbsp;<a href="#" onclick="window.location.href = window.location.href;"><span style="font-size: 12pt;">Go Back</span></a></div>';
		outhtml += '<div style="clear:both;"></div>';
		outhtml += '</div>';
		outhtml += document.getElementById("tourPageContainer").innerHTML;
		outhtml += '</div>';
		outhtml += '</body>';
		outhtml += '</html>';
		document.write(outhtml);
		document.close();
	}
	
	// Get all cookies into array
	var cookie = new Array();
	var tmpArray = document.cookie.replace(/;\s+/g,';').split(';');
	for (var i = 0; i < tmpArray.length; i++) {
		var a = unescape(tmpArray[i]);
		var x = a.indexOf('=');
		if ( x != -1) cookie[a.substring(0, x)] = a.substring(x+1, a.length);
	}

	// set_cookie
	function set_cookie ( name, value, hours, path, domain, secure ) {
		if ( hours ) var numHours = ( new Date((new Date()).getTime()+hours*3600000) ).toGMTString();
		document.cookie = name+'='+escape(value)+((numHours)?(';expires='+numHours):'')+((path)?';path='+path:'')
			+((domain)?';domain='+domain:'')+((secure && (secure == true))?'; secure':'');
	}

	// read_cookie
	function readCookie ( name ) { return cookie[name]; }

	// kill cookie
	function kill_cookie ( name, path, domain ) {
		if ( cookie[name] ) document.cookie = name+'='+theValue+'; expires=Fri, 13-Apr-1970 00:00:00 GMT'
			+((path)?';path='+path:'')+((domain)?';domain='+domain:'');
	}

	// getElementsByClass
	function getElementsByClass(searchClass,tag,node) {
		var classElements = new Array();
		if ( node == null ) node = document;
		if ( tag == null ) tag = '*';
		var els = node.getElementsByTagName(tag);
		var elsLen = els.length;
		var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
		for (i = 0, j = 0; i < elsLen; i++) {
			if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; }
		}
		return classElements;
	}

	// getElementByClass
	function getElementByClass(searchClass,tag,node) {
		var classElements = new Array();
		if ( node == null ) node = document;
		if ( tag == null ) tag = '*';
		var els = node.getElementsByTagName(tag);
		var elsLen = els.length;
		var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
		for (i = 0, j = 0; i < elsLen; i++) {
			if ( pattern.test(els[i].className) ) { return els[i]; }
		}
		return false;
	}

	// get Param: returns URL query parameter of 'name'
	function getParam( name ) {
		var regexS = "[\\?&]"+name+"=([^&#]*)";
		var regex = new RegExp( regexS );
		var tmpURL = window.location.href;
		var results = regex.exec( tmpURL );
		if( results == null ) { return ""; } else { return results[1]; }
	}

	// MousePosition
	function MousePosition(e) {
		var posx = posy = 0;
		if (!e) var e = window.event;
		if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; }
		else if (e.clientX || e.clientY) 	{
			posx = e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
			posy = e.clientY+document.body.scrollTop+document.documentElement.scrollTop;
		}
		return [posx, posy];
	}

	// findPos
	function findPos(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
		}
		return [curleft,curtop];
	}

// 2.0 FORM INTERATION
// 	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-

	// LOGIN BOX OBJECT
	var networkRow = new Object();
	networkRow.userField = function( action, input ){
		if( action == 'focus' ){ input.className = 'userActive'; }
		else if ( action == 'blur' && ! input.value.length ) { input.className = 'userInactive'; }
	}
	networkRow.passwordField = function( action, input ){
		if( action == 'focus' ){ input.className = 'passActive'; }
		else if ( action == 'blur' && ! input.value.length ){ input.className = 'passInactive'; }
		return;
	}


// 3.0 NAVIGATION
// 	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-


	// CNN_openPopup
	function CNN_openPopup( url, name, widgets, openerUrl ) {
		var host = location.hostname;
		try { window.top.name = "opener"; } catch (e) {}
		var popupWin = window.open( url, name, widgets );
		if(popupWin) {cnnHasOpenPopup = 1;}
		if ( popupWin && popupWin.opener ) {
			if ( openerUrl ) { popupWin.opener.location = openerUrl; }
		}
		if ( popupWin) { popupWin.focus(); }
	}

	// LaunchVideo
	function LaunchVideo( videoPath ) {
		var videoDate = "";
		var cnnVideoDatePathRegExp = /(\d{4})\/(\d{2})\/(\d{2})/;
		var cnnVideoDatePathArray = cnnVideoDatePathRegExp.exec( videoPath );
		if ( cnnVideoDatePathArray ) {
			var originalDate = new Date( parseInt( cnnVideoDatePathArray[1] ), parseInt( cnnVideoDatePathArray[2] ) - 1, parseInt( cnnVideoDatePathArray[3] ) );
			var expireDate = new Date( originalDate.getTime()+( 7 * 24 * 60 * 60 * 1000 ) );
			var expireYear = new String( expireDate.getFullYear() );
			var expireMonth = new String( expireDate.getMonth()+1 );
			var expireDay = new String( expireDate.getDate() );
			if ( expireMonth.length < 2 ) { expireMonth = '0'+expireMonth; }
			if ( expireDay.length < 2 ) { expireDay = '0'+expireDay; }
			videoDate = expireYear+'/'+expireMonth+'/'+expireDay;
		}
		cnnVideo( 'play', '/video'+videoPath.substring( 0, ( videoPath.length - 1 ) ), videoDate );
	}

	function detectWindowsMedia() {
		pluginFound = detectPlugin( 'Windows Media' );
		if ( !pluginFound && detectWMPSupport() ) { pluginFound = true; }
		return pluginFound;
	}

	function detectWMPSupport(){
		var wmp64 = "MediaPlayer.MediaPlayer.1";
		var wmp7 = "WMPlayer.OCX.7";
		if((window.ActiveXObject && navigator.userAgent.indexOf('Windows') != -1) || window.GeckoActiveXObject) {
			if(createActiveXObject(wmp7)) return true;
			else {
				if(createActiveXObject(wmp64)) return true;
				else return false;
			}
		} else return false;
	}

	function createActiveXObject(id){
	  var error;
	  var control = null;
	  try {
		if (window.ActiveXObject) control = new ActiveXObject(id);
		else if (window.GeckoActiveXObject) control = new GeckoActiveXObject(id);
	  }
	  catch (error){;}
	  return control;
	}

	function detectPlugin() {
		var daPlugins = arguments;
		var pluginFound = false;
		if ( navigator.plugins && navigator.plugins.length > 0 ) {
			var pluginsArrayLength = navigator.plugins.length;
			for ( var pluginsArrayCounter = 0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
				var numFound = 0;
				for ( var namesCounter = 0; namesCounter < daPlugins.length; namesCounter++ ) {
					if ( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) ||
						(navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
						numFound++;
					}
				}
				if ( numFound == daPlugins.length ) { pluginFound = true; break; }
			}
		}
		return pluginFound;
	}

	function cnnVideo( mode, arg, expiration ) {
		var playerURL	 = '/video/player/player.html';
		var detectURL	 = '/video/player/detect.exclude.html';
		var noplugURL	 = '/video/player/pages/detection/noplugin.html';
		var expireURL	 = '/video/player/player.html';
		var openURL		 = detectURL;
		var cnnVideoArgs = '';
		if ( detectWindowsMedia() ) {
			var cnnPassedDetection = new String(cookie['cnnVidPlug']).toLowerCase();
			if ( cnnPassedDetection == "activex" || cnnPassedDetection == "native" ) { openURL = playerURL; }
		} else {
			openURL = noplugURL;
		}
		switch ( mode ) {
			case 'play':
				var cnnExpireDate = new Date( new Date().getTime() - 24*60*60*1000 );
				var dateStringRegExp = /^(\d{4})\/(\d{2})\/(\d{2})$/;
				var dateStringArray = dateStringRegExp.exec( expiration );

				if ( dateStringArray && expiration) {
					cnnExpireDate = new Date( dateStringArray[1], dateStringArray[2] - 1, dateStringArray[3] );
				} else {
					cnnExpireDate = cnnSiteWideCurrDate;
				}
				if ( cnnExpireDate.getTime() < cnnSiteWideCurrDate.getTime() ) {
					if ( cnnPassedDetection == "activex" || cnnPassedDetection == "native" ) { openURL = expireURL; }
					else { openURL = detectURL; }
					cnnVideoArgs = 'url=/video/player/static/404';
				} else { cnnVideoArgs = 'url='+arg; }
				break;
			case 'browse': cnnVideoArgs = 'section='+arg; break;
			default: cnnVideoArgs = 'section=/ALL'; break;
		}
		if(openURL.indexOf('http://')==-1) { openURL='http://www.pgatour.com'+openURL; }
		CNN_openPopup( openURL+'?'+cnnVideoArgs, 'CNNVideoPlayer', 'scrollbars=no,resizable=no,width=770,height=570' );
	}
	
	// LIVE@ Window Launcher
	function openLiveAt(args) {
		var playerURL	 = '/video/liveat/';
		var noplugURL	 = '/video/liveat/noplugin.html';
		var detectURL	 = '/video/liveat/detect.exclude.html';
		var openURL		 = detectURL;
		var cnnVideoArgs = '';
		
		/** ADS VARIABLES FOR PREROLL **/		
		var adEmasCookie = cookie['adDEmas'];
		NGUserIDCookieValue = NGUserIDCookie; // set by ads.pgatour.com
		if (NGUserIDCookieValue == null) { NGUserIDCookie = false; }
		args += "&NGUserID="+escape(NGUserIDCookieValue)+"&adDEmas="+escape(adEmasCookie);	
		
		if ( detectWindowsMedia() ) {
			var cnnPassedDetection = new String(cookie['cnnVidPlug']).toLowerCase();
			if ( cnnPassedDetection == "activex" || cnnPassedDetection == "native" ) { openURL = playerURL; }
		} 
		else { openURL = noplugURL; }
		
		// if(openURL.indexOf('http://')==-1) { openURL='http://www.pgatour.com'+openURL; }
		CNN_openPopup(openURL+'?'+ args,'900x710','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=900,height=710');
	}

	// gallery_popup
	function gallery_popup(galleryURL) {
		CNN_openPopup(galleryURL, 'gallery_popup', 'scrollbars=no,resizable=no,width=580,height=500');
	}

	// cnnOpen
	function cnnOpen( url ) {
		if (url) {
			lowerUrl = url.toLowerCase().replace(' ', '');
			if (lowerUrl.indexOf('/video/video') > -1 || lowerUrl.indexOf('/video/audio') > -1) { cnnVideo('play',url); }
			else if (lowerUrl.indexOf('/photos/20') > -1) { 
				CNN_openPopup(url, 'gallery_popup', 'scrollbars=no,resizable=no,width=754,height=620');
			}
			else if (lowerUrl.indexOf('/video/liveat/?') == 0) { openLiveAt(url.replace('/video/liveat/?', '')); }
			else if (lowerUrl == '/video') { cnnVideo('browse','/ALL'); }
			else { window.location = url; }
		}
	}
	// tourOpen
	function tourOpen( url ) { cnnOpen(url); }

// 4.0 PAGE ACTIONS
// 	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-

	// tourInitializeTabs
	function tourInitializeTabs (tabbox_id, level, start) {
		var sub = ''; if (tabbox_id.indexOf('Sub')!=-1) sub='Sub';
		var tabbox = $(tabbox_id);
		if (tabbox) {
			var headers = getElementsByClass('tour'+sub+'PaneTitle', 'h1', tabbox);

			var content = '';
			var tabClass = 'on';
			for (var j = 0; j < headers.length; j++ ) {
				var a_class = '';
				if (headers[j].className.indexOf('tour'+sub+'PaneTitle ') > -1) {
					a_class = headers[j].className.substr(14);
				}
				// modified for tournament tabs....
				if (tabDeactiveList && tourIsTabDormant(headers[j].innerHTML)) {
					content += '<div class="tour'+sub+'TabNull" class="'+a_class+'">'+headers[j].innerHTML+'</div>'
				}
				else {
					content += '<div class="tour'+sub+'Tab" onclick="tourOpenTab('+"'"+tabbox_id+"'"+', '+j+');" class="'+a_class+'">'+headers[j].innerHTML+'</div>';
				}
			}
			getElementByClass('tour'+sub+'Tabs', 'div', tabbox).innerHTML = content;
		}
		if (start) { tourOpenTab (tabbox_id, start); }
		else { tourOpenTab (tabbox_id, 0); }
	}

	// tourOpenTab
	function tourOpenTab ( tabbox_id, tab_number ) {
		var sub = ''; if (tabbox_id.indexOf('Sub')!=-1) sub='Sub';
		var node = $(tabbox_id);
		var tabs_node = getElementByClass('tour'+sub+'Tabs', 'div', node);
		var tabs = getElementsByClass('tour'+sub+'Tab', 'div', tabs_node);
		for (var i = 0; i < tabs.length; i++ ) {
			if ( i == tab_number ) { tabs[i].className = 'tour'+sub+'Tab on'; var _paneTitle = getElementByClass(tabs[i].className, 'div', tabs_node).innerHTML; }
			else if ( i == tab_number - 1 ) tabs[i].className = 'tour'+sub+'Tab left';
			else if ( i == tab_number+1 ) tabs[i].className = 'tour'+sub+'Tab right';
			else tabs[i].className = 'tour'+sub+'Tab off';
		}
		var panes = getElementsByClass('tour'+sub+'Pane', 'div', node);
		for (var i = 0; i < panes.length; i++ ) {
			if ( i == tab_number ) show(panes[i]);
			else hide(panes[i]);
		}
		populateImpressionVars (tabbox_id, _paneTitle);
	}

	function tourIsTabDormant(_tabContent) {
		var isTabDormant_ = false;
		for (var i=0; i< tabDeactiveList.length; i++) {
			if (_tabContent.indexOf(tabDeactiveList[i]) != -1) {
				isTabDormant_ = true;
				break;
			}
		}
		return isTabDormant_;
	}

	var tabDeactiveList = new Array();
	function tourPopulatateNullTabList(_tabName) {
		tabDeactiveList[tabDeactiveList.length] = _tabName;
	}

	// tourRenameTab
	function tourRenameTab ( tabbox_id, tab_number, tab_title ) {
		var sub = ''; if (tabbox_id.indexOf('Sub')!=-1) sub='Sub';
		var tabbox = $(tabbox_id);
		if (tabbox) {
			var headers = getElementsByClass('tour'+sub+'PaneTitle', 'h1', tabbox);
			headers[tab_number].innerHTML = tab_title;
		}
	}

	// Page setting for Tool Tips
	var tourTipAnchor = '';
	var tourTipX = 0;
	var tourTipY = 0;
	
	// tourShowTip
	function tourShowTip(item, id)  {
		anchor = findPos($(tourTipAnchor));
		item = findPos(item);
		//alert (test[0] + ':' + test[1]);
		//LeaderAnchor = findPos($(anchor));
		show($(id));
		var x = item[0]-anchor[0]+tourTipX;
		var y = item[1]-anchor[1]+tourTipY-$(id).offsetHeight;
		$(id).style.left = x+'px';
		$(id).style.top = y+'px';
	}

	// tourHideTip
	function tourHideTip() {
		var tips = getElementsByClass('tourTip', 'div');
		for (var i = 0; i < tips.length; i++ ) hide(tips[i]);
	}
	
	// update tips code, see ticket: http://tickets/browse/PGATOUR-1727
	function tourShowTipTool(item, tiptext, offsetX, offsetY) {
	
		// since you don't have to pass in offsetX or offsetY then I'm just checking to see if they are there, if not then set the value to 0
		if(!offsetX) var offsetX = 0;
		if(!offsetY) var offsetY = 0;
		
		// if tiptool div doesn't exist then add it to the body of the document
		if(!$('tourTipTool')) document.body.innerHTML += '<div id="tourTipTool" class="tourTip" style="display: none; top: 0; left:0;"></div>';
		
		// give the tiptool the tip text it needs
		var tip = $('tourTipTool');
		tip.innerHTML = tiptext;
		
		// findPos function return x, y values of the element in array format i.e. item[0] or item[1]
		item = findPos(item);
		
		// set the tiptool's position
		tip.style.left = (offsetX+item[0])+'px';
		tip.style.top = (offsetY+item[1])+'px';
		
		// show me to the world!
		show($('tourTipTool'));
	}

	function tourHideTipTool() {
		// if will prevent errors from occuring if the tiptool hasn't been created yet
		//  because it only gets created once the tourShowTipTool is called
		if ($('tourTipTool')) hide($('tourTipTool'));
	}

	// Accordion Menu Logic
	function tourInitializeVert (start) {
		var url = location.href.toLowerCase().replace(' ', '').replace(/\/$/, '/index.html');
		var node = $('tourVertMenu');
		var bars = getElementsByClass('Bar', 'div', node);
		var boxes = getElementsByClass('Box', 'div', node);
		var newHeight = node.offsetHeight - ((bars.length) * bars[0].offsetHeight);
		var linkWasFound = false;
		for (var i = 0; i < boxes.length; i++ ) {
			boxes[i].style.height = newHeight;
			var bar_links = bars[i].getElementsByTagName('a');
			var linkFound = false;
			var links = boxes[i].getElementsByTagName('a');
			for (var j = 0; j < links.length; j++ ) {
				var link = links[j].toString().toLowerCase().replace(' ', '').replace(/\/$/, '/index.html');
				if (url == link && !linkWasFound ) { links[j].id = "selected2"; linkFound = true;}
			}
			if (linkFound) { bars[i].className = bars[i].className + " current"; linkWasFound = true; start = i+1; }
			else if(start==(i+1) && !linkWasFound) { linkWasFound = true; bars[i].className = bars[i].className + " current"; }
		}
		if (!linkWasFound && !start) {
			var home_bar = getElementByClass('BarFlat', 'div', node);
			home_bar.className = home_bar.className + " currentFlat"; start = 1
		}
		if (!start) start = 1;
		openVert(start);
	}

	function openVert ( number ) {
		var node = $('tourVertMenu');
		var bars = getElementsByClass('Bar', 'div', node);
		var boxes = getElementsByClass('Box', 'div', node);
		if (number > bars.length || number < 1) number = 1;
		for (var i = 0; i < bars.length; i++ ) {
			if ( i == (number-1) ) {
				if (find('Open',bars[i].className)) ;
				else if (find('current',bars[i].className)) bars[i].className = bars[i].className.replace('current', 'currentOpen');
				else bars[i].className = bars[i].className + " open";
				show(boxes[i]);
			} else {
				if (find('current',bars[i].className)) bars[i].className = bars[i].className.replace('currentOpen', 'current');
				else bars[i].className = bars[i].className.replace(' open', '');
				hide(boxes[i]);
			}
		}
	}

// 5.0 OMNITURE HELPER FUNCTIONS
// 	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-

		function populateImpressionVars(linkid, tab_name){
			var podType = getPodType(linkid); //an array of type and subtype
			var pageName = getPageTitle() + " Homepage";
			var tabName, tourney, tourneyID, tArray, tl;
			var podType_ = podType[0];
			var podSubType_ = (podType[0] == null) ? '' : podType[1] + " : ";
				//takes the tab id and breaks it apart to grab the tourneyID
				if(	linkid.indexOf("/") > -1 )  {
					tArray = linkid.split("/");
					tl = tArray.length - 1;
					tourneyID = tArray[tl];
					tourney = getTourneyName(tourneyID);
				}

			// using passed in tab name if one is set, if not getting the text of the tab for the tab name
			var tabName = (tab_name) ? tab_name : $(linkid).innerHTML;
			if (tourneyID) {
				tourImpressionCheck(pageName, podType, tabName, tourney);   //Page-Down Report
				tourImpressionCheck2(pageName, podType, tabName, tourney);  //Pod-Down Report
			} else {
				tourImpressionCheck(pageName, podType, tabName);	//Page-Down Report
				tourImpressionCheck2(pageName, podType, tabName);	//Pod-Down Report
			}
		}

		function getTourneyName( tid ){
			var tourney = new Array();
			tourney["r027"] = "The Barclays";
			tourney["r505"] = "Deutsche Bank Championship";
			tourney["r028"] = "BMW Championship";
			tourney["r060"] = "The TOUR Championship";

			return tourney[tid];
		}

		function populateLBImpressionVars(pid, button, lbCookie){
			/*
				Notes: ______________________
				1. $pid
				2. $playerRow
				3. $button
				4. $buttonNode
				5. $buttonName
			*/
			var playerRowId = "tr_" + pid;
			var playerRowNode = $(playerRowId);
			var playerName = getElementByClass('name', 'td', playerRowNode).textContent;
			var buttonNode = $( button + pid );
			var buttonName = buttonNode.title;
			var lbCookieContents = cookie[lbCookie];
			var lbCookieArray = lbCookieContents.split("|");
			var lbCookieArrayLength = lbCookieArray.length;
			for (var i=0; i < lbCookieArrayLength/2; i++) {
				var openExpandedRow = new Array();
				var openExpandedRowCount = lbCookieArrayLength/2;
				openExpandedRow[i] = lbCookieArray[i*2] + ":" + lbCookieArray[i*2+1];
			}
			var totalRowCount = $("lbTable").rows.length - openExpandedRowCount;
			var rowPercentage = ((openExpandedRowCount/totalRowCount)*100).toString().substring(0,5);
			//alert("Total # of Expansion Rows Open: " + openExpandedRowCount);
			//alert("Total # of Expansion Rows: " + totalRowCount);
			//alert("Total % of Expansion Rows Open: " + rowPercentage + " %");
		}

		function getPageTitle(){
			var title = document.title;
			var title_ = title.slice(14); //"PGATOUR.com - " is 14 chars
			var path = ( document.URL ).replace(/https?:\/\/([^\/]+)/, "");
			path = ( path ).replace(/\/\//, "/");
			if (path.charAt(path.length - 1) == "/") path += "index.html";
			// make sure there's always a filename
			if (path.charAt(path.length - 1) == "#") {
				path = path.substr(0, path.length - 1);
			}  // take off any # from a href="#" links
			var path_array = ( path.substr(1) ).split("/");
			if (path_array[0] == "index.html" || path_array[0] == "" || path_array[0] == " ") title_ = "PGA TOUR";
			return title_;
		}

		function getPodType(linkId){
			var i = linkId;
			var c = $(i).className;
			var type, subtype;
			if ( c == 'tourHPT1Box' || i.indexOf('tourT1') > -1 ){	type = "T1";	}
			else if(i.indexOf('Sub') > -1){
				var round_ = i.substr(3, 1);
				if (round_ == 0){
					round_ = "Preview";
					type = "T1";
					subtype = "(" + round_ + " Round) " + "T1 News & Photos";
					return [type, subtype];
				} else {
					type =  "T1";
					subtype = "(Round " + round_ + ") " + "T1 News & Photos";
					return [type, subtype];
				}
			}
			else if( i.indexOf('Standings') > -1 ){	type = 'FEC Standings';	}
			else if(i.indexOf('Cast') > -1){	type = 'Broadcast';	}
			else if(i.indexOf("tourPGAPod") > -1){	type = "PGA.com";	}
			else{	type = linkId + ' (Pod Type is undefined)';		}
			return [type];
		}
