	/*
	
	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,vidLength) {
		
		var vidLengthPassed=(vidLength!=undefined);
		try {
			if(vidLengthPassed){if(console){if(console.log){console.log('VIDEO LENGTH: '+vidLength)}}}
		} catch(err) {}
		
		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;
		
		var theText=tStr;
		if(theText.indexOf(".htm:(event)")!=-1)
		{
		  var getTextFromtStr=theText.split(".htm:(event) ");  	
		}else
		{
		var getTextFromtStr=theText.split(".htm: ");
		}
		theText=getTextFromtStr[1];
		
		if (mode=='d') 
		{
		  
		  
		  if (filename.indexOf('emc.com')==-1)
					 {
					   //append domain for downloads tracking
					   var emcSite=window.location.protocol + "//" + window.location.host;
					   filename=emcSite+filename;
					 }
					 
		   s.linkTrackVars="products,eVar8,prop35,prop36,prop43,prop1,eVar1,prop2,eVar2,prop3,eVar3,prop4,eVar4,events,eVar7,prop75,prop19,prop42"; 
		   s.linkTrackEvents="event10,event1";
	       s.events="event10,event1";
	       s.products=";;;;event1=5,;;;;event10";
			 
			
			var theLink=filename;
			var xstart = theLink.indexOf(".emc.com")+9;
			var xend = theLink.length;
			var awebcurl = theLink.substring(xstart,xend);
			s.prop35=awebcurl;
			s.prop42=theText;
			s.prop36=s.eVar7=s.pageName;
			s.eVar8=awebcurl+"<>"+s.pageName;
	   
			var getType=awebcurl.split("/");
			var getTypeArray=getType[1];
			if (getTypeArray.indexOf("hardware")==0 || getTypeArray.indexOf("software")==0)
			{
			 var getTypeArray2=getType[2];
			 s.prop43=getTypeArray2;
			}else
			{
			 s.prop43=getTypeArray;
			} 
			
			/*if(typeof(document.getElementById("contentLeftMenu"))!=="undefined")
			{
			 var getProductName=document.getElementById("contentLeftMenu").getElementsByTagName("span")[0].innerHTML;
			 s.prop37=getProductName;
			 s.eVar41=s.prop37;
			}
			
			*/
	
		   //corrected 8/24 so that % event doesn't get tied to other custom link clicks
		} else if (mode=='o') {
					s.linkTrackVars="products,events,eVar7,prop75,prop19,prop23,prop24,prop25,prop26,eVar26";
	   
					if (tStr.indexOf('25%')>=0){
					   s.linkTrackEvents="event36";
					   s.events="event36";
					   s.products="";
					   
					}else if (tStr.indexOf('50%')>=0){ 
					   s.linkTrackEvents="event37";
					   s.events="event37";
					   s.products="";
					}else if (tStr.indexOf('75%')>=0){
					   s.linkTrackEvents="event38";
					   s.events="event38";
					   s.products="";
					 }else if (tStr.indexOf('100%')>=0){
					   s.linkTrackEvents="event39,event1";
					   s.events="event39,event1";
					   s.products=";;;;event1=5,;;;;event39";
					 }else if (tStr.indexOf('0%')>=0){
					   s.linkTrackEvents="event35";
					   s.events="event35";
                       s.products="";
					 }
					s.eVar26=s.prop26=vidLength;
					s.prop25=theText;
			        s.prop24=s.eVar7=s.pageName;
					
		   //added 8/26 - to correct char limit issue using M1st URLs
		   
					 if (tStr.indexOf('Source_ID')!==-1)
					  {
					  var getIDStart=tStr.indexOf("Source_ID")+10;
					  var getIDEnd=tStr.indexOf("Source_ID")+23;
					  tStr = s.pageName+": "+tStr.substring(getIDStart,getIDEnd);
					  }

					s.tl(this,'o',tStr);
		
		}
		
		//normal pageName tracking to enable pathing, etc. for both download and normal (but not custom)
		else {
			var s=s_gi('s_account');
			s.dynamicAccountSelection=true;
			s.dynamicAccountList=window.s.dynamicAccountList;
                        s.linkTrackVars="prop45";

			tStr=originalPageName+': '+tStr;
                        sprop45=s.pageName;
					
				   
					s.tl(true,'o',tStr); 
			
			
		}
		
	}
	
	var originalPageName=false;
	function emcTrackLiveEvent(tStr,filename,mode,vidLength) {
		
		var vidLengthPassed=(vidLength!=undefined);
		try {
			if(vidLengthPassed){if(console){if(console.log){console.log('VIDEO LENGTH: '+vidLength)}}}
		} catch(err) {}
		
		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;
		
		var theText=tStr;
		var getTextFromtStr=theText.split(".htm:(event) VID: REPLAY ");
		theText="Replay at "+getTextFromtStr[1];
	
		   //corrected 8/24 so that % event doesn't get tied to other custom link clicks
		if (mode=='o') {

					s.linkTrackVars="prop40,prop39,prop45,eVar21,eVar1";

					 if(theText.indexOf("Replay at 0min")!=-1)
					 {
					   theText="Started Replay";
					   var tempText="after start";					   
					 }
					 
					s.eVar26=s.prop26=vidLength;
					s.prop39=theText;
			        s.prop45=s.eVar1=s.pageName;
					
		   s.tl(true,'o',tStr); 
		
		}
		
		//normal pageName tracking to enable pathing, etc. for both download and normal (but not custom)
		else {
			//do nothing
			
			
		}
		
	}
	
	
	   
		   
	
	

