/*
    Get the maximum height from divs with passed class as argument
    Djamil Legato <djamil@djamil.it>
    For Andy Miller
*/

var maxHeight = function(classname) {
    var divs = document.getElements(classname);
    var max = 0;
    divs.each(function(div) {
        max = Math.max(max, div.getSize().size.y);
    });
	divs.setStyle('height', max);
    return max;
};

window.addEvent('load', function() { 
	if (!window.ie6) {
		maxHeight('#mainmodules .block  div div div');
		maxHeight('#mainmodules2 .block div div div');
	};
	maxHeight('div.main-height');

	// upcoming events fix
	// fix maxHeight, it is applying the height to all divs inside of a modules output
	// so it is making each event way too tall, causing only one to be display
	var divs = document.getElements('#mod-upcoming-events div');
	divs.setStyle('height', null);
	
	divs = document.getElements('.newsfeed_item');
	divs.setStyle('height', null);
});
