$(document).ready( function() 
{		
	var ACTIVE_VIDEO_CLASS_STYLE_NAME = "active-video"
	var videoPlayers = [];
	var videoCounter = 0;
	
	$(".videoItem").each(function(i) 
	{
		$(this).removeAttr("href");
		
		if($(this).parent().get(0).tagName == "P")
		{
			// console.info("Parent is <p> tag")
			$(this).parent().addClass("collapseParagraph")
		}
		
		$(this).click( function(i) 
		{
			$("."+ACTIVE_VIDEO_CLASS_STYLE_NAME).each( function() 
			{
				$(this).removeClass(ACTIVE_VIDEO_CLASS_STYLE_NAME)
			})
			
			$(".videocontainer").each(function()
			{
				// &(this).parent("h3"); // .removeClass("active");
				$(this).hide();
			})
			
			$(this).find(".videocontainer").parent().find("h3").addClass(ACTIVE_VIDEO_CLASS_STYLE_NAME);
			$(this).find(".videocontainer").addClass(ACTIVE_VIDEO_CLASS_STYLE_NAME)
			$(this).find(".videocontainer").show();
			
		})
		
		videoPlayers.push({ htmlId:"videoplayer"+i, url:""  })
		
		$(this).find(".videocontainer").hide();
		
		
	})
	
	
	var l = videoPlayers.length;
	
	for(var i = 0; i<l; i++)
	{
		var minFlashVersion = "9.0.0";
		var expressInstallSwf = false;
		var contentSwf = "http://fireflyband.co.uk/wp-content/themes/firefly/swf/videoplayer.swf";
		var contentContainer = videoPlayers[i].htmlId;
		var contentWidth = "400px";
		var contentHeight = "250px";
		var contentFlashvars = { xml: 'xml/galleries.xml', isAutoPlay:true, videoUrl:"http://fireflyband.co.uk/wp-content/themes/firefly/swf/TITLE01-ANGLE1_2.mp4", playerWidth:400, playerHeight:250 }
		var contentParams = { domain: "*", allowFullScreen: "true", allowscriptaccess: "always"};
		var contentAttributes = { id: "video"+i };

		swfobject.embedSWF( 
			contentSwf, 
			contentContainer, 
			contentWidth, 
			contentHeight, 
			minFlashVersion, 
			expressInstallSwf, 
			contentFlashvars, 
			contentParams, 
			contentAttributes );
			
	}
	
	// alert("dslkjl")
	
})
