$(document).ready(function() {

	$('#other_videos a').hover(function() {
		$(this).parent('li').addClass('hover');
	}, function() {
		$(this).parent('li').removeClass('hover');
	});

	$('#other_videos a').click(function() {
		var thisTarget = $(this).attr('href');
		thisTarget = thisTarget.replace(/#/,'');
		//console.debug(thisTarget);

		$(this).parent('li').parent('ul').children('li').each(function(index) {
			$(this).removeClass('active');
		});
		$(this).parent('li').addClass('active');
		var title = $(this).parent('li').text();
		
		s1.addParam("flashvars","file=http://ny-law-firm.com/video/small/"+theVideos[thisTarget]+".flv&autostart=true&plugins=googlytics-1&title="+title+"");
		s1.write("container");
		
		return false;
	});
	
	// Nav
	$('#nav a.qmparent:first').css('border', 'none');

});

// This will track when the video's are clicked and send it to Google Analytics
var player;
function playerReady(obj) 
{
	//console.log(obj);
	var id = obj['id'];
	var version = obj['version'];
	var client = obj['client'];
	player = document.getElementById(id);
	player.addControllerListener("PLAY","playerPlay");
	player.addControllerListener("STOP","playerStop");
}		
function playerPlay(obj)
{
	//console.log(obj);
	var title = player.getConfig().title;

	if (obj.id=="ply")
		var home = " - Homepage";
	else
		var home = "";
		
	if (obj.state==true)
	{
		pageTracker._trackEvent('Videos'+home, 'Play', title );
		return true;
	}
	if (obj.state==false)
	{
		pageTracker._trackEvent('Videos'+home, 'Paused', title );
		return true;
	}
}
function playerStop(obj)
{
	//console.log(obj);
	var title = player.getConfig().title;

	if (obj.id=="ply")
		var home = " - Homepage";
	else
		var home = "";
		
	pageTracker._trackEvent('Videos'+home, 'Stopped', title );
	return true;
}