$(document).ready(function(){
	$("div.video a").each(function(){
		$(this).after('<span class="play"></span>');
		url = $(this).attr('href');
		$(this).next("span").attr("data-url",url);
		$(this).next("span").addClass("not-loaded").click(function(){
			
			$(this).fancybox({
						'padding'		: 0,
						'autoScale'		: false,
						'transitionIn'	: 'none',
						'transitionOut'	: 'none',
						'title'			: this.title,
						'width'			: 680,
						'height'		: 495,
						'href'			: $(this).attr("data-url").replace(new RegExp("watch\\?v=", "i"), 'v/'),
						'type'			: 'swf',
						'swf'			: {
						'wmode'			: 'transparent',
						'allowfullscreen'	: 'true'
						}
					});
					if($(this).hasClass("not-loaded")){
						$(this).removeClass("not-loaded").trigger("click");
					}
		});
	});
});
