function slideSwitch() {
    var $active = $('#beeld img.active');

    if ( $active.length == 0 ) $active = $('#beeld img:last');

    var $next =  $active.next().length ? $active.next() : $('#beeld img:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 2500, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
	if($('#beeld img').length > 1)
	{
		setInterval( "slideSwitch()", 5000 );
	}
	
	$('#content a>img').not('#content a.no-fancybox img').click(function(){
		var link = $(this).parent();
		var href = link.attr('href');
		var ext = /^.+\.([^.]+)$/.exec(href.substr(-5));
		var ext = ext == null ? "" : ext[1];
		
		if(ext != 'zip' && ext != 'xls' && ext != 'doc' && ext != 'pdf' && ext != '')
		{
			$(link).fancybox({
				'transitionIn'	:	'fade',
				'transitionOut'	:	'fade',
				'speedIn'		:	600, 
				'speedOut'		:	200, 
				'overlayShow'	:	true
			});
		}
	});
});
