(function($) {
	
	function filterInput( e ){
		
		var oInput = $(this);
		var val = oInput.val();
		var re  = new RegExp( val.replace(/\s+/g,''), "i");
		var oItems = $(oInput.data('if_options').item);
		
		if( val.replace(/\s+/g,'') != '' ){
			oItems.each(function(){
				if( !$(this).text().replace(/\s+/g,'').match(re) ){
					$(this).hide();
				}else{
					$(this).show();
				}
			});
		}else{
			oItems.show();
		}
	}
		
	$.fn.inputFilter = function( options ){
		
		$(this)
			.filter(':text')
			.unbind('keyup', filterInput )
			.data( 'if_options' , options )
			.keyup( filterInput );
	}
	
})(jQuery);


