701a85b9260e1a356e216789b300aa5b02a97f60
tdreszer
  Wed Nov 23 10:40:33 2011 -0800
Imported BUTTON_BY_CSS from branch because it goes with MATRIX_SQUEEZE
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 66d8243..e5a1573 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -436,32 +436,31 @@
 
     toggleForGroup: function (button, prefix)
     {   // toggle visibility of a track group; prefix is the prefix of all the id's of tr's in the
         // relevant group. This code also modifies the corresponding hidden fields and the gif of the +/- img tag.
         imageV2.markAsDirtyPage();
         if(arguments.length > 2)
             return setTableRowVisibility(button, prefix, "hgtgroup", "group",false,arguments[2]);
         else
             return setTableRowVisibility(button, prefix, "hgtgroup", "group",false);
     },
 
     expandAllGroups: function (newState)
     {   // Set visibility of all track groups to newState (true means expanded).
         // This code also modifies the corresponding hidden fields and the gif's of the +/- img tag.
         imageV2.markAsDirtyPage();
-        $("img[id$='_button']").each( function (i) {
-            if(this.src.indexOf("/remove") > 0 || this.src.indexOf("/add") > 0)
+        $(".toggleButton[id$='_button']").each( function (i) {  // works for old img type AND new BUTTONS_BY_CSS
                 vis.toggleForGroup(this,this.id.substring(0,this.id.length - 7),newState); // clip '_button' suffix
         });
         return false;
     }
 
 }
   ////////////////////////////////////////////////////////////
  // dragSelect is also known as dragZoom or shift-dragZoom //
 ////////////////////////////////////////////////////////////
 var dragSelect = {
 
     areaSelector:    null, // formerly "imgAreaSelect". jQuery element used for imgAreaSelect
     autoHideSetting: true, // Current state of imgAreaSelect autoHide setting
     originalCursor:  null,
     startTime:       null,