// funzione per trovare la altezza massima delle colonne per una riga
function getMaxHeightColonne(group) {
  var tallest = 0;
  group.each(function() {
    var thisHeight = jQuery(this).height();
    if (thisHeight > tallest) {
	  tallest = thisHeight;
    }
  }); //end each
  return tallest;
} //end function
  
function getMaxHeightTextoSliderSingolo(group) {
  var tallest = 0;
  group.each(function() {
    if (jQuery(this).height() > tallest) {
      tallest = jQuery(this).height();
    }
  }); //end each
  return tallest;
} //end function

// gestione altezza blocchi 
$(document).ready(function() {
    for(var i=0; i< jQuery('.riga').length; i++)
    {
        var array = jQuery.merge(jQuery('.riga').eq(i).find('.colonna.Singola .Strillo'), jQuery('.riga').eq(i).find('.colonna.Singola .Slider_singolo .Strillo'));
        array = jQuery.merge(array, jQuery('.riga').eq(i).find('.colonna.Doppia .comunicati_stampa'));
		array = jQuery.merge(array, jQuery('.riga').eq(i).find('.colonna.Doppia .Strillo.Tecnologie'));
		
		if (array.length != 0){
			var maxHeightColonne = getMaxHeightColonne(array);
			var maxHeightText = getMaxHeightTextoSliderSingolo(jQuery('.riga').eq(i).find('.colonna.Singola .Slider_singolo .Strillo .item'));
			//alert("riga:" + i + " maxHeightColonne:" + maxHeightColonne);
			//alert("riga:" + i + " maxHeightText:" + maxHeightText);
			
			array.height(maxHeightColonne);
			if (maxHeightColonne < maxHeightText+80){
				jQuery('.colonna.Singola .Slider_singolo .Strillo').height(maxHeightText+80);
			}
		} //end if
        jQuery('.riga').eq(i).find('.OrizzontaleBarra .item').height(getMaxHeightColonne(jQuery('.riga').eq(i).find('.OrizzontaleBarra .item')));
        jQuery('.riga').eq(i).find('.Orizzontale .item').height(getMaxHeightColonne(jQuery('.riga').eq(i).find('.Orizzontale .item')));
		
    }
});
