6fdfd053967b3fa7785a91136de5f42da93c7f73
larrym
  Wed Jul 25 16:24:14 2012 -0700
reset positionInput watermark when user zooms
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 9db176e..1c83f20 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -2544,46 +2544,68 @@
             strs.push(a[1]);
         }
         if(strs.length > 0) {
             $('.timing').remove();
             for(var i = strs.length; i > 0; i--) {
                 $('body').prepend(strs[i - 1]);
             }
         }
         reg = new RegExp("(<span class='trackTiming'>[\\S\\s]+?</span>)");
         a = reg.exec(response);
         if(a != null && a[1] != null) {
             $('.trackTiming').replaceWith(a[1]);
         }
     },
 
+    loadSuggestBox: function ()
+    {
+        if($('#positionInput').length) {
+            suggestBox.init(getDb(), $("#suggestTrack").length > 0,
+                            function (item) {
+                                genomePos.set(item.id, commify(getSizeFromCoordinates(item.id)));
+                            },
+                            function (position) {
+                                genomePos.set(position, commify(getSizeFromCoordinates(position)));
+                            });
+            // Make sure suggestTrack is visible when user chooses something via gene select (#3484).
+            if($("#suggestTrack").length) {
+                $(document.TrackHeaderForm).submit(function(event) {
+                                                       if($('#hgFindMatches').length) {
+                                                           vis.makeTrackVisible($("#suggestTrack").val());
+                                                       }
+                                                   });
+            }
+        }
+    },
+    
     afterReload: function ()
     {   // Reload various UI widgets after updating imgTbl map.
         dragReorder.init();
         dragSelect.load(false);
         // Do NOT reload context menu (otherwise we get the "context menu sticks" problem).
         // rightClick.load($('#tr_' + id));
         if(imageV2.imgTbl.tableDnDUpdate)
             imageV2.imgTbl.tableDnDUpdate();
         rightClick.reloadFloatingItem();
         // Turn on drag scrolling.
         if(hgTracks.imgBoxPortal) {
             $("div.scroller").panImages();
         }
         imageV2.loadRemoteTracks();
         makeItemsByDrag.load();
         imageV2.markAsDirtyPage();
+        imageV2.loadSuggestBox();
     },
 
     updateImgForId: function (html, id)
     {   // update row in imgTbl for given id.
         // return true if we successfully pull slice for id and update it in imgTrack.
         var str = "<TR id='tr_" + id + "'[^>]*>([\\s\\S]+?)</TR>";
         var reg = new RegExp(str);
         var a = reg.exec(html);
         if(a && a[1]) {
             var tr = $(document.getElementById("tr_" + id));
             if (tr.length > 0) {
                 $(tr).html(a[1]);
 
                 // Need to update tr class list too
                 str = "<TR id='tr_" + id + "[^>]* class='(.*)'>";
@@ -2966,49 +2988,31 @@
 ///////////////
 $(document).ready(function()
 {
     // The page may be reached via browser history (back button)
     // If so, then this code should detect if the image has been changed via js/ajax
     // and will reload the image if necessary.
     // NOTE: this is needed for IE but other browsers can detect the dirty page much earlier
     if (imageV2.isDirtyPage()) {
         // mark as non dirty to avoid infinite loop in chrome.
         $('#dirty').val('false');
         jQuery('body').css('cursor', 'wait');
             window.location = "../cgi-bin/hgTracks?hgsid=" + getHgsid();
             return false;
     }
     initVars();
-
-    var db = getDb();
-    if($('#positionInput').length) {
-        suggestBox.init(db, hgTracks.assemblySupportsGeneSuggest,
-             function (item) {
-                  genomePos.set(item.id, commify(getSizeFromCoordinates(item.id)));
-             },
-             function (position) {
-                  genomePos.set(position, commify(getSizeFromCoordinates(position)));
-             });
-             // Make sure suggestTrack is visible when user chooses something via gene select (#3484).
-             if($("#suggestTrack").length) {
-                  $(document.TrackHeaderForm).submit(function(event) {
-                                                  if($('#hgFindMatches').length) {
-                                                      vis.makeTrackVisible($("#suggestTrack").val());
-                                                  }
-                                              });
-             }
-    }
+    imageV2.loadSuggestBox();
     // Convert map AREA gets to post the form, ensuring that cart variables are kept up to date (but turn this off for search form).
     if($("FORM").length > 0 && $('#trackSearch').length == 0) {
         var allLinks = $('a');
         $( allLinks ).unbind('click');
         $( allLinks ).click( posting.saveSettings );
     }
     if($('#pdfLink').length == 1) {
         $('#pdfLink').click(function(i) {
             var thisForm=$('#TrackForm');
             if(thisForm != undefined && $(thisForm).length == 1) {
                 //alert("posting form:"+$(thisForm).attr('name'));
                 updateOrMakeNamedVariable($(thisForm),'hgt.psOutput','on');
                 return postTheForm($(thisForm).attr('name'),this.href);
             }
             return true;