function decorateTable(table){
    table = $(table);
    if(table){
        var allRows = table.select('tr')
        var bodyRows = table.select('tbody tr');
        var headRows = table.select('thead tr');
        var footRows = table.select('tfoot tr');

        for(var i=0; i<bodyRows.length; i++){
            if((i+1)%2==0) {
                bodyRows[i].addClassName('even');
            }
            else {
                bodyRows[i].addClassName('odd');
            }
        }

        if(headRows.length) {
          headRows[0].addClassName('first');
          headRows[headRows.length-1].addClassName('last');
        }
        if(bodyRows.length) {
          bodyRows[0].addClassName('first');
          bodyRows[bodyRows.length-1].addClassName('last');
        }
        if(footRows.length) {
          footRows[0].addClassName('first');
          footRows[footRows.length-1].addClassName('last');
        }
        if(allRows.length) {
            for(var i=0;i<allRows.length;i++){
                var cols =allRows[i].select('TD');
                if(cols.length && cols[cols.length-1].hasClassName('row')) {
                    Element.addClassName(cols[cols.length-1], 'last');
                };
            }
        }
    }
}
