jQuery(document).ready(function($){

    // show .navigation_items after page load
    $('body.home #portfolio').slideDown('fast');
    $('body.single-portfolio #portfolio').show();
    $('body.tax-portfolio_categories #portfolio').show();
    
    $('body.blog #blog').slideDown('fast');
    $('body.category #blog').show();
    $('body.date #blog').show();
    $('body.single-post #blog').show();
        
    $('body.tax-clients #clients').show();

    // The navigation's behaviour
    $('.navigation_link').click(function(event) {
        event.preventDefault();
        
        // if it portfolio or blog we need a nearly usual link behaviour
        if ($(this).hasClass('actual_link')) {
            var link = $(this).attr('href');
            $('.navigation_items').slideUp('fast', function () {
	            window.location = link;
	        });	        
	    }
	    // the other items work in-page
	    else {
	        var clicked_item = $(this).attr('corresponds');
            var active_item = $('.navigation_link.active').attr('corresponds');

    	    $('.navigation_link').removeClass('active');
    	    $(this).addClass('active');

    	    $('#'+active_item).slideUp('fast', function () {
    	        $('#'+clicked_item).slideDown('fast');
    	        if ((clicked_item == 'contact') || (clicked_item == 'about') || (clicked_item == 'clients')) {
    	           $('article').fadeOut();
    	           $('#footer').fadeOut();
    	        }
    	        else {
    	            $('article').fadeIn();
    	            $('#footer').fadeIn();
    	        }
    	    });	        
	    }
    });

    // scroll to top for a.toplink
	$('a.toplink').click(function(event) {
	    event.preventDefault();
    	$('html, body').animate({scrollTop:0}, 'fast');
    });
    
    // shadowbox initalization
    
    Shadowbox.init({
        overlayColor: '#fff',
        overlayOpacity: 1
    });
    

});
