$(function(){
    function moveDown(moveTarget) {
        moveTarget.children(".video-slider").stop().animate({
            top: '42'
        },200,function(){
            $(this).parent().removeClass("active");
        });
    }

    $("header #video-area nav ul li").hover(function(){
        $(this).addClass("active");
        $(this).children(".video-slider").stop().animate({
            top: '-337'
        },200);
    },function(){
        moveDown($(this));
    });
    
    $(".video-slider a").click(function(){
        if ($("#currentvideo").attr("src") != $(this).attr("href")) {
            $("#currentvideo").attr("src",$(this).attr("href")+"?rel=0&modestbranding=1&showinfo=0&controls=0&wmode=transparent&autoplay=1");
            moveDown($(this).parent().parent());
        }
        return false;
    });
    
    $("#currentvideo").attr("src",$("#video-area nav ul li:eq(0) .video-slider a").attr("href")+"?rel=0&modestbranding=1&showinfo=0&controls=0&wmode=transparent");
    
});
