/**
 * DrPepper.Tracking
 *
 * Global tracking functionality.
 * 
 * initClickHandlers()	initializes click handlers for onClick item tracking
 * track()				onClick handler for item tracking
 * getPageOmnitureObject()	returns Omniture "s" object (also used in s_code.js)
 *
 * NOTE:	Requires g_sSite and g_aSections to be initialized properly.
 *
 * Author:	Silvan Reinhold
 **/

var DrPepper = DrPepper || {};

DrPepper.Tracking = {};

DrPepper.Tracking.DEFAULT_ONCLICK_LINK_NAME = "DrPepper Link";


/**
 * Set of basic tracking parameters used by *all* tracking calls (page-load and on-click)
 * The commented-out parameters are the ones potentially used by any of the tracking calls;
 * they are not included in order to avoid sending empty parameters.
 */
DrPepper.Tracking.aBasicTrackingParameters = {
//	pageName:	"",				// OVERWRITE
//	channel:	"",				// PAGE
//	prop28:		"",
//	prop24:		"",
	prop5:		"Dr Pepper",	// STATIC
//	prop6:		"",
//	prop7:		"",
	prop8:		"South West",	// STATIC
	prop9:		"Dr Pepper",	// STATIC
	prop10:		"CSDs",			// STATIC
//	prop11:		"Non Flash",	// OVERWRITE
//  prop13:     "",			
//	prop34:		"",
//	event19:	"",
//	eVar20:		"",
//	prop12:		"",
//	event16:	"",
//	products:	"",
//	prodView:	"",
//  eVar3:		"",
//	eVar6:		"",
//	eVar7:		"",
	eVar8:		"South West",	// STATIC
	eVar9:		"Dr Pepper",	// STATIC
	eVar10:		"CSDs"			// STATIC
//	eVar12:		"",				// OVERWRITE
//	eVar13:		"",				// PAGE
//	eVar14:		"",				// PAGE
//  eVar15:     "",
//	event12:	"",				// STATIC (exception, because it is listed in events
//	event20:	""
};


/**
 * Set of tracking parameters used by the current page's page-load tracking call.
 * Initialized below by initPageTrackingParameters()
 */
DrPepper.Tracking.aPageTrackingParameters = {};


/**
 * The names (keys) of all tracking parameters that an onClick event should reset in aPageTrackingParameters
 * in order to make a clean onClick tracking call.
 *
 * This way, aPageTrackingParameters (which is initialized with all basic, page-related tracking information)
 * can be used as a basis for onClick tracking calls.
 */
DrPepper.Tracking.aTrackingKeysToReset = [
	"channel",
	"pageName",
	"prop28",
	"prop24",
	"prop6",
	"prop7",
	"prop11",
	"prop30",
	"prop34",
	"event19",
	"eVar20",
	"prop12",
	"prop24",
	"event16",
	"event23",
	"event26",
	"products",
	"prodView",
	"eVar3",
	"eVar6",
	"eVar7",
	"eVar12",
	"eVar13",
	"eVar14",
	"eVar35",
	"event20",
	"event2",
	"eVar15",
	"prop13"
];


/**
 * Attaches click tracking handlers to all elements which have tracking meta data attached.
 * The handler will pass any tracking meta information to the track() function, which then makes the required Omniture call.
 * Requires the DOM tree to be complete.
 *
 * Each DOM element participating in tracking must define tracking information in its metadata section, as follows:
 * <span class="meta-data">
 *   <span class="tracking">...tracking data goes here</span>
 * </span> 
 **/
DrPepper.Tracking.initClickHandlers = function()
{
	// Set up click handlers for all elements containing tracking meta-data
	//
	$(".meta-data .tracking").parent().parent().click(function() {
		eval("var l_xTrackingParams = {" + $(".meta-data .tracking", this).text() + "}");		
		DrPepper.Tracking.track(l_xTrackingParams);
	});
  
  // click handler for .jpg wallpaper downloads...
  $("[id^=mb-downloads-]").click(function() {
    _gaq.push(['_trackEvent', 'Download', 'Wallpaper', this.id]);
  });
  
  // click handler for Store in top nav...
  $(".item.store").click(function() {
    _gaq.push(['_trackPageview', '/store']);
  });

  
}


/**
 * Invoke Omniture tracking, given the parameters passed
 *
 * @param	p_xTrackingParams	Tracking parameters as defined in the metadata of the DOM element
 **/
DrPepper.Tracking.track = function(p_xTrackingParams)
{
	if (p_xTrackingParams.isPromo) {
		//
		// Promo box or promo footer click (see s_code.js)
		//
		analyticsClick(p_xTrackingParams.position, DrPepper.Tracking.cleanupString(p_xTrackingParams.promotion));
	}
	else {
		//
		// Click on any tracked clickable item
		//
		
		// Create a new s object, pre-populated with
		//
		var s = DrPepper.Tracking.getPageOmnitureObject();
		// Reset those parameters which are specific to the page and not necessarily used by the clicked item
		//
		
		var l_aKeysToReset = DrPepper.Tracking.aTrackingKeysToReset;
		for (var i = 0; i < l_aKeysToReset.length; i++) {			
			delete s[l_aKeysToReset[i]];
		}

		// Write onClick-specific tracking parameters
		//
		for (var l_sKey in p_xTrackingParams) {
			s[l_sKey] = p_xTrackingParams[l_sKey];		
		}

		if (s.events) {
			s.linkTrackEvents = s.events;
		}

		// Make a list of all tracked variables and tracked events
		//
		var l_sLinkTrackVars = "events,";
		for (l_sKey in s) {
			// add only event, eVar, and prop properties
			if (((l_sKey.substr(0, 5) == "event") && (l_sKey != "events")) || (l_sKey.substr(0, 4) == "eVar") || (l_sKey.substr(0, 4) == "prop")) {
				l_sLinkTrackVars += l_sKey + ",";
			}
		}
		s.linkTrackVars = l_sLinkTrackVars.substr(0, l_sLinkTrackVars.length - 1);
		// Invoke tracking back-end
		//
		var l_sLinkName = (  ((!s.prop24) || (s.prop24 == "")) ? DrPepper.Tracking.DEFAULT_ONCLICK_LINK_NAME : s.prop24); 
		s.tl(this, 'o', l_sLinkName);
	}
}


/**
 * Returns an omniture object ("s") pre-populated with tracking values as pertaining to current page.
 * REQUIRES s_code.js to be included.
 * 
 * @return	General Omniture object ("s") for current page
 */
DrPepper.Tracking.getPageOmnitureObject = function()
{
	var s = s_gi(s_account);

	if (g_sSite == "404") {
		//
		// 404 errors really only have the pageType as a relevant parameter
		//
		s.pageType = "errorPage";
		return s;
	}
	
	// Fetch PAGE tracking parameters as pertaining to the currently viewed page, as a basis
	//
	var l_aPageTrackingParameters = DrPepper.Tracking.aPageTrackingParameters;

	// Set up Omniture "s" object
	//
	for (var l_sKey in l_aPageTrackingParameters) {
		if (l_aPageTrackingParameters[l_sKey] != "") {
			s[l_sKey] = l_aPageTrackingParameters[l_sKey];
		}
	}
	
	return s;
}


/**
 * Initialize tracking parameters for the current page's page-load tracking call.
 * Called from within s_code.js
 */
DrPepper.Tracking.initPageTrackingParameters = function()
{
	var l_sChannel;
	var l_sProp28;
	var l_sPageName;
	var l_sProducts;
	var l_sProdView;
	var l_sEvent12;
    var l_sEvent15;
	var l_sEvent16;
	var l_sEvent23; //kiss initial-page view
	var l_sEvent26; //kiss permalink
	var l_sEvent2;  //registration page
    var l_sEvent3;
    var l_sEvent5;
	var l_sEvent13; //tell-a-friend
	var l_sEVar3; 
	var l_sEVar7;
	var l_sEVar12;
	var l_sEVar13;
	var l_sEVar14;
	var l_sEVar15;
	var l_sEVar35;
	var l_sProp7;
	var l_sProp11;
	var l_sProp12;
	var l_sProp13;
	var l_sProp24; 
	var l_sProp25;
	var l_sProp30;
	var l_sEvents;
	
	var l_sProductName;


	l_sProp11 = "Non Flash";

	if (g_sSite == "404")
	{
		// 404 ERROR
		l_sChannel = "errorPage";
		l_sPageName = "404";
	}	
	else if (g_sSite == "text")
	{
		//
		// TEXT
		//
		l_sChannel = g_aSections[0];
		
		if (g_aSections[0] == "products")
		{
			//
			// PRODUCTS
			//
			l_sChannel = "products";
	
			l_sProductName = g_aSections[1];
			switch (l_sProductName) {
				case "drpepper":					l_sProductName = "Dr Pepper";						break;
				case "dietdrpepper":				l_sProductName = "Diet Dr Pepper";					break;
				case "cherryvanilladrpepper":		l_sProductName = "Cherry Vanilla Dr Pepper";		break;
				case "dietcherryvanilladrpepper":	l_sProductName = "Diet Cherry Vanilla Dr Pepper";	break;
				case "caffeinefreedrpepper":		l_sProductName = "Caffeine Free Dr Pepper";			break;
				case "caffeinefreedietdrpepper":	l_sProductName = "Caffeine Free Diet Dr Pepper";	break;
				case "drpeppercherry":				l_sProductName = "Dr Pepper Cherry";				break;
				case "dietdrpeppercherry":			l_sProductName = "Diet Dr Pepper Cherry";			break;
			}
			l_sPageName = l_sChannel + ": " + l_sProductName;
			
			if (g_aSections[2] == "faq") {
				l_sPageName += " Product FAQ";
			}
			else if (g_aSections[2] == "nutrition") {
				l_sPageName += " Nutritional Facts";
				l_sEvent16 = "event16";
			}
			else {
				l_sProdView = "prodView";
			}

			l_sPageName += ": text";
			
			l_sProp28 = l_sProductName;
			l_sProducts = l_sProductName;
			l_sProp24 = "text";
			l_sProp7 = l_sProductName;
			l_sEVar7 = l_sProp7;
			l_sProp12 = "products";
		}
		else if (g_aSections[0] == "faq") {
			l_sChannel = "about us";
			l_sPageName = "about us: faq";
			l_sProp28 = "faq";
		}
		else if (g_aSections[0] == "corporateinfo") {
			l_sChannel = "about us";
			l_sPageName = "about us: corporate information";
			l_sProp28 = "corporate information";
		}
		else {
			l_sPageName = "home: : text";
			l_sProp24 = "text";
		}
	}
	else 
	{
		//
		// MAIN
		//
		switch (g_aSections[0])
		{
			case "products":
				l_sProp11 = "Flash";
				l_sProp12 = "products";
				l_sChannel = g_aSections[0];
				l_sPageName = g_aSections[0] + ": ";
				break;		
				
			case "home":
				l_sChannel = g_aSections[0];
				l_sPageName = g_aSections[0] + ": ";
				l_sProp30 = l_sEVar35 = name_for_11 = "thor";
				break;
				
			case "promotions":
				if (g_aSections[1]==undefined) // Promotions Landing page
				  { g_aSections[1] = "thor"; }


                l_sChannel = g_aSections[1];
				
                if (g_aSections[1] == "camaro")
                    { l_sProp30 = l_sEVar35 = name_for_11 = "Camaro"; }
                else if (g_aSections[1] == "vida23")
                    { l_sProp30 = l_sEVar35 = name_for_11 = "vida23";
                      if (g_aSections[2] == "en")
                        { l_sProp13 = l_sEVar15 = "English"; }
                      else if (g_aSections[2] == "es")
                        { l_sProp13 = l_sEVar15 = "Spanish"; }
                      else
                        { l_sProp13 = l_sEVar15 = ""; }
                      g_aSections[2] = g_aSections[4];
                    }
                else if (g_aSections[1] == "football2010")
                    { l_sProp30 = l_sEVar35 = name_for_11 = "football 2010"; }
                else if (g_aSections[1]=="ea")
                    { g_aSections[1] = "ea games"; }
                else
                    { l_sProp30 = l_sEVar35 = name_for_11 = g_aSections[1]; }
                
                if (g_aSections[2] == "create" ||
                    g_aSections[2] == "signin")
                    { l_sProp28 = "sign up sign in";
                      l_sEvent2 = 'event2';
                    }
                else if (g_aSections[2] == "edit-account" ||
                         g_aSections[2] == "editaccount")
                    { l_sProp28 = "edit account"; }
                else if (g_aSections[2] == "faq" ||
                         g_aSections[2] == "faqs")
                    { l_sProp28 = "faq"; }
                else if (g_aSections[2] == "forgot-password")
                    { l_sProp28 = "forgot password"; }
                else if (g_aSections[2] == "rules" ||
                         g_aSections[2] == "ampm")
                    { l_sProp28 = "official rules"; }
                else if (g_aSections[2] == "tell-a-friend" ||
                         g_aSections[2] == "tellafriend")
                    { l_sProp28	= "tell a friend";
                      l_sEVar11	= "DP " + name_for_11 + " Promotion";
                      l_sEvent13 = "event13";
                    }
                else if (g_aSections[2] == "sweeps")
                    { l_sProp28 = "essay page"; }
                else if (g_aSections[2] == "prizes")
                    { l_sProp28 = "prizes";
                      l_sProp11 = "DP " + name_for_11 + " Promotion";
                    }
                else if (g_aSections[2] == "login")
                    { l_sProp28 = "enter code"; }
                else if (g_aSections[2] == "createaccount")
                    { l_sProp28 = "registration"; }
                else if (g_aSections[2])
                    { l_sProp28 = g_aSections[2]; }
                else
                    { l_sProp28 = ""; }
                
                if ( g_aSections[1] == "football2010" )
                    { if ( g_aSections[2] == "thankyou" )
                        { l_sEvent15 = "event15";           //video submit page
                          l_sEvent3  = "event3";            //and registration success page
                        }
                      else if ( g_aSections[2] == "thankyouregistered" )
                        { l_sEvent3  = "event3"; }          //registration success page
                    }
                
                if (g_aSections[1] == "vida23")
                    { l_sProp24 = l_sProp28;
                      l_sProp28 = "tu ride";
                      if (l_sProp24 == "")
                        { l_sPageName = g_aSections[1] + ": start"; }
                      else
                        { l_sPageName = g_aSections[1] + ": " + l_sProp28 + ": " + l_sProp24; }
                    }
                else
                    { l_sPageName = g_aSections[1] + ": " + l_sProp28; }

				break;

                                				
			case "entertainment": 
				if ((g_aSections[1] == "kiss") && (g_aSections[2] == "link"))
				{
					//PERMALINK PAGE LOAD
					l_sPageName = "entertainment: kiss yourself: permalink";
					l_sChannel = "entertainment";
					l_sProp11 = "Flash";
					l_sProp28 = "permalink";
					if (self.location.href.indexOf('?cmpid=DP_cherry_em_KISS_sendtoafrnd_2009') == -1) {
						//IF NOT FROM EMAIL LINK - add this event
						l_sEvent26 = "event26";
					}
				}
				else if ((g_aSections[1] == "kiss") && (g_aSections[2] != "link"))
				{
					//APP PAGE LOAD
					l_sPageName = "entertainment: kiss yourself";
					l_sChannel = "entertainment";
					l_sProp11 = "Flash";
					l_sProp28 = "kiss yourself";
					l_sEvent23 = "event23";
				}
				else if ((g_aSections[1] == "topchef") && (g_xUrlParameters['pid'] == 1)) 
				{ 
					//Guilt Free Jubilee
					l_sPageName = "entertainment: recipes: guilt free jubilee";
					l_sChannel="entertainment";
					l_sProp11="NonFlash";
					l_sProp28="recipes";
					l_sProp24="guilt free jubilee";
					l_sProp25="Guilt Free Jubilee";
				}
				else if ((g_aSections[1] == "topchef") && (g_xUrlParameters['pid'] == 2)) 
				{    
					//Mommas Macaroons
					l_sPageName = "entertainment: recipes: mommas macaroons";
					l_sChannel="entertainment";
					l_sProp11="NonFlash";
					l_sProp28="recipes";
					l_sProp24="mommas macaroons";
					l_sProp25="Mommas Macaroons";
				}
				else if ((g_aSections[1] == "topchef") && (g_xUrlParameters['pid'] == 3)) 
				{   
					//Flaming Cherries
					l_sPageName = "entertainment: recipes: flaming cherries";
					l_sChannel="entertainment";
					l_sProp11="NonFlash";
					l_sProp28="recipes";
					l_sProp24="flaming cherries";
					l_sProp25="Flaming Cherries";
				}
				else if((g_aSections[1] == "topchef") && (g_xUrlParameters['pid'] > 3))
				{
					l_sChannel = "errorPage";
					l_sPageName = "404";	
					g_sSite = "404";
				}
                else if (g_aSections[1] == "neverendingsong")
				{
					//APP PAGE LOAD
					l_sPageName = "entertainment: neverendingsong";
					l_sChannel = "entertainment";
					l_sProp11 = "Flash";
					l_sProp28 = "neverendingsong";
				}
                else if (g_aSections[1] == "kisstour")
				{
					l_sPageName = "entertainment: kisstour";
					l_sChannel = "entertainment";
				}
                else if (g_aSections[1] == "coachestrophy")
				{	l_sPageName = "football2010: coachestrophy";
                    l_sChannel = l_sProp30 = l_sEVar35 = name_for_11 = "football2010";
				}
				else {
					l_sChannel = g_aSections[0];
					if (typeof g_aSections[1] == 'undefined')
					  { g_aSections[1] = ""; }
					l_sProp30 = l_sEVar35 = name_for_11 = g_aSections[1]
					l_sPageName = g_aSections[0] + ":" + g_aSections[1] + ": ";		
				}
				break;
				
			case "video":
				l_sChannel = g_aSections[0];
				l_sPageName = g_aSections[0] + ": ";
				break;
				
			case "signin":
				l_sChannel 	= 'registration';
				l_sPageName = 'registration: sign up and sign in';
				l_sEVar3 	= 'Registration + Dr Pepper';
				l_sProp11 	= 'NonFlash';
				l_sEVar14 	= 'NonFlash';
				l_sProp28 	= 'sign up and sign in';
				l_sEvent2	= 'event2';
				break;
				
			case "store":
				l_sChannel = "merchandise";
				l_sPageName = "merchandise: ";
				break;

            case "community":
                l_sChannel = g_aSections[0];
                if (typeof g_aSections[1] == 'undefined')
                  { g_aSections[1] = ""; }
                l_sProp30 = l_sEVar35 = name_for_11 = g_aSections[1]
                l_sPageName = g_aSections[0] + ":" + g_aSections[1] + ": ";
                break;

			case "about":
                l_sChannel = "about us";
                if (g_aSections[1]==undefined)
                    { l_sProp28 = ""; }
                else
                    { l_sProp28 = g_aSections[1]; }
                l_sPageName = l_sChannel + ": " + l_sProp28;
				break;

			case "privacy":
				l_sChannel = "about us";
				l_sPageName = "about us: privacy";				
				l_sProp28 = "privacy";
				break;
				
			case "sitemap":
				l_sChannel = "about us";
				l_sPageName = "about us: site map";
				l_sProp28 = "site map";
				break;
				
			case "contactus":
				l_sChannel = "about us";
				l_sPageName = "about us: contact us";
				l_sProp28 = "contact us";
				break;
				
			case "termsofuse":
				l_sChannel = "about us";
				l_sPageName = "about us: terms of use";
				l_sProp28 = "terms of use";
				break;

			case "accessibility":
				l_sChannel = "about us";
				l_sPageName = "about us: accessibility";
				l_sProp28 = "accessibility";
				break;
				
			case "safeway":
				l_sChannel = "safeway";
				l_sPageName = "safeway";
				l_sPropt28 = "safeway";
				break;
				
			default:
				l_sPageName = "???";
		}
	}

	if (g_sSite == "404") {
		l_sPageName = "";
	}	
	else {
		l_sPageName += " - Dr Pepper";
	}
	l_sEVar12 = l_sPageName;
	l_sEVar13 = l_sChannel;
	l_sEVar14 = l_sProp11;	// Flash/Non Flash
	l_sEvents = "event12"; // the same for all page loads
	
	l_aTrackingParameters = DrPepper.Tracking.aBasicTrackingParameters;
	l_aTrackingParameters['pageName'] = l_sPageName;
	l_aTrackingParameters['channel'] = l_sChannel;
	if (l_sProp28) l_aTrackingParameters["prop28"] = l_sProp28;
	if (l_sProp24) l_aTrackingParameters["prop24"] = l_sProp24;   
	if (l_sProp25) l_aTrackingParameters["prop25"] = l_sProp25;
	if (l_sProp7) l_aTrackingParameters["prop7"] = l_sProp7;
	if (l_sEVar7) l_aTrackingParameters["eVar7"] = l_sEVar7;
	if (l_sProp11) l_aTrackingParameters["prop11"] = l_sProp11;
	if (l_sProp12) l_aTrackingParameters["prop12"] = l_sProp12;
	if (l_sProducts) l_aTrackingParameters["products"] = ";" + l_sProducts;
    
	if (l_sEvent12)		l_sEvents = (l_sEvents == "" ? "event12"	: l_sEvents + ",event12");
    if (l_sEvent15)		l_sEvents = (l_sEvents == "" ? "event15"	: l_sEvents + ",event15"); // video/photo/media upload
	if (l_sEvent16)		l_sEvents = (l_sEvents == "" ? "event16"	: l_sEvents + ",event16");
	if (l_sEvent23)		l_sEvents = (l_sEvents == "" ? "event23"	: l_sEvents + ",event23"); // kiss
	if (l_sEvent26)		l_sEvents = (l_sEvents == "" ? "event26"	: l_sEvents + ",event26"); // kiss permalink
	if (l_sProdView)	l_sEvents = (l_sEvents == "" ? "prodView"	: l_sEvents + ",prodView");	
	if (l_sEvent2)		l_sEvents = (l_sEvents == "" ? "event2"		: l_sEvents + ",event2");  //register/lead initiated page
    if (l_sEvent3)		l_sEvents = (l_sEvents == "" ? "event3"		: l_sEvents + ",event3");  //register/lead completed page
    if (l_sEvent5)		l_sEvents = (l_sEvents == "" ? "event5"		: l_sEvents + ",event5");  //sign-in
	if (l_sEvent13)		l_sEvents = (l_sEvents == "" ? "event13"	: l_sEvents + ",event13");  //tell-a-friend
	if (l_sEVar12) l_aTrackingParameters["eVar12"] = l_sEVar12;
	if (l_sEVar13) l_aTrackingParameters["eVar13"] = l_sEVar13;
	if (l_sEVar14) l_aTrackingParameters["eVar14"] = l_sEVar14;
	// vida23
	if (l_sEVar35) l_aTrackingParameters["eVar35"] = l_sEVar35;
	if (l_sProp30) l_aTrackingParameters["prop30"] = l_sProp30;
	
	//registration
	if (l_sEVar3) l_aTrackingParameters["eVar3"]   = l_sEVar3;	
	
	//tu ride
	//if (l_sProp13) l_aTrackingParameters["prop13"] = l_sProp13;
	//if (l_sEVar15) l_aTrackingParameters["eVar15"] = l_sEVar15;	
	if (typeof g_sLanguage === 'undefined') g_sLanguage = "English";
	l_aTrackingParameters["prop13"] = g_sLanguage;
	l_aTrackingParameters["eVar15"] = g_sLanguage;
	
	l_aTrackingParameters["eVar14"] = l_sEVar14;
	l_aTrackingParameters["events"] = l_sEvents;


	DrPepper.Tracking.aPageTrackingParameters = l_aTrackingParameters;
}


/**
 * Cleans up a string for use in analytics log.
 * Replaces line breaks (including <br />) amd non-breaking spaces with spaces; and only allows alphanumeric characters otherwise.
 *
 * @param	p_sSource	Original string to be cleaned up
 *
 * @return	Cleaned up string
 */
DrPepper.Tracking.cleanupString = function(p_sSource)
{
	var l_sTarget = DrPepper.Util.urlDecode(p_sSource);
	l_sTarget = l_sTarget.replace(/[\r\n\x0A]|<br \/>|&nbsp;/g, " ");
	l_sTarget = l_sTarget.replace(/[^a-zA-Z0-9 ]/g, "");
	l_sTarget = l_sTarget.toLowerCase();

	return l_sTarget;
}


/**
 * Debug function: dump non-function object attributes
 */
DrPepper.Tracking.dumpObject = function(p_xObject)
{
	var l_sStr = "";
	for (var l_sKey in p_xObject) {
		if (p_xObject[l_sKey] instanceof Function) {
			continue;
		}
		l_sStr += l_sKey + ":\t\t" + p_xObject[l_sKey] + "\n";
	}
	alert(l_sStr);
}


/**
 * Tracking for promo footer items
 */
function analyticsClick(p_sPosition, p_sPromotion)
{
	s=s_gi(s_account);
	s.linkTrackVars = "prop17,eVar17,events";
	s.linkTrackEvents = "event17";
	
	s.prop17 = p_sPosition+" > "+p_sPromotion+" > "+s.pageName;
	s.eVar17 = s.prop17;
	s.events = s.linkTrackEvents;
	linkName = s.prop17;
	s.tl(this,'o',linkName);
  _gaq.push(['_trackEvent', 'Click', 'Featured Content', linkName]);
}

/*
 * Multi-purpose Custom Link call...
 */
function waLinkClick(friendlyLinkName)
{
	s=s_gi(s_account);
	linkName = friendlyLinkName.toLowerCase() + ":" + s.pageName;
    
    s.events = "";
    
    if ( linkName.indexOf("facebook") >= 0 )
        { s.events = "event34"; }
    else if ( linkName.indexOf("twitter") >= 0 )
        { s.events = "event1"; }
    else if ( linkName.indexOf("myspace") >= 0 )
        { s.events = "event35"; }
    else if ( linkName.indexOf("digg") >= 0 )
        { s.events = "event36"; }
    else if ( linkName.indexOf("delicious") >= 0 )
        { s.events = "event37"; }
    else if ( linkName.indexOf("email") >= 0 )
        { s.events = "event38"; }
        
    if ( s.events != "" )
        { s.linkTrackVars = "events";
          s.linkTrackEvents = s.events; 
        }
    
    //var lt=obj.href!=null?s.lt(obj.href):"";
    //if (lt=="") { s.tl(obj,'o',linkName); }
    
    s.tl(this,'o',linkName);
}


///////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: Initialize tracking parameters for current page
//
DrPepper.Tracking.initPageTrackingParameters();
//
///////////////////////////////////////////////////////////////////////////



