rem: if (!document.createElement) return; ref = document.URL; if (ref.indexOf('/search/?q') == -1) ref = document.referrer; if (ref.indexOf('?') == -1) return; qs = ref.substr(ref.indexOf('?')+1); qsa = qs.split('&'); for (i=0;i<qsa.length;i++) { qsip = qsa[i].split('='); if (qsip.length == 1) continue; if (qsip[0] == 'q' || qsip[0] == 'p') { words = unescape(qsip[1].replace(/\+/g,' ')).split(/\s+/); for (w=0;w<words.length;w++) { highlightWord(document.getElementById("searchable"),words[w],w); } } } 
add: if (!document.createElement) return;  function getSearchWords(url) { if (url.indexOf('?') == -1) return []; var queryString = url.substr(url.indexOf('?') + 1); var params = queryString.split('&'); for (var p in params) { var param = params[p].split('='); if (param.length < 2) continue; if (param[0] == 'q' || param[0] == 'p') { return unescape(param[1].replace(/\+/g, ' ')).split(/\s+/); } } return []; }  function highlightWord(node, word, searchwordindex) {   if (node.nodeType == 3) { var pos = node.nodeValue.toLowerCase().indexOf(word.toLowerCase()); if (pos >= 0 && !node.parentNode.className.match(/^searchword\d/)) { var span = document.createElement("span"); span.className = "searchword" + (searchwordindex % 5); span.appendChild(document.createTextNode( node.nodeValue.substr(pos, word.length))); var newNode = node.splitText(pos); newNode.nodeValue = newNode.nodeValue.substr(word.length); node.parentNode.insertBefore(span, newNode); } } else {  for (var i = 0; i < node.childNodes.length; i++) { highlightWord(node.childNodes[i], word, searchwordindex); } } }  var words = getSearchWords(document.URL); if (!words.length) words = getSearchWords(document.referrer); if (words.length) { var div = document.getElementById("searchable"); for (var w in words) { if (words[w].length) highlightWord(div, words[w], w); } } 
context: function searchHighlight() {	if (!document.createElement) return;	ref = document.URL;        if (ref.indexOf('/search/?q') == -1) ref = document.referrer;	if (ref.indexOf('?') == -1) return;	qs = ref.substr(ref.indexOf('?')+1);	qsa = qs.split('&');	for (i=0;i<qsa.length;i++) {		qsip = qsa[i].split('=');	        if (qsip.length == 1) continue;        	if (qsip[0] == 'q' || qsip[0] == 'p') { // q= for Google, p= for Yahoo			words = unescape(qsip[1].replace(/\+/g,' ')).split(/\s+/);	                for (w=0;w<words.length;w++) {				highlightWord(document.getElementById("searchable"),words[w],w);                	}	        }	}}
meta: 2557	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/2557/e2051c723d05c24c8d786792c4d30fd982abb176/trac.js/buggy/htdocs/trac.js