// FADE MENU E BOTOES //

$(function() {
    $(".file input[type=file]").each(function() {
        var input = $(this).next();
        console.log(input);
        $(this).css("opacity", 0).change(function() {
            input.val($(this).val());
        });
    });
});
$(document).ready(function() {
    $("div#flash").parent().parent().css("height", "700px");
    $('#brands li div > img:first-child').hide(); 
	
	$("#brands a").mouseover( function () { 
        $(this).parent().children("img:first-child").show(500); 
    }); 
	$("#brands a").mouseleave( function () { 
		$(this).parent().children("img:first-child").hide(500); 
	});
});

$(function() {
	$("#releases-list li a img:first-child").css("opacity", "0");
    $("#top li a, #container2 li a, #releases-list li a img:first-child").hover(function() {
        $(this).stop().animate({
            opacity: 1
        }, 'slow');
    },
	function() {
	    $(this).stop().animate({
	        opacity: $(this).parent("li").hasClass("selected") ? 1 : 0
	    }, 'slow');
	});
});
	
	
// FADE IMAGEM DE FUNDO //


function slideSwitch() {
    var $active = $('#background img.active');

    if ( $active.length == 0 ) $active = $('#fundo img:last');

    // use this to pull the images in the order they appear in the markup
   // var $next =  $active.next().length ? $active.next()
     //   : $('#background img:first');

    // uncomment the 3 lines below to pull the images in random order
    
    var $sibs  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibs.length );
    var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 8000 );
});

