// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

// fancybox pop out when select a video (http://fancybox.net/)
// source: http://webdesignandsuch.com/fancybox-youtube-videos/
// In Project:
//   @include_js = "jquery" for the controller or action
//   <a class="video" href="..." title="..."><img src="..." /></a> in the source code
//   href="http://www.youtube.com/watch?v=KV9Ad-4UNuI?fs=1&amp;autoplay=1" as an example (autoplay and fs parameters recommended)
jQuery(document).ready(function() {
	$(".video").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'title'			: this.title,
			'width'			: 524,
			'height'		: 400,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'				: {
				'wmode'				: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});
		return false;
	});
});

