$(window).load(function(){
    
    if( window.location.hash == '#animate'){
    
        $('#bg-1').fadeIn('slow', function(){
            $('#topo').animate({top:0}, 1000, 'easeOutBack', function() {
        
                $('#bg-home').fadeTo('slow', 1);
        
                $('.colM').fadeTo('slow', 1, function() {
                    $('.colS').fadeTo('slow', 1, function() {

                    });
                });
            });
        });
    
    } else {
        
        $('#topo').css('top', 0);
        $('#bg-1').show();
        $('#bg-home, .colM, .colS').css('opacity', 1);
        
    }
    
    
    $('#nav a, .link-home').bind('click', function(event) {
        var _self = $(this);
        $('#bg-1').fadeOut('slow', function(){
           if( window.location.pathname+window.location.hash ==  _self.attr('href') ){
               window.location.reload();
           } else {
               window.location.href = _self.attr('href');
           }
          
        });
        return false;
    });
     
});
