jQuery.fn.liveUpdate = function(list){
  list = jQuery(list);
  if ( list.length ) {
    var rows = list.children('li'),
      cache = rows.map(function(){

        return this.innerHTML.toLowerCase().replace(/(\r\n|[\r\n])/g, "");
      });
    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 {    
      cache.each(function(i){
	 var score = LiquidMetal.score(this,term);
	  if (score >  0.0) { 
	  rows.hide();
	  scores.push([score, i]); 
       }
	
      });

      jQuery.each(scores.sort(function(a, b){return b[0] - a[0];}), function(){
        jQuery(rows[ this[1] ]).show().addClass('shown');
      });
    }
  }
};
