function reportLinkTrackEvent(reportSuiteID, linkName, eventNum) {
	if ( reportSuiteID == '') {
	    reportSuiteID = s_account;
	}
	
	var s;	
	if ( reportSuiteID != s_account) {
		s=s_gi(reportSuiteID,0,1);		
	} else { 
		s=s_gi(reportSuiteID);
	}


    	if ( s.eVar1 == null || s.eVar1 == "" ) {
        	s.eVar1 = GetCookie("eVar1Cookie");
	}

	s.linkTrackVars='events';
	s.linkTrackEvents=eventNum;
	s.events=eventNum;
	s.tl(this,'o',linkName);
}

function reportMediafile(linkName)
{
	var om_s=s_gi(s_account);
	om_s.eVar1=linkName;
	om_s.hier1=s.hier1;
	om_s.channel=s.channel;
	om_s.pageName=s.pageName;
	om_s.linkTrackVars='eVar1,hier1,channel,hier1,pageName';
	
	void(om_s.tl(this,'o',linkName));
}

function reportPageView(pageName, h1)       //This function should be only called by "Interactives" as it sets the eVar1 value!
{
	if(isdefined("s_account")) {
		var om_s=s_gi(s_account);

		var pageName_original = s.pageName;
		var hier1_original = s.hier1;
		var channel_original = s.channel;

		if( h1 == null || h1 == "" ) {
		    var hier=s.hier1 + ',' + pageName;
		    om_s.hier1=hier.replace(/careers/,"careers,media").toLowerCase();
	    } else {
        	om_s.hier1=h1;
	    }    
        
		om_s.channel=s.channel;
		om_s.pageName=pageName.toLowerCase();
		om_s.hier1=om_s.hier1.toLowerCase();
	
    		om_s.pageName=om_s.pageName.replace(/^\s+|\s+$/g,'').replace(/\s+/g,' ');  //replaces multiple spaces and \n
	    	om_s.hier1=om_s.hier1.replace(/^\s+|\s+$/g,'').replace(/\s+/g,' ');  //replaces multiple spaces and \n		
		om_s.eVar1=om_s.pageName;
		void(om_s.t());

	    	setEVar1Cookie(om_s.eVar1);    //Set Cookie with eVar1 value so that it can be retrieved back in reportLinkTrackEvent

		s.pageName = pageName_original;
		s.hier1 = hier1_original;
		s.channel = channel_original;
	}
}

function reportVideoClipView(videoName, h1)
{   
	var om_s=s_gi(s_account);
    var hier1_original = om_s.hier1;
    
    om_s.hier1=h1.toLowerCase();
    om_s.hier1=om_s.hier1.replace(/^\s+|\s+$/g,'').replace(/\s+/g,' ');  //replaces multiple spaces and \n		   
    om_s.eVar1=videoName;
	om_s.linkTrackVars='eVar1,channel,hier1,pageName';
	
	void(om_s.tl(this,'o',videoName));
	
	om_s.hier1 = hier1_original;
	setEVar1Cookie(om_s.eVar1);	    //Set Cookie with eVar1 value so that it can be retrieved back in reportLinkTrackEvent
}

/**
 * report Omniture tracking and send browser to designated URL
 * @param linkURL URL of the the link as a string
 * @param linkName Omniture linkName as a string
 */
function flashLinkTo(linkURL, linkName)
{
	// report media file
	reportMediafile(linkName);
	
	// change link
	window.location.href = linkURL;
}

function setEVar1Cookie(eVar1CookieValue)
{
    SetCookie ( "eVar1Cookie", eVar1CookieValue );
}
