$(document).ready(function(){

	// playFullScreenVideo
	$("a.play_fs_video").click(function(){
		yt_id = youtubeIDextract($(this).attr("href"));
		playFullScreenVideo(yt_id);
		return false;
	}); //end playFullScreenVideo

}); //end doc. ready


function playFullScreenVideo(video_id) {
var video_height = $(window).height();
var topPadding = $(window).scrollTop();
$(document.body).css("overflow","hidden");
	if ($("#video_wrap").length==0) {
		$("<div id='video_wrap'><div id='fs_video'><\/div><\/div>").appendTo("body");
		$("#video_wrap")
			.css("height", $(document).height())
			//.css("opacity",0.4) experimental ghost video effect :)
			.css("padding-top",topPadding)
	}
	$("#fs_video").html("<embed width='100%' wmode='transparent' height='" + video_height + "px' name='plugin' src='http://www.youtube.com/v/" + video_id + "&autoplay=1&rel=0' type='application/x-shockwave-flash'>");
	$("<a id='fs_video_close' href='#'>Bezár<\/a>").appendTo("#fs_video");
	$("#fs_video_close").click(function(){
		closeFullScreenVideo();
		
		return false;
	});
} //end playFullScreenVideo

function closeFullScreenVideo() {
	$("#video_wrap").remove();
	$(document.body).css("overflow","visible");
} //end closeFullScreenVideo


function youtubeIDextract(url) {
	var youtube_id;
		youtube_id = url.replace(/^[^v]+v.(.{11}).*/,"$1");
		return youtube_id;
} //end youtubeIDextract
