jQuery(function(a){a.fn.quicksearch=function(c){function D(E){return(E===null||E===undefined||E===false)?true:false}function A(F){var G=new RegExp(/\<[^\<]+\>/g);var E=F.replace(G,"");E=a.trim(E.toLowerCase().replace(/\n/,"").replace(/\s{2,}/," "));return E}function o(){var E=A(a('input[rel="'+h.randomElement+'"]').val());if(E.indexOf(" ")===-1){return E}else{return E.split(" ")}}function i(E,G,F){if(F==="string"){return z(E,G)}else{return k(E,G)}}function z(E,F){return(F.indexOf(E)>-1)}function k(E,G){for(var F=0;F<E.length;F++){var H=G.indexOf(E[F]);if(H===-1){return false}}return true}function q(E){if(h.hideElement==="grandparent"){return a(E).parent().parent()}else{if(h.hideElement==="parent"){return a(E).parent()}else{return a(E)}}}function v(F){if(C){var E=0;q(F).filter(":visible").each(function(){for(var G=0;G<j;G++){if(E===G){a(this).addClass(h.stripeRowClass[E])}else{a(this).removeClass(h.stripeRowClass[G])}}E=(E+1)%j})}}function p(E){a(E).find("td").each(function(){a(this).attr("width",parseInt(a(this).css("width")))})}function n(F){if(h.loaderId){var E=a('input[rel="'+h.randomElement+'"]').parent().find(".loader");if(F==="hide"){E.hide()}else{E.show()}}}function l(){var F=h.position;var E=h.attached;if(F==="before"){a(E).before(r())}else{if(F==="prepend"){a(E).prepend(r())}else{if(F==="append"){a(E).append(r())}else{a(E).after(r())}}}}function y(){if(!D(h.labelText)){return'<label for="'+h.randomElement+'" class="'+h.labelClass+'">'+h.labelText+"</label> "}return""}function B(){var E=(!D(h.inputText))?h.inputText:"";return'<input type="text" value="'+E+'" rel="'+h.randomElement+'" class="'+h.inputClass+'" id="'+h.randomElement+'" /> '}function g(){if(!D(h.loaderImg)){return'<img src="'+h.loaderImg+'" alt="Loading" id="'+h.loaderId+'" class="'+h.loaderClass+'" />'}else{return'<span id="'+h.loaderId+'" class="'+h.loaderClass+'">'+h.loaderText+"</span>"}}function r(){var E=(!h.isFieldset)?"form":"fieldset";return"<"+E+' action="#" id="'+h.formId+'" class="quicksearch">'+y()+B()+g()+"</"+E+">"}function t(){a('input[rel="'+h.randomElement+'"]').get(0).focus()}function f(){a('input[rel="'+h.randomElement+'"]').focus(function(){if(a(this).val()===h.inputText){a(this).val("")}});a('input[rel="'+h.randomElement+'"]').blur(function(){if(a(this).val()===""){a(this).val(h.inputText)}})}function e(E){return a(E).map(function(){return A(this.innerHTML)})}function x(){l();if(h.fixWidths){p(d)}if(h.focusOnLoad){t()}if(h.inputText!=""&&h.inputText!=null){f()}s=e(d);v(d);n("hide")}function b(){clearTimeout(m);m=setTimeout(function(){n("show");setTimeout(function(){h.onBefore();var E=o();var G=(typeof E);var F=0;E=h.filter(E);if(E!=""){if(typeof w[E]==="undefined"){w[E]=new Array();s.each(function(H){if(i(E,s[H],G)){w[E][H]=true}})}if(w[E].length===0){q(d).hide()}else{a(d).each(function(H){if(w[E][H]){q(this).show()}else{q(this).hide()}})}}else{q(d).show()}v(d)},h.delay/2);setTimeout(function(){n("hide")},h.delay/2);h.onAfter()},h.delay/2)}var h=a.extend({position:"prepend",attached:"body",formId:"quicksearch",labelText:"Quick Search",labelClass:"qs_label",inputText:null,inputClass:"qs_input",loaderId:"loader",loaderClass:"loader",loaderImg:null,loaderText:"Loading...",stripeRowClass:null,hideElement:null,delay:500,focusOnLoad:false,onBefore:function(){},onAfter:function(){},filter:function(E){return E},randomElement:"qs"+Math.floor(Math.random()*1000000),isFieldset:false,fixWidths:false},c);var m;var w={};var j=(!D(h.stripeRowClass))?h.stripeRowClass.length:0;var C=(j>0)?true:false;var d=this;var s;var u=a(this).selector;a.fn.extend({reset_cache:function(){d=a(u);s=e(d)}});x();a('input[rel="'+h.randomElement+'"]').keydown(function(F){var E=F.keyCode;if(!(E===9||E===13||E===16||E===17||E===18||E===38||E===40||E===224)){b()}});a("form.quicksearch, fieldset.quicksearch").submit(function(){return false});return this}});