function SearchInput(searchString) { document.write("
"); document.write(""); document.write("
Search this site for
"); document.write("
"); document.write(" "); document.write("

"); document.write("
"); } if (document.location.search) { var arrResults = new Array(); var searchString; var arrSearchTerms; var arrMatch = document.location.search.match(/q=([^&]+)/i); if (arrMatch && arrMatch.length == 2) { searchString = decodeURIComponent(arrMatch[1]).replace(/\+/g, " "); } else { arrMatch = document.location.search.replace(/^\?/, "").split("&"); if (arrMatch) { searchString = decodeURIComponent(arrMatch.shift()).replace(/\+/g, " "); } else { searchString = decodeURIComponent(document.location.search.replace(/^\?/, "")).replace(/\+/g, " "); } } if (searchString && searchString.length > 0) { arrSearchTerms = searchString.split(/\s+/); for(var searchTerm in arrSearchTerms) { var term = new Object(); term.term = arrSearchTerms[searchTerm]; if (/^-/.test(term.term)) { term.exclude = true; term.re = new RegExp(term.term.replace(/^-/,""), "ig"); } else { term.exclude = false; term.re = new RegExp(term.term, "ig"); } arrSearchTerms[searchTerm] = term; } var dbFrm = document.forms["database"]; if (dbFrm) { var listInput = dbFrm.elements["list"]; if (listInput) { var keywordList = listInput.value; if (keywordList) { var arrKeywordList = keywordList.split("*"); for(var keywordEntry in arrKeywordList) { var arrKeyMatch = arrKeywordList[keywordEntry].match(/^([^~]*)~([^\|]*)\|([^\^]*)\^(.*)$/); if (arrKeyMatch) { var termMatch = true; for(var searchTerm in arrSearchTerms) { var term = arrSearchTerms[searchTerm]; var reSearch = term.re; if (arrKeyMatch[2].search(reSearch) >= 0 || arrKeyMatch[3].search(reSearch) >= 0 || arrKeyMatch[4].search(reSearch) >= 0) { if (term.exclude) termMatch = false; else continue; } else { if (term.exclude) continue; else termMatch = false; } break; } if (termMatch) { var result = new Object(); result.url = arrKeyMatch[1]; result.title = arrKeyMatch[2]; result.description = arrKeyMatch[4]; arrResults.push(result); } } } } } } } SearchInput(searchString); if (arrResults.length == 0) { document.write("Search for \"" + htmlEncode(searchString) + "\" produced no results"); } else { var visited = new Object(); document.write("
 Results - " + arrResults.length + " matches found

"); for(var r in arrResults) { var pid = parseInt(arrResults[r].url.split("#").pop()); if (!visited[arrResults[r].url] && !visited[pid]) { document.write("" + arrResults[r].title + "
" + hilite(arrResults[r].description, searchString) + "


"); visited[arrResults[r].url] = true; if(pid) visited[pid] = true; } } document.write("
"); } } else { SearchInput(); } function hilite(content, terms) { var arrTerms = terms.split(/\s+/); for(var term in arrTerms) { if (!/^-/.test(arrTerms[term])) { var re = new RegExp(regExEncode(arrTerms[term]), "ig"); content = content.replace(re, function() { return "" + arguments[0] + ""; }); } } return content; } function htmlEncode(str) { return new String(str).replace(/&/g, "&").replace(//g, ">").replace(/"/g, """); } function regExEncode(str) { return new String(str).replace(/\$|\(|\)|\*|\+|\.|\[|\]|\?|\\|\/|\^|\{|\}|\|/g, function() { return "\\" + arguments[0]; }); }