		$(document).ready(function(){
			var $vids = $('.rs-videos li a.video'),
			    endpoint = 'http://www.vimeo.com/api/oembed.json',
			    callback = 'embedVideo',
			    url = '';
		    
			$vids.each(function(){
		        url = endpoint + 
		              '?url=' + encodeURIComponent( this ) + 
		              '&callback=' + callback + 
		              '&width=640';
	            $('body').append( ["<script type='text/javascript' src='", url, "'><\/script>"].join('') );
			});
		});

        // This function puts the video on the page
        function embedVideo(video) {
            var $a = $(['a[href="http://vimeo.com/', video.video_id, '"]'].join(''));
            $a.html( ['<img src="', unescape(video.thumbnail_url), '" />'].join('') );

        	$a.click(function() {
    			$.fancybox({
    				'opacity'			: false,
    				'overlayShow'		: false,
    				'transitionIn'		: 'none',
    				'transitionOut'		: 'none',
    				'centerOnScroll'	: true,
    				'margin'			: '0',
    				'padding'			: '0',
    				'width'				: '640',
    				'height'			: '360',
    				'autoDimensions'	: false,
    				'scrolling'			: 'no',
    				'type'				: 'swf',
    				'href'				: this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1')
    			});

        		return false;
        	});
        }
