"function SearchBox(name, resultsPath, inFrame, label)\n" "{\n" " this.searchLabel = label;\n" " this.DOMSearchField = function()\n" " { return document.getElementById(\"MSearchField\"); }\n" " this.DOMSearchBox = function()\n" " { return document.getElementById(\"MSearchBox\"); }\n" " this.OnSearchFieldFocus = function(isActive)\n" " {\n" " if (isActive)\n" " {\n" " this.DOMSearchBox().className = 'MSearchBoxActive';\n" " var searchField = this.DOMSearchField();\n" " if (searchField.value == this.searchLabel) \n" " {\n" " searchField.value = '';\n" " }\n" " }\n" " else\n" " {\n" " this.DOMSearchBox().className = 'MSearchBoxInactive';\n" " this.DOMSearchField().value = this.searchLabel;\n" " }\n" " }\n" "}\n" "\n" "function trim(s) {\n" " return s?s.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, ''):'';\n" "}\n" "\n" "function getURLParameter(name) {\n" " return decodeURIComponent((new RegExp('[?|&]'+name+\n" " '='+'([^&;]+?)(&|#|;|$)').exec(location.search)\n" " ||[,\"\"])[1].replace(/\\+/g, '%20'))||null;\n" "}\n" "\n" "var entityMap = {\n" " \"&\": \"&\",\n" " \"<\": \"<\",\n" " \">\": \">\",\n" " '\"': '"',\n" " \"'\": ''',\n" " \"/\": '/'\n" "};\n" "\n" "function escapeHtml(s) {\n" " return String(s).replace(/[&<>\"'\\/]/g, function (s) {\n" " return entityMap[s];\n" " });\n" "}\n" "\n" "function searchFor(query,page,count) {\n" " $.getJSON(serverUrl+\"?cb=?\",\n" " {\n" " n:count,\n" " p:page,\n" " q:query\n" " },\n" " function(data) {\n" " var results = $('#searchresults');\n" " $('#MSearchField').val(query);\n" " if (data.hits>0) {\n" " if (data.hits==1) {\n" " results.html('
'+searchResultsText[1]+'
');\n" " } else {\n" " results.html(''+searchResultsText[2].replace(/\\$num/,data.hits)+'
');\n" " }\n" " var r=''+(data.first+i+1)+'. | '+\n" " ''+escapeHtml(item.type)+' '+\n" " ''+escapeHtml(item.name)+'';\n" " if (item.type==\"source\") {\n" " var l=item.url.match(/[1-9][0-9]*$/);\n" " if (l) r+=' at line '+parseInt(l[0]);\n" " }\n" " r+=' | ';\n" " for (var i=0;i'+item.fragments[i]+' |
'+searchResultsText[0]+'
');\n" " }\n" " });\n" "}\n"