function resize_koppel(num,columns) { var max_height = 0; for(var i = 0; i <= (num/columns); i++) { for(var j = 1; j <= columns; j++) { var column_no = (i*columns)+j; if(column_no <= num){ var koppel = document.getElementById("koppelbox"+column_no).offsetHeight; if(koppel > max_height){ max_height = koppel; } } } for(var j = 1; j <= columns; j++) { var column_no = (i*columns)+j; if(column_no <= num){ document.getElementById("koppelbox"+column_no).style.height = max_height; } } max_height = 0; } }