function numRows(total, len_row) {
	var result = Math.floor(total / len_row);

	var modus = total % len_row;
	if (modus > 0) {
		result++; 
	}
	
	return result;
}

jQuery(document).ready(function() {
	var total = jQuery('.topics > .box').length;
	
	var rows = numRows(total, 3);

	for (var i = 0; i < rows; i++) {
		var max_height = 0;
		
		var box_row = jQuery('.topics > .box').slice(i*3, i*3 + 3);
		
		box_row.each(function() {			
			var cur_height = jQuery(this).height();
			
			if (cur_height > max_height) {
				max_height = cur_height;
			}
		});
		
		box_row.height(max_height);
	}
});
