/*

Wrapper for Omniture tracking for use in Flash projects

All tracking will start with the same "s.pageName" variable as the page the Flash movie is placed on -- in these examples that is "original_path/original_filename.htm".

Flash must be version 8 or newer and have imported the ExternalInterface class:

	AS CODE: 	import flash.external.*;


USAGE OPTIONS:

A regular "pageName" track (uses the "s.t();" function in Omniture):

	AS CODE: 	ExternalInterface.call('emcTrack','My Tracking String');

		SHOWS UP AS ==> "original_path/original_filename.htm: My Tracking String"
		

If you're tracking a PDF download, use the filename as the second parameter and pass the letter 'd' as the third (d for download).

	AS CODE: 	ExternalInterface.call('emcTrack','My Tracking String','filename.pdf','d');
	
		SHOWS UP AS ==> "original_path/original_filename.htm: My Tracking String"
		AND _ALSO_ SHOWS UP IN THE DOWNLOAD TRACKING UNDER ==> "filename.pdf"
		

If you're using a Custom Link, pass the Custom Link data as the first parameter, pass nothing for the second, and 'o' for the third.

	AS CODE: 	ExternalInterface.call('emcTrack','My Custom Link Data',null,'o');

		SHOWS UP _ONLY_ IN CUSTOM LINKS AS ==> "My Custom Link Data"

*/

var originalPageName=false;
function emcTrack(tStr,filename,mode) {
	
	if (!originalPageName) {
		//originalPageName='WRAPPER TEST '+(useFlash?'FLASH':'NOFLASH')+' '+window.s.pageName;
		originalPageName=window.s.pageName;
	}



	//download and custom link tracking -- shows up in File Downloads or Custom Links
	var s=s_gi('emc-emccom');
	s.dynamicAccountSelection=true;
	s.dynamicAccountList=window.s.dynamicAccountList;
	if (mode=='d') {
		s.tl(true,'d',filename);
		//if (console.log) {console.log('dl '+filename);}
	} else if (mode=='o') {
		s.tl(true,'o',tStr);
		//if (console.log) {console.log('cl '+tStr);}
	}
	
	//normal pageName tracking to enable pathing, etc. for both download and normal (but not custom)
	if (mode!='o') {
		var s=s_gi('emc-emccom');
		s.dynamicAccountSelection=true;
		s.dynamicAccountList=window.s.dynamicAccountList;
		s.pageName=originalPageName+': '+tStr;
		//if (console.log) {console.log(s.pageName);}
		//window.alert(s.pageName);
		s.t();
	}
	
}

