//Columns, Copyright (c) 2008-2009 Vini Dy, <http://www.vinidy.com>, MIT Style License.

var Columns = new Class({
    Implements: Options,

    options: {
        elementToHeighten: '',
        elementsToCompare: []
    },

    initialize: function(options) {
        this.setOptions(options);
        
        this.content = document.getElement(this.options.elementToHeighten);
        this.sidebars = this.options.elementsToCompare.map(function(item) {
            return $(item);
        });
        
        this.compare();
    },
    
    compare: function() {
        this.sidebars.each(function(item) {        
            if(item.getStyle('height').toInt() > this.content.getStyle('height').toInt()) {
                this.heighten(this.content, item.getStyle('height').toInt());
            }
        }.bind(this));
    },
    
    heighten: function(element, newHeight) {
        element.setStyle('height', newHeight);
    }
    
});
