$(function() {
	/* animatie in visuals */
	//$('.overlay2-a, .overlay2-b').delay(500).animate({ opacity: 1 }, 1000);

if (typeof $.fn.nivoSlider === 'function') {	// moet uit staan voor homepage
    $('#slider').nivoSlider({
		effect:'fold', // Specify sets like: 'fold,fade,sliceDown'
        slices:15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed:500, // Slide transition speed
        pauseTime:5500, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:false, // Next & Prev navigation
        directionNavHide:true, // Only show on hover
        controlNav:false, // 1,2,3... navigation
        controlNavThumbs:false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav:true, // Use left & right arrows
        pauseOnHover:true, // Stop animation while hovering
        manualAdvance:false, // Force manual transitions
        captionOpacity:1, // Universal caption opacity
        prevText: '&laquo;&nbsp;vorige', // Prev directionNav text
        nextText: 'volgende&nbsp;&raquo;', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){
			if( $('#slider').data('nivo:vars').totalSlides < 2 ) {	// schakel animaties uit als er maar 1 slide is
				$('#slider').data('nivo:vars').stop = true;
			}			
		} // Triggers when slider has loaded					
	});
}
	/* maakt content grid passend */
	$('.grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6, .grid_7').not('.inner').each(function() {
		height = $(this).outerHeight();

		rest = height % 139;
		
		if(rest != 0) {
			diff = height / 140;
			diff = Math.floor(diff);
			pix = parseInt( ( 139 * (diff + 1) ) + diff );
			$(this).attr('style', 'height: '+pix+'px !important');	/* ugly fix for non webkit browsers */
		}
	});
	
});
