(function($){
    $.fn.equalCols = function(){
        //Used to sort the array
        var sortNumber = function(a,b){return b - a;};
        //Empty array
        var heights = [];
        //Save the jQuery object for manipulation at the end
        var $all = this;
       
        return this.each(function(i){
            var $this = $(this);
            //Push all the heights into the array
            heights.push($this.height());
           
            //Once we have looped through all elements
            if($.length === i){
                //Sort the array
                heights.sort(sortNumber);
                //Set all elements to the same height
                $all.css({'height': heights[0]});
            }
        });
    };
})(jQuery);
