var isVideoPlaying;
var checkDiv;
function callJavascript(p_string){
	playThisVideoFile(p_string);
	
}
function playThisVideoFile(p_string) {
	videoName = p_string;
	isVideoPlaying = true;
	//var sendText = p_string;
	window.document.FLVPlayer.SetVariable("currentVidName", videoName);
}
var valueFromFlash;
function vid_anylatics_sendData(p_value) {
	var page_title = ( typeof( omni_override_title ) == 'undefined' ) ? playerName : omni_override_title;
	isVideoPlaying = false;
	valueFromFlash = p_value;
	s.linkTrackVars='eVar44,prop11,prop12,eVar14,prop17,events';
	s.linkTrackEvents='event21,event23,event24';
	s.eVar44 = playerName+"|Video Play|"+videoName;
	s.prop11 = playerName;
	s.prop12 = playerName+"|Video Play|"+videoName;
	s.eVar14 = playerName+"|"+videoName+"|"+valueFromFlash;
	s.prop17 = playerName+"|"+videoName+"|"+valueFromFlash;
	//commented out as request from jason egan on 12-12-07 at 4:18pm
	//s.pageName = basePageName+":" + page_title + ":"+videoName;
	s.ch = "Video";
	s.events = "event21,event23,event24";
	sCode();
	//s_account="jtvprod";
	//var s_code=s.t();if(s_code)document.write(s_code);
	checkDiv = document.getElementById("status");
	if(checkDiv) {
		document.getElementById("status").innerHTML = "Received <span style='color: #FF0000;'>"+valueFromFlash+"</span> from the video player.  Submitting <span style='color: #FF0000;'>"+s.prop17+"</span> to Omniture.";
	}
}

//submits previously played file's info to omniture when new file is selected.
function vid_anylatics_previousFileData(p_prevVid,p_flashValue) {
	var page_title = ( typeof( omni_override_title ) == 'undefined' ) ? playerName : omni_override_title;
	isVideoPlaying = true;
	s.linkTrackVars='eVar44,prop11,prop12,eVar14,prop17,events';
	s.linkTrackEvents='event21,event23,event24';
	s.eVar44 = playerName+"|Video Play|"+p_prevVid;
	s.prop11 = playerName;
	s.prop12 = playerName+"|Video Play|"+p_prevVid;
	s.eVar14 = playerName+"|"+p_prevVid+"|"+p_flashValue;
	s.prop17 = playerName+"|"+p_prevVid+"|"+p_flashValue;
	//commented out as request from jason egan on 12-12-07 at 4:18pm
	//s.pageName = basePageName+":" + page_title + ":"+p_prevVid;
	s.ch = "Video";
	s.events = "event21,event23,event24";
	sCode();
	//s_account="jtvprod";
	//var s_code=s.t();if(s_code)document.write(s_code);
	checkDiv = document.getElementById("status");
	if(checkDiv) {
		document.getElementById("status").innerHTML = "Received <span style='color: #FF0000;'>"+p_flashValue+"</span> from the video player.  Submitting <span style='color: #FF0000;'>"+s.prop17+"</span> to Omniture.";
	}
}
function vid_anylatics_sendSeconds(p_value) {
	valueFromFlash = p_value;
	//added 02-01-08 by Himanshu patel @ 10:22am to enable leave() function when single video is embedded on page.
	if(valueFromFlash.substr(0,1) == "0") {
		isVideoPlaying = false;	
	} else {
		isVideoPlaying = true;
	}
	checkDiv = document.getElementById("5SecUpdate");
	if(checkDiv) {
		document.getElementById("5SecUpdate").innerHTML = "Received <span style='color: #FF0000;'>"+p_value+"</span> from the video player.  Saving data and will transmit upon exit.";
	}
	
}

//submits info to omniture when page is closed or reloaded.
function leave() {
	//if video is playing and page is closed or reloaded then file info is submitted to omniture.
	var page_title = ( typeof( omni_override_title ) == 'undefined' ) ? playerName : omni_override_title;
	if(isVideoPlaying==true) {
		s.linkTrackVars='eVar44,prop11,prop12,eVar14,prop17,events';
		s.linkTrackEvents='event21,event23,event24';
		s.eVar44 = playerName+"|Video Play|"+videoName;
		s.prop11 = playerName;
		s.prop12 = playerName+"|Video Play|"+videoName;
		s.eVar14 = playerName+"|"+videoName+"|"+valueFromFlash;
		s.prop17 = playerName+"|"+videoName+"|"+valueFromFlash;
		//commented out as request from jason egan on 12-12-07 at 4:18pm
		//s.pageName = basePageName+":" + page_title + ":"+videoName;
		s.ch = "Video";
		s.events = "event21,event23,event24";
		sCode();
		isVideoPlaying = false;
		//s_account="jtvprod";
		//var s_code=s.t();if(s_code)document.write(s_code);
	}
}

//added 12-12-07 at 4:19pm by Himanshu Patel
function sCode() {
	s_account="jtvprod";
	//new code
	var s_code=s.tl(this,'o','Video Play');
	//existing code
	//var s_code=s.t();
	if(s_code)document.write(s_code);
	
}
function functionExists(p) {
	if (typeof vid_anylatics_sendSeconds=="function")
	{
		return p;
		//send validation to flash player here.
		//window.document.FLVPlayer.SetVariable("functionExists", "true");
	}
}
