(function(b,i){b.fn.quicksearch=function(j,m){var k,l,e,d,h="",f=this,a=b.extend({delay:100,selector:null,stripeRows:null,loader:null,noResults:"",bind:"keyup",onBefore:function(){},onAfter:function(){},show:function(){this.style.display=""},hide:function(){this.style.display="none"},prepareQuery:function(a){return a.toLowerCase().split(" ")},testQuery:function(a,b){for(var g=0;g<a.length;g+=1)if(b.indexOf(a[g])===-1)return!1;return!0}},m);this.go=function(){for(var c=0,b=!0,g=a.prepareQuery(h),d=
h.replace(" ","").length===0,c=0,f=e.length;c<f;c++)d||a.testQuery(g,l[c],e[c])?(a.show.apply(e[c]),b=!1):a.hide.apply(e[c]);b?this.results(!1):(this.results(!0),this.stripe());this.loader(!1);a.onAfter();return this};this.stripe=function(){if(typeof a.stripeRows==="object"&&a.stripeRows!==null){var c=a.stripeRows.join(" "),e=a.stripeRows.length;d.not(":hidden").each(function(d){b(this).removeClass(c).addClass(a.stripeRows[d%e])})}return this};this.strip_html=function(a){a=a.replace(RegExp("<[^<]+>",
"g"),"");return a=b.trim(a.toLowerCase())};this.results=function(c){typeof a.noResults==="string"&&a.noResults!==""&&(c?b(a.noResults).hide():b(a.noResults).show());return this};this.loader=function(c){typeof a.loader==="string"&&a.loader!==""&&(c?b(a.loader).show():b(a.loader).hide());return this};this.cache=function(){d=b(j);typeof a.noResults==="string"&&a.noResults!==""&&(d=d.not(a.noResults));l=(typeof a.selector==="string"?d.find(a.selector):b(j).not(a.noResults)).map(function(){return f.strip_html(this.innerHTML)});
e=d.map(function(){return this});return this.go()};this.trigger=function(){this.loader(!0);a.onBefore();i.clearTimeout(k);k=i.setTimeout(function(){f.go()},a.delay);return this};this.cache();this.results(!0);this.stripe();this.loader(!1);return this.each(function(){b(this).bind(a.bind,function(){h=b(this).val();f.trigger()})})}})(jQuery,this,document);
