/** Add a case insensitive Contains expression to jQuery so make our filtering easier */
jQuery.expr[':'].Contains = function (a, i, m) {
	return (
			a.textContent ||
			a.innerText ||
			""
		).toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
};

/** Sample filter method: */

function listFilter() {
	var val,
		$list = $("ul.filterable-list");	

	$("#search").on("keyup", function() {
		val = $(this).val();
	
		//don't do anything unless we have at least 3 chars
		if (val.length > 2) {
			//hide all the immediate children things
			$list.find(">li").hide();
			//find the stuff we want
			$list.find(">li:Contains("+val+")").show();
		}
		else {
			//show all the things
			$list.find(">li").show();
		}
	
	});

}