﻿// JScript File

function _sTrackActivityTab(tabName){
var s=s_gi(s_account);
s.linkTrackVars='prop1,prop2,prop30';
s.prop1=tabName; //Activity Tabs
var thisPageURL = document.location + "";
s.tl(thisPageURL,'o', 'Activity Tab Click');

}

function _sTrackSearchCategory(searchCat){
var s=s_gi(s_account);
s.linkTrackVars='prop1,prop2,prop30';
s.prop30=searchCat; //Activity Tabs
var thisPageURL = document.location + "";
s.tl(thisPageURL,'o', 'Activity Page Change Search Category');

}

function _sTrackSendToFriend(){
var s=s_gi(s_account);
s.linkTrackVars='events,eVar31,eVar32,eVar33,eVar34,eVar35,eVar36,eVar47';
s.linkTrackEvents='event5';
s.events='event5'; //Send to a Friend
var thisPageURL = document.location + "";
s.tl(thisPageURL,'o', 'Send to a Friend');
s.events="";
}


function _sTrackRateActivity(){
var s=s_gi(s_account);
s.linkTrackVars='events,eVar31,eVar32,eVar33,eVar34,eVar35,eVar36,eVar47';
s.linkTrackEvents='event3';
s.events='event3'; //Rate Activity
var thisPageURL = document.location + "";
s.tl(thisPageURL,'o', 'Activity Rating');
s.events="";
}

function _sTrackReviewActivity(){
var s=s_gi(s_account);
s.linkTrackVars='events,eVar31,eVar32,eVar33,eVar34,eVar35,eVar36,eVar47';
s.linkTrackEvents='event4';
s.events='event4'; //Review Activity
var thisPageURL = document.location + "";
s.tl(thisPageURL,'o', 'Activity Review');
s.events="";
}

function TrackVideo(Event, videoID, Name, Category, Pauses, isFullscreen) {
	//Events: "start", "milestone" or "complete".  Required.
	//videoID, Name and Category should be passed in flashvars or xml data.  If they are not defined then default values will be used.
	//Pauses = Optional.  Number of times the video has been paused since last milestone.
	//isFullscreen = Optional, 0 or 1.  Set to 1 if video is in fullscreen mode.
	if (typeof videoID == "undefined") {
		videoID = "0";
	}
	if (typeof Name == "undefined") {
		Name = "Unnamed Activity Video";
	}		
	if (typeof Category == "undefined") {
		Category = "Activity Video";
	}
	if (typeof Pauses == "undefined") {
		Pauses = 0;
	}
	if (typeof isFullscreen == "undefined") {
		isFullscreen = 0;
	}
	var viewmode = "embedded";
	if (isFullscreen == 1) {viewmode = "fullscreen";}
	
	var events = "event14";
	var linktrackvars = "events,";
	var eventName = "Video Milestone Event";
	if (Event == "start") {
		events = "event12";
		eventName = "Video Start";
	}
	else if (Event == "complete") {
		events = "event13, event8";
		linktrackvars += linktrackvars.concat("recipes,");
		eventName = "Video Complete";
	}
	else {linktrackvars += linktrackvars.concat("recipes,");}
	
	linktrackvars = linktrackvars.concat("prop39,prop6,prop39,prop10,eVar30,eVar6,eVar10,eVar31,eVar32,eVar33,eVar34,eVar35,eVar36,eVar39,eVar47");
	
	var s=s_gi(s_account);
	s.linkTrackVars=linktrackvars;
	s.linkTrackEvents=events;
	
	s.events=events;
	s.eVar39 = videoID;
	s.prop39=s.eVar30= Name;
	s.prop6=s.eVar6= Category; 
	s.prop10=s.eVar10= viewmode //possible values are embedded and fullscreen

	if (Event == "milestone" || Event == "complete") {
		if (Pauses > 0) {
			s.products=";;;;event14=25.00|event8=" + Pauses.toString(); ////25% since last milestone | # of pauses between each milestone
		}
		else {
			s.products=";;;;event14=25.00"; ////25% since last milestone	
		}
	}
	s.tl(document.URL,'o', eventName);
	//clear vars
	s.events=s.products=s.eVar8=s.eVar39 = s.prop39=s.eVar30=s.prop6=s.eVar6= s.prop10=s.eVar10="";
}


function TrackLink(Name, Link, GApath) {

	//Name = internal campaign ID for Omniture.  Use the video name from xml or flashvars.
	//Link = destination link.  
	//GApath = Optional.  URI path for Google Analytics.  
		//If not specified, attempts to default to an appropriate value.  
		//May be omitted from the links in the top home page banner.
		var loc=document.location.toString();
		
		//Enable below if adding urchin tracking
        //	if (typeof GAPath == "undefined") {
        //		GApath = loc.substring(loc.indexOf("http://" + 7));
        //	
        //		if (GApath.match("default.aspx"))
        //		{
        //			GApath="/default/topbanner/";
        //		}
        //		else {
        //			GApath = GApath.substring(path.indexOf("/"));
        //			if (GApath.match("?") {GApath += "&videolink=";}
        //			else { GApath += "?videolink="; }
        //		}
        //	}
	
	
	var s=s_gi(s_account);
	s.linkTrackVars="s.eVar45";
	s.eVar45="video link:" + Name; //internal campaign ID
	s.tl(loc, "o", "View Activity");
	
	//urchintracker(GApath + Link);

}