// Get current year for copyright
$('#currentYear').text(new Date().getFullYear());

// Handle search box autocomplete
$("#search").autocomplete({
  delay: 0,
  source: function(request, response) {
    var limit = $("input:radio[name='gimme']:checked").val();
    getSuggestions(request, response, limit);
    $('.search-engine-label').show();
  },
  // Hide number of results message
  messages: {
    noResults: '',
    results: function() {}
  }
});

// Pass term to search engines (requests), and poulate lists of suggestions (responses)
function getSuggestions(request, response, limit) {

  // Google request
  var googSuggestURL = "http://suggestqueries.google.com/complete/search?client=chrome&q=%QUERY";
  googSuggestURL = googSuggestURL.replace('%QUERY', request.term);
  $.ajax({
      method: 'GET',
      dataType: 'jsonp',
      jsonpCallback: 'jsonCallback',
      url: googSuggestURL
    })
    .success(function(data) {
      // Remove any previous suggestions
      $('#goog-suggestions li').remove();
      // Build list of suggestion links
      $.each(data[1], function(key, val) {
        var link = getLink("https://www.google.com/#q=", val, "Google");
        $('#goog-suggestions').append("<li>" + link + "</li>");
        return key < limit - 1;
      });
    });

  // Bing request
  var bingSuggestURL = "http://api.bing.com/osjson.aspx?JsonType=callback&JsonCallback=?";
  $.getJSON(bingSuggestURL, {
    query: request.term
  }, function(data) {
    $('#bing-suggestions li').remove();
    $.each(data[1], function(key, val) {
      var link = getLink("http://www.bing.com/search?q=", val, "Bing");
      $('#bing-suggestions').append("<li>" + link + "</li>");
      return key < limit - 1;
    });
  });

  // Yahoo request
  var yahooSuggestURL = "http://ff.search.yahoo.com/gossip";
  $.ajax({
      url: yahooSuggestURL,
      dataType: "jsonp",
      data: {
        "output": "jsonp",
        "command": request.term
      }
    })
    .success(function(data) {
      $('#yahoo-suggestions li').remove();
      $.each(data.gossip.results, function(key, val) {
        var link = getLink("https://search.yahoo.com/search?p=", val.key, "Yahoo");
        $('#yahoo-suggestions').append("<li>" + link + "</li>");
        return key < limit - 1;
      });
    });
}

// Generate link for suggestions
function getLink(url, term, label) {
  formattedTerm = term.split(' ').join('+');
  return "<a target=\"_blank\" href=\"" + url + formattedTerm + "\" title=\"View results on " + label + "\"\">" + term + "</a>";
}

@@ -338,16 +338,41 @@
 show();%0A
+    $('#legend').show();%0A
   %7D,%0A  /
@@ -473,16 +473,244 @@
  %7D%0A%7D);%0A%0A
+var typingTimer;%0Avar doneTypingInterval = 1000;%0A$('#search').keyup(function() %7B%0A  clearTimeout(typingTimer);%0A  if ($('#search').val()) %7B%0A    typingTimer = setTimeout(doneTyping($('#search').val()), doneTypingInterval);%0A  %7D%0A%7D);%0A%0A
 // Pass 
@@ -2787,12 +2787,603 @@
 + %22%3C/a%3E%22;%0A%7D%0A
+%0A// Do stuff when typing is done%0Afunction doneTyping(searchTxt) %7B%0A  // Highlight exact matches%0A  var $matches = $('.sugg-ul li').find('*').filter(function() %7B%0A    return $(this).text() === searchTxt;%0A  %7D);%0A  $matches.addClass('highlight-match');%0A%0A  // Hightlight common suggestions%0A  unique = %7B%7D;%0A  $('.sugg-ul li').each(function() %7B%0A    var thisVal = $(this).text();%0A    if (!(thisVal in unique)) %7B%0A      unique%5BthisVal%5D = %22%22;%0A    %7D else %7B%0A      $('.sugg-ul li').find('*').filter(function() %7B%0A        return $.text(%5Bthis%5D) === thisVal;%0A      %7D).addClass('highlight-common');%0A    %7D%0A  %7D);%0A%0A%7D%0A

Update script.js