/***********************************************
* ctvTrackVideo
*  
************************************************/
var coAdLeaderTag = "";
var coAdBigBoxTag = "";

function ctvTrackVideo (reportObj)
{
		
	var vidState = reportObj.vidState;
	
	//perma required
	//
	
	var pVideoInfo= new Video( { IgnoreSibling: true,EpisodePermalink:'', Permalink:'http://watch.muchmusic.com/', IsAd:false, Thumbnail:'', EpisodeThumbnail:'', Rating:'', Description:'', Title:reportObj.title, Format:'FLV', ClipId:reportObj.id, BugUrl: '' ,SiteMap:'', IsCanadaOnly:'0',Artist:'', MetaData:'', Duration:reportObj.duration, Url:reportObj.url} );
	
	/*
	var test= new Video( { IgnoreSibling: true,EpisodePermalink:'http://watch.muchmusic.com/muchmore/muchmore-music-videos/fresh-on-muchmore/', Permalink:'http://watch.muchmusic.com/muchmore/muchmore-music-videos/fresh-on-muchmore/clip202127#clip202127', IsAd:false, Thumbnail:'http://images.ctvdigital.com/images/pub2upload/37/2009_8_10/saviour.jpg', EpisodeThumbnail:'http://images.ctvdigital.com/images/pub2upload/37/2009_4_2/fresh_02_400x300.jpg', Rating:'', Description:'', Title:'Lights - Saviour', Format:'FLV', ClipId:'202127', BugUrl: '' ,SiteMap:'Fresh on MuchMore||ShowId=3501&SeasonId=1152&EpisodeId=26277||Music Videos||ShowId=3501&SeasonId=1152||MuchMore||ShowId=3501', IsCanadaOnly:'0',Artist:'Lights', MetaData:'Album: The Listening||Label: LIGHTS Music Inc/Universal Music/VideoFact||Director: Robert Schober||Released: 2009'} );
	*/
	if (vidState == "video_started") {
		Metrics.StartedClip(pVideoInfo);
	} else if (vidState == 'video_abandoned') {
		callEndedClip(pVideoInfo);
	} else if (vidState == 'video_played_to') {
		Metrics.ReachedClipKeyPoint(reportObj.cp);
	} else {
		//do nothing
	}
	
}

function callEndedClip(pVideoInfo) {
	var CurrentClip = pVideoInfo; 

	if( ! CurrentClip.IsAd ) {
		Metrics.SendLeftClipBeforeEnd( CurrentClip );		
    }
}

/***********************************************
* setCoAd
*  
* str: dart call
************************************************/
function setCoAd(str) {
	//alert(str);
}


function setAllCoAd(leaderTag, bigBoxTag) {
	
	coAdLeaderTag  = leaderTag;
	coAdBigBoxTag  = bigBoxTag;

	timer();
	//alert("leader="+coAdLeaderTag+", bigbox="+coAdBigBoxTag);

}

/*****************************************************************
* reportMedia
*
* infoObj - object containing properties/info about a video clip
* 
* Properties include:
* category - type of video, that is content or video ad. The values will be either "content" or "ad"
* id - video clip id
* title -video title
* duration - length of video
* vidState  - string describing when this function was triggered. Values can be
*		"video_started", "video_ended", "video_played_to", "video_abandoned"
* feed - values can be "flipbook_feed", "bin_feed", "content_feed", "video_feed", "playerbin_feed"
* 
* eid (optional) - episode/package/content id. This will be provided if video was part of a package
* bid (optional) - bin id. This will be set if video was part of a bin.
* playerbid (optional) - this will be set if video was part of a player bin
*
* artist (optional) - if video has artist info, this will be sent. Note: this is sometimes dependant on the
*			cliplookup returning info before this function is triggered.
* label (optional) - if video has label info and cliplookup function returns info before this is triggered
*
* Example: alert(infoObj.title);
*
******************************************************************/
function reportMedia(infoObj) {
	//do stuff here
	//alert(infoObj.title+","+infoObj.id);
	Metrics.ReportMedia(infoObj);
}


