/***********************************************************/
/*                    LiveFilter Plugin                    */
/*                      Version: 1.1                       */
/*                      Mike Merritt                       */
/*             	    Updated: Feb 2nd, 2010                 */
/* pretty much compeltely changed by xian                  */
/***********************************************************/

(function($){  
	$.fn.liveFilter = function (input_selector) {
	  var list = $(this)
		
		function filterize() {
			var filter = $(this).val();
			
			// Hide all the items and then show only the ones matching the filter
			list.find("li").hide();
			list.find("li:Contains(" + filter + ")").show();
		}
		// Listen for the value of the input to change
		$(input_selector).keyup(filterize);
		$(input_selector).change(filterize);
		$(input_selector).click(filterize);
		
		// Custom expression for case insensitive contains()
		jQuery.expr[':'].Contains = function(a,i,m){
		    return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0;
		};

	}

})(jQuery);
