function doHighlight(g,b,h,a){if(b!=""){if((!h)||(!a)){h="<font style='color:blue; background-color:yellow;'>";a="</font>"}var e="";var d=-1;var c=b.toLowerCase();var f=g.toLowerCase();while(g.length>0){d=f.indexOf(c,d+1);if(d<0){e+=g;g=""}else{if(g.lastIndexOf(">",d)>=g.lastIndexOf("<",d)){if(f.lastIndexOf("/script>",d)>=f.lastIndexOf("<script",d)){e+=g.substring(0,d)+h+g.substr(d,b.length)+a;g=g.substr(d+b.length);f=g.toLowerCase();d=-1}}}}return e}else{return g}}function highlightSearchTerms(e,d,b,g,a){if(d){searchArray=[e]}else{searchArray=e.split("+")}if(!document.body||typeof(document.body.innerHTML)=="undefined"){if(b){alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.")}return false}var f=document.body.innerHTML;for(var c=0;c<searchArray.length;c++){f=doHighlight(f,searchArray[c],g,a)}document.body.innerHTML=f;return true}function ArrayComparer(d,c){return c.length-d.length}function highlightSearchTermsWithText(f,e,d,b,g,a){if(d){searchArray=[e]}else{searchArray=e.split("+")}searchArray.sort(ArrayComparer);if(!document.body||typeof(document.body.innerHTML)=="undefined"){if(b){alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.")}return false}for(var c=0;c<searchArray.length;c++){f=doHighlight(f,searchArray[c].trim(),g,a)}return f}function searchPrompt(a,b,c,d){if(!a){a=""}if((!c)||(!d)){highlightStartTag="";highlightEndTag=""}else{highlightStartTag="<font style='color:"+c+"; background-color:"+d+";'>";highlightEndTag="</font>"}if(b){promptText="Please enter the phrase you'd like to search for:"}else{promptText="Please enter the words you'd like to search for, separated by spaces:"}searchText=prompt(promptText,a);if(!searchText){alert("No search terms were entered. Exiting function.");return false}return highlightSearchTerms(searchText,b,true,highlightStartTag,highlightEndTag)}function highlightGoogleSearchTerms(d){if(!d){return false}var c="q=";var b=d.toLowerCase().indexOf(c);if((b<0)||(b+c.length==d.length)){return false}var a=d.indexOf("&",b);if(a<0){a=d.length}var e=d.substring(b+c.length,a);e=e.replace(/%20/gi," ");e=e.replace(/\+/gi," ");e=e.replace(/%22/gi,"");e=e.replace(/\"/gi,"");return highlightSearchTerms(e,false)};
