jQuery.extend({highlight:function(a,h,f,d){if(a.nodeType===3){var g=a.data.match(h);if(g){var e=document.createElement(f||"span");e.className=d||"highlight";var b=a.splitText(g.index);b.splitText(g[0].length);var i=b.cloneNode(true);e.appendChild(i);b.parentNode.replaceChild(e,b);return 1}}else if(a.nodeType===1&&a.childNodes&&!/(script|style)/i.test(a.tagName)&&!(a.tagName===f.toUpperCase()&&a.className===d))for(var c=0;c<a.childNodes.length;c++)c+=jQuery.highlight(a.childNodes[c],h,f,d);return 0}});jQuery.fn.unhighlight=function(b){var a={className:"highlight",element:"span"};jQuery.extend(a,b);return this.find(a.element+"."+a.className).each(function(){var a=this.parentNode;a.replaceChild(this.firstChild,this);a.normalize()}).end()};jQuery.fn.highlight=function(a,d){var b={className:"highlight",element:"span",caseSensitive:false,wordsOnly:false};jQuery.extend(b,d);if(a.constructor===String)a=[a];a=jQuery.grep(a,function(a){return a!=""});if(a.length==0)return this;var e=b.caseSensitive?"":"i",c="("+a.join("|")+")";if(b.wordsOnly)c="\\b"+c+"\\b";var f=new RegExp(c,e);return this.each(function(){jQuery.highlight(this,f,b.element,b.className)})};
