$(document).ready(function() {
	// boxes same height
	/*
	var h = 0;
	$('.box').each(function() {
		h = Math.max(h, $(this).height());
	});
	$('.box').height(h);
	*/
	equalHeightBoxes();

	// slider
	$('#images').nivoSlider({
        effect:'fold,boxRain,boxRainGrow,boxRandom', // Specify sets like: 'fold,fade,sliceDown'
        animSpeed:900, // Slide transition speed
        pauseTime:2700, // How long each slide will show
		directionNav:false,
		controlNav:false,
		pauseOnHover:false,
		randomStart:true
    });
});

// make neighboring boxes equal height
var equalHeightBoxes = function() {
	var row = 0;
	var count = 0;
	var height = 0;
	
	$('.box').each(function() {
		$(this).addClass('row'+row);
		height = Math.max(height, $(this).height());
		count++;
		
		if (count >= 2) {
			// equalize
			$('.box.row'+row).css('min-height', height + 1);
			
			// reset
			count = 0;
			height = 0;
			row++;
		}
	});
}


