jQuery(document).ready(function() {

	/*** fancybox ***/
	var thumbnails = 'a:has(img)[href$=".gif"], a:has(img)[href$=".jpg"], a:has(img)[href$=".jpeg"], a:has(img)[href$=".png"], a:has(img)[href$=".GIF"], a:has(img)[href$=".JPG"], a:has(img)[href$=".JPEG"], a:has(img)[href$=".PNG"]';
	jQuery(thumbnails).attr('rel', 'fancybox');
	jQuery('a[rel=fancybox]').fancybox({
		'titlePosition'	: 'over'
	});
	
	jQuery('a.video').click(function() {
		jQuery.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
				'wmode'				: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});
		return false;
	});
	
	jQuery('a.video-playlist').click(function() {
		jQuery.fancybox({
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'padding'		: 0,
			'autoScale'		: false,
			'title'			: this.title,
			'width'			: 640,
			'height'		: 385,
			'href'			: this.href.replace(new RegExp("view_play_list\\?p=", "i"), 'p/'),
			'type'			: 'swf',
			'swf'			: {
				'wmode'				: 'opaque',
				'allowfullscreen'	: 'true'
			}
		});
		return false;
	});

	/*** shuttle info ***/
	jQuery('#shuttle').mouseenter(function() {
		jQuery('#shuttle-info').css({'display': 'block', 'opacity': '0'});
		jQuery('#shuttle-info').animate({
			'opacity': '1'
		}, 1000, function() {
			// animation complete
		});
	});
	jQuery('#shuttle').mouseleave(function() {
		jQuery('#shuttle-info').animate({
			'opacity': '0'
		}, 1000, function() {
			jQuery('#shuttle-info').css({'display': 'none'});
		});
		
	});

});
