Element.implement({
    decorate: function(expression){
        this.addClass('decorated');
        var childs = this.getChildren(expression);
        childs.each(function(e,index){
            e.addClass((index == 0) ? 'first' : '')
            e.addClass((index % 2) ? 'even' : 'odd');
            e.addClass((index == childs.length-1) ? 'last' : '')
        });

        return this;
    },
    createLink: function(){
        if(this.retrieve('linked')) return;
        var a = this.getElement('a')
        if(a){
            this.addEvent('click', function(){
                window.location = a.href;
            })
        }
        this.store('linked', true);
    }
});
