function matchPanels()
{
    var first = true;
    var addHeight, columnBlocks, lastBlock, contentBlock, nameHighest, pTop, pBottom, contentBlockBottomHeight, newHeight;
    var highest_col = 0;
    var index = 0;
    var dimensions = {};
    var panels=new Array;

    //array of columns
    panels['left']= {
        className: 'col-left'
    };
    panels['middle'] = {
        className: 'col-main'
    };
    panels['right'] = {
        className: 'col-right'
    };

    //foreach on all columns - calc the height
    for (var key in panels) {
        if (panels.hasOwnProperty(key)) {
            $$('.'+panels[key].className).each(function(column){
                dimensions = column.getDimensions();
                panels[key].height = dimensions.height;
            });
            //get the highest column
            if(first)
            {
                highest_col = panels[key].height;
                nameHighest = key;
                first = false;
            }
            else
            {
                if (highest_col < panels[key].height)
                {
                    highest_col = panels[key].height;
                    nameHighest = key;
                }
            }
        }
    }
    // add height
    for (var key in panels) {
        if (panels.hasOwnProperty(key) ) {
            $$('.'+panels[key].className).each(function(column , index){
                if(key != nameHighest)
                {
                    if(key != "middle")
                    {
                        columnBlocks = $(column).getElementsByClassName('block');
                        lastBlock = columnBlocks[columnBlocks.length-1];
                        contentBlock = lastBlock.getElementsByClassName('block-content')[0];
                        addHeight = (panels[nameHighest].height - panels[key].height);
                        pTop = contentBlock.getStyle('padding-top');
                        pTop = pTop.sub('px','');
                        pTop = parseInt(pTop);
                        pBottom = contentBlock.getStyle('padding-bottom');
                        pBottom = pBottom.sub('px','');
                        pBottom = parseInt(pBottom);
                        newHeight = contentBlock.getHeight()-pTop-pBottom+addHeight;
                        contentBlock.setStyle({
                            height : newHeight+'px'
                        });                       
                    }
                    else
                    {
                        columnBlocks = $(column).getElementsByClassName('main-content');
                        contentBlock = columnBlocks[0];
                        pTop = contentBlock.getStyle('padding-top');
                        pTop = pTop.sub('px','');
                        pTop = parseInt(pTop);
                        pBottom = contentBlock.getStyle('padding-bottom');
                        pBottom = pBottom.sub('px','');
                        pBottom = parseInt(pBottom);
                        contentBlockBottomHeight = $(column).getElementsByClassName('main-content-bottom')[0].getHeight();
                        newHeight = panels[nameHighest].height - column.getHeight() - pTop - pBottom - contentBlockBottomHeight;
                        contentBlock.setStyle({
                            height :(contentBlock.getHeight()+newHeight)+'px'
                        });
                    }
                }
            });
        }
    }
}
