jQuery(document).ready(function(){
    jQuery('.video-preview-button').each(function(){
	jQuery(this).fancybox({
		'titleShow'     : false,
		'transitionIn'  : 'elastic',
		'transitionOut' : 'elastic',
		'height':400,
		'width':600,
		'href' : jQuery(this)[0].href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
		'type'      : 'swf',
		'swf'       : {'wmode':'transparent','allowfullscreen':'true'} 
	    });
    });

    // fix the last child menu 
    jQuery("body #wrapper #main .main-aside ul li ul li:last-child").css("border-bottom","0");
    
    // add a home button
    jQuery(".sf-menu").prepend("<li><a href='/'>Home</a></li>"); 

    jQuery(".sf-menu>li").each(function(){
	var first_anchor = jQuery(this).find(">ul>li:first-child").clone();
	jQuery(first_anchor).find("a").attr("href",jQuery(this).find(">a").attr("href")).text("Overview").attr("title","");
	jQuery(first_anchor).find("ul").remove();
	jQuery(this).find(">ul").prepend(first_anchor)
    });
});
