// JavaScript Document

$(document).ready(function() {
	
	$("a.fancy-video").click(function() {
		$.fancybox({
			'padding'			: 0,
			'autoScale'			: false,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'title'				: this.title,
			'href'				: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/') + '&autoplay=1&fmt=22',
			'type'				: 'swf',
			'swf'				: {
				'wmode'				: 'transparent',
			'allowfullscreen'	: 'true'
			}
		});

		return false;
	});
	
	
});

 

	$(function(){
 
				$.fn.getTitle = function() {
			var arr = $("a.fancybox");
			$.each(arr, function() {
				var title = $(this).children("img").attr("title");
				$(this).attr('title',title);
			})
		}
 
		// Supported file extensions
		var thumbnails = 'a:has(img)[href$=".bmp"],a:has(img)[href$=".gif"],a:has(img)[href$=".jpg"],a:has(img)[href$=".jpeg"],a:has(img)[href$=".png"],a:has(img)[href$=".BMP"],a:has(img)[href$=".GIF"],a:has(img)[href$=".JPG"],a:has(img)[href$=".JPEG"],a:has(img)[href$=".PNG"]';
 
	
		$(thumbnails).addClass("fancybox").attr("rel","fancybox").getTitle();
 
			$("a.fancybox").fancybox({
			'imageScale': true,
			'padding': 10,
			'zoomOpacity': true,
			'zoomSpeedIn': 250,
			'zoomSpeedOut': 250,
			'zoomSpeedChange': 250,
			'overlayShow': true,
			'overlayColor': "#000000",
			'overlayOpacity': 0.7,
			'enableEscapeButton': true,
			'showCloseButton': true,
			'hideOnOverlayClick': true,
			'hideOnContentClick': false,
			'centerOnScroll': true
		});
 
})
 

