f37fac8883ffb0c529f91478de366ddbcc6c8940
angie
  Fri Feb 26 11:19:27 2016 -0800
autocomplete.js can't assume that the global hgTracks object exists since it's also used by hgGateway.  Thanks Christopher Lee for catching this.
refs #16892

diff --git src/hg/js/autocomplete.js src/hg/js/autocomplete.js
index 161514a..f038ed4 100644
--- src/hg/js/autocomplete.js
+++ src/hg/js/autocomplete.js
@@ -1,23 +1,25 @@
 // support stuff for auto-complete using jQuery UI's autocomplete widget
 //
 // requires ajax.js
 // requires utils.js
 /* suggest (aka gene search)
    Requires three elements on page: positionDisplay (static display), positionInput (input textbox) and position (hidden).
 */
 
+var hgTracks = hgTracks || {};
+
 var suggestBox = {
     ajaxGet: function ajaxGet(db) {
         // Returns autocomplete source function
         // db is the relevant assembly (e.g. "hg18")
         var cache = {}; // cache is is used as a hash to cache responses from the server.
         return function(request, callback) {
             var key = request.term;
             if (!cache[key]) {
                 $.ajax({
                     url: "../cgi-bin/hgSuggest",
                     data: "db=" + db + "&prefix=" + encodeURIComponent(key),
                     // dataType: "json",  // XXXX this doesn't work under IE, so we retrieve as text and do an eval to force to an object.
                     trueSuccess: function(response, status) {
                         // We get a lot of duplicate requests (especially the first letters of words),
                         // so we keep a cache of the suggestions lists we've retreived.