$(function(){
	ranking_layout();
});

function ranking_layout(){
	var i = 0;
	var height = Array();
    $(".bestBox").each(function(){
    	/*
    	if( $(this).find('p').text().length  > 10){
    		var text = $(this).find('p').text();
    		$(this).find('p').html(text.replace(/([（|法律|\s])/,'<br />$1'));
    	}
    	*/
    	i++;
    	height[i] = $(this).height();
    	if(i % 4 == 0){
    		var top_height = 0;
      		for(var n = i-3; n <= i; n++){
    			if(top_height < height[n]){
    				top_height = height[n];
    			}
    		}
    		for(var n = i-3; n <= i; n++){
    			$('.bestBox').height(top_height);
    		}
    	}
    });
}
