$(document).ready(function(){
    var currentDisplayed = $('#first-preview');
    $("#large-play-btn").attr({href : $('#first-preview').parent("a").attr("href")});

	$("#tabs-flow").children("li").each(function() {
        $('.' +$(this).attr("id")).hide();
        currentDisplayed.show();
        $(this).mouseover(function(){
        $("#large-play-btn").attr({href : $(this).children("div.tab-overflow").children("a").attr("href")});
        currentDisplayed.hide();
        currentDisplayed = $('.' +$(this).attr("id"));
        currentDisplayed.show();

        if ($(this).attr("class") != "tab current") {
                $("#tabs-flow").children("li").removeClass("current");
                $("#tabs-flow").children("li").css("color", "#666666");
                $(".active-dayvid").each(function(){
                    $(this).attr({src :  "http://s.cdn.vodst.com/images/picto/black/" + $(this).attr("name") + ".png"});
                });
        }else
                $('.icon-position').children('img').addClass('active-dayvid'); 
        
            $(this).children(".tab-overflow").children(".icon-position").children("img").attr({src : "http://s.cdn.vodst.com/images/picto/colored/" + $(this).attr("id") + ".png"});
                            $(this).css("color", "#FFFFFF");
                            $(this).addClass("current");
                            $(this).css({width: "350px"});       
                    return false;
		});

		$(this).mouseout(function(){
                    if ($(this).attr("class") != "tab current") {
                        $(this).removeClass("current");
                    }
                    else {
                        $("#preview-position").addClass("current");
                        $(this).css("color", "#666666");                        
                    }
                    return false;
		});
	});

});
