jQuery Definir Altura do Elemento para Maior no grupo

Eu estou tentando trabalhar com jQuery para encontrar o elemento mais alto dos primeiros 3 elementos dentro de um div, em seguida, definir todos os 3 a mesma altura, em seguida, verificar os próximos 3 e defini-los .. etc .. se minha largura da janela == X, também Se a largura da janela for <X, encontre os 2 elementos mais altos, depois defina-os, depois os 2 seguintes, os 2 seguintes, etc.

Este é o meu código atual que funciona para todos os elementos, gostaria apenas de percorrer os elementos em grupos (2's e 3's) e definir a altura para esse grupo com base no tamanho do resultado e da janela.

// Find highest element and set all the elements to this height.
    $(document).ready(function () {

    // Set options
    var height = 0;
    var element_search = "#cat_product_list #cat_list";
    var element_set = "#cat_product_list  #cat_list";

    // Search through the elements set and see which is the highest.
    $(element_search).each(function () {
        if (height < $(this).height()) height = $(this).height();
        //debug_(height,1);
    });

    // Set the height for the element(s if more than one).
    $(element_set).each(function () {
        $(element_set).css("height", (height+40) + "px");
    });
});

Qualquer ajuda é muito apreciada :)

questionAnswers(3)

yourAnswerToTheQuestion