
jQuery.fn.liveUpdate = function(list) {
    list = jQuery(list);
    
    if ( list.length ) {
        var rows = list.find('tbody tr'),
        cache = rows.map(function(t, elem){
                         v = $(elem).children(':lt(2)').text().toLowerCase();
                         return v;
                         });
        
        this
        .keyup(filter).keyup()
        .parents('form').submit(function(){
                                return false;
                                });
    }
    
    return this;
    
    function filter(){
        var term = jQuery.trim( jQuery(this).val().toLowerCase() ), scores = [];
        
        if ( !term ) {
            rows.show();
        } else {
            rows.hide();
            
            cache.each(function(i){
                       var score = this.indexOf(term);
                       if (score >= 0) { scores.push([score, i]); }
                       });
            
            jQuery.each(scores.sort(function(a, b){return b[0] - a[0];}), function(){
                        jQuery(rows[ this[1] ]).show();
                        });
            
        }
        rows.filter(':visible:even').removeClass('even').addClass('odd');
        rows.filter(':visible:odd').removeClass('odd').addClass('even');
    }
};
