function highlightOnLoad() {
  // Get search string
  //if (/keyword\=/.test(window.location.search)) {
   if (/keyword\=/.test(window.location.search) || /keyWord\=/.test(window.location.search)) {  
  //if (window.location.search != "") {
    var searchString = getSearchString();
    // Starting node, parent to all nodes you want to search
    var textContainerNode = document.getElementById("content");

    // Informational message for search
    var searchInfo = 'Search Results for: ';

    // Split search terms on '|' and iterate over resulting array
    var searchTerms = searchString.split('|');
    for (var i in searchTerms) 	{
      // The regex is the secret, it prevents text within tag declarations to be affected
      var regex = new RegExp(">([^<]*)?("+searchTerms[i]+")([^>]*)?<","ig");
      highlightTextNodes(textContainerNode, regex, i);
    }
  }
}

// Pull the search string out of the URL
function getSearchString() {
  // Return sanitized search string if it exists
  var rawSearchString;
  if(/keyword\=/.test(window.location.search)) {rawSearchString = window.location.search.replace(/[a-zA-Z0-9\?\&\=\%\#]+keyword\=(\w+)(\&.*)?/,"$1");}
  else {rawSearchString = window.location.search.replace(/[a-zA-Z0-9\?\&\=\%\#]+keyWord\=(\w+)(\&.*)?/,"$1");}
  // Replace '+' with '|' for regex
  // Also replace '%20' if your cms/blog uses this instead (credit to erlando for adding this)
  return rawSearchString.replace(/\%20|\+/g,"\|");
}

function highlightTextNodes(element, regex, termid) {
  var tempinnerHTML = element.innerHTML;
  // Do regex replace
  // Inject span with class of 'highlighted termX' for google style highlighting
  element.innerHTML = tempinnerHTML.replace(regex,'>$1<span class="highlighted term'+termid+'">$2</span>$3<');
}

// Call this onload, I recommend using the function defined at: http://untruths.org/technology/javascript-windowonload/
window.onload = highlightOnLoad;