2a78a3e2a45c0fc53856da3f7cef08eca735f6f3
tdreszer
  Tue Apr 26 15:31:01 2011 -0700
Fine tuned filterBy scrolling height for special case of track search simple tab blocking position detection.
diff --git src/hg/js/utils.js src/hg/js/utils.js
index 0267dd3..46af8c5 100644
--- src/hg/js/utils.js
+++ src/hg/js/utils.js
@@ -1959,36 +1959,45 @@
     }
 }
 
 function findTracksClearFound()
 {// Clear found tracks and all input controls
     var found = $('div#found');
     if(found != undefined)
         $(found).remove();
     found = $('div#filesFound');
     if(found != undefined)
         $(found).remove();
     return false;
 }
 
 function filterByMaxHeight(multiSel)
-{
+{   // Setting a max hieght to scroll dropdownchecklists but
+    // multiSel is hidden when this is done, so it's position and height must be estimated.
     var pos = $(multiSel).closest(':visible').offset().top + 30;
     if (pos <= 0)
         pos = 260;
+
+    // Special mess since the filterBy's on non-current tabs will calculate pos badly.
+    var tabbed = $('input#currentTab');
+    if (tabbed != undefined) {
+        var tabDiv = $(multiSel).parents('div#'+ $(tabbed).attr('value'));
+        if (tabDiv == null || tabDiv == undefined || $(tabDiv).length == 0) {
+            pos = 360;
+        }
+    }
     var maxHeight = $(window).height() - pos;
-//    var maxHeight = $(window).height() - 260;
     var selHeight = $(multiSel).children().length * 21;
     if (maxHeight > selHeight)
         maxHeight = selHeight;
     return maxHeight;
 }
 
 function findTracksClear()
 {// Clear found tracks and all input controls
     findTracksClearFound();
     $('input[type="text"]').val(''); // This will always be found
     //$('select.mdbVar').attr('selectedIndex',0); // Do we want to set the first two to cell/antibody?
     $('select.mdbVal').attr('selectedIndex',0); // Should be 'Any'
     $('select.filterBy').each( function(i) { // Do this by 'each' to set noneIsAll individually
         //$(this).dropdownchecklist("refresh");  // requires v1.1
         $(this).dropdownchecklist("destroy");