<!--
	function maxWidgetHeight(widgets) {
        // Return the height of the tallest widget.
        var height = 0;
        widgets.each(function() { if($(this).height() > height) height = $(this).height(); });
        return height;
    }

    function topmostWidgetYUnder(widgets, y) {
        // Return the y offset of the topmost widget under the given y (lowest y that is greater than y), or -1 if none found.
        var top = -1;
        widgets.filter(function() { return $(this).position().top > y;}).each(function() { if(top == -1 || $(this).position().top < top) top = $(this).position().top; });
        return top;
    }

    function getWidgetRow(widgets, y) {
        // Get all widgets at the given y position.
        return widgets.filter(function() { return $(this).position().top == y; });
    }

    function resizeWidgets(widgets) {
        // Set all widgets' height to the height of the tallest one.
        var height = maxWidgetHeight(widgets);
        widgets.height(height);
    }

    function updateWidgetSizes() {
        var all_widgets = $(this).find('div.widget');
        // First, reset all widgets to their natural height.
        all_widgets.height('auto');

        var y = topmostWidgetYUnder(all_widgets, -1);
        while(y >= 0) {
            var widgets = getWidgetRow(all_widgets, y);
            if(widgets.size() == 0) {
                // This should not happen.
                break;
            }
            resizeWidgets(widgets);
            y = topmostWidgetYUnder(all_widgets, y);
        }
    }

    function activateWidgetResizing(topSelector) {
        //$(topSelector).bind('sortchange', updateWidgetSizes);
		$(topSelector).bind('sortupdate', updateWidgetSizes);
        $(topSelector).trigger('sortupdate');
    }
//-->