$(document).ready(function()
{
    $('#contentDefaultTitle').show();
    $('#contentDefault').animate({ height : "293px", marginTop : "282px"}, 750);
    $('#contentDefaultContent').show();
    
    $('#contentHome').animate({ height : "49px", marginTop : "510px", paddingTop: "16px"}, 500);
    
    $('#contentPortfolio').animate({ height : "203px", marginTop : "372px"}, 750);
    $('#portfolio').show();
    
    $('.cloud-zoom-gallery').click(function() {
        $id = $(this).attr('id');
        $id = $id.split('_', 2);
        $('.portfolioItemContent').hide();
        $('#portfolio_'+$id[1]).show();
    });
    
    $('#homejCarousel').jcarousel({
        scroll: 1,
        animation: 500,
        wrap: "circular",
        auto: 10
    });
    
    $('#jcarousel').jcarousel({
        scroll: 1,
        animation: 500,
        wrap: "circular",
        auto: 5
    });
    
	$("a[rel='lightbox']").fancybox({
		'opacity'		: true,
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'none',
		'titlePosition' : 'over',
		'overlayColor'	: '#000',
		'overlayOpacity': 0.5,
		'titleFormat'	: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Afbeelding ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
    
	$("a[rel='lightbox2']").fancybox({
		'opacity'		: true,
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'none',
		'titlePosition' : 'over',
		'overlayColor'	: '#000',
		'overlayOpacity': 0.5
	});
    
    $('.innerfade').innerfade({
        animationtype: 'slide',
		speed: 750,
		timeout: 5000,
		type: 'sequence'
	});    
    
    $(".validateForm").validate({
        errorPlacement: function(error, element) {
			error.prependTo( element.parent().next() );
		},
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
    });
});
