jQuery(document).ready(function()
{
	//Initialize video modal block.
	window.videos_modal_block = new videos_modal_block("video_container_wrapper");

	//Set hide hook to stop video once hidden.
	window.videos_modal_block.set_hide_hook(function(){jQuery("#video_iframe").attr("src", "about:blank");});

	//Locate video links and setup onclick.
	jQuery("a[rel=video]").each(function()
	{
		jQuery(this).click(function(event)
		{
			event.preventDefault();

			//We resize the video container here to the default before playback.
			//The "It Works!" video modifies this, so it must be set back to defaults for the other videos.
			//This is rinky dink, but the number of low number of videos present do not warrant a better fix at this time.
			//Also, IE7 is a pain to deal with.
			//Eventually, the video should resize automatically, or with predefined values at the link level.
			//Reliance on iframes should eventually be removed.
			jQuery("#video_iframe").css({"height":"400px", "width":"640px"});
			jQuery("#video_container_wrapper").css({"height":"400px", "width":"640px"});
			jQuery("#video_container_wrapper .close_video").css({"width":"635px"});
			jQuery("#video_container_wrapper .video_box_div").css({"height":"400px", "width":"640px"});

			jQuery("#video_iframe").attr("src", jQuery(this).attr("href"));
			window.videos_modal_block.show();
			window.videos_modal_block.position_block();
		});
	});

	//Locate video close button and setup onclick.
	jQuery("#video_container_wrapper a").each(function()
	{
		jQuery(this).click(function(event)
		{
			event.preventDefault();
			window.videos_modal_block.hide();
		});
	});
});

