$(document).ready(function(){
	
	initalizeVideoImage();
	
});

function initalizeVideoImage()
{
	$("img.video_image").click(function(){
		var element = $(this).attr("id").replace("_image", "");
		var video_path = site_root+'uploads/resource_manager/'+$(this).attr("title");
		//Set height of video here - maybe take from the image
		$(this).next().find("span").height($(this).parent().height());
		$(this).next().find("span").width($(this).parent().width());
		$(this).next().show();
		loadVideo(element, video_path);
	});
}

function loadVideo(element, video_path)
{
	var height = $("#"+element).height();
	var width = $("#"+element).width();	
	var flashvars = {video_path:video_path, flash_width:width, flash_height:height};
	var params = {allowFullScreen:true, bgcolor: "000000" /*, wmode:"transparent"*/};
	swfobject.embedSWF(site_root+"flash/Video_Player.swf", element, width, height, "9.0.0", "expressInstall.swf", flashvars, params);
}

function removeVideo(element)
{
	swfobject.removeSWF(element);
}
