2542ace0d7aa8b198d7de360b21edd3ce88364d6
galt
  Fri Jan 29 19:19:18 2016 -0800
A request was made to hide the chromIdeo when we are in custom multi-region mode
and ther is more than two or more different chroms in the region list.
This is kind of a compromise. It avoids the seeming asserting that there is just
one chrom in the view.  But we also lose our place-holder that shows
the multi-region mode that one is in.  When a user zooms in far enough
that the screen only has 1 window from 1 region, then the chromIdeo for that single
chrom needs to be updated. So I have added a small change where when the
ideo is hidden we still include an empty hidden map and chromIdeo image html.
So that hgTracks.js::updateChromImg can update it later at runtime with ajax callbacks.
This is also a partial step towards supporting multiple chromIdeos someday.

Squashed commit of the following:

commit 764c2932d6be67d6a67b3df47b8cf44f3c5239e4
Author: Galt Barber <galt@soe.ucsc.edu>
Date:   Fri Jan 29 19:11:53 2016 -0800

code cleanup

commit 408ee8dadde6d7948740a65e0a298ad006470ab7
Author: Galt Barber <galt@soe.ucsc.edu>
Date:   Fri Jan 29 18:37:47 2016 -0800

checkin of fix for more dynamic ideogram

commit ccac0a2f112dabd6e798904bd57b0cb5fe7c0a22
Author: Galt Barber <galt@soe.ucsc.edu>
Date:   Thu Jan 28 11:29:33 2016 -0800

initial probing towards a solution for having dynmaic chromIdeos, a step on the way to supporting mulitple chromIdeos

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index eba5e3a..b0f2d3b 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -553,31 +553,31 @@
 		    str += "<li>" + w.chromName + ":" + (w.winStart+1) + "-" + w.winEnd + "</li>\n";
 		}
 		str += "</ul>\n";
 	    }
 	    $("#positionDisplayPosition").html(str);
 	} else {
 	    $("#positionDisplayPosition").html(position);
 	}
         $(positionDialog).dialog({
                 modal: true,
                 title: "Window-Positions",
                 closeOnEscape: true,
                 resizable: false,
                 autoOpen: false,
                 minWidth: 400,
-                minHeight: 40, // DEBUG GALT
+                minHeight: 40,
                 buttons: {  
                     "OK": function() {
                         $(this).dialog("close");
                     }
                 },
 
                 open: function () { // Make OK the focus/default action
                    $(this).parents('.ui-dialog-buttonpane button:eq(0)').focus(); 
                 },
 
                 close: function() {
                     // All exits to dialog should go through this
                     $(imageV2.imgTbl).imgAreaSelect({hide:true});
 		    $(this).hide();
                     $('body').css('cursor', ''); // Occasionally wait cursor got left behind
@@ -3722,65 +3722,77 @@
         if (imageV2.backSupport) {
             // Removes OLD: those in oldJson but not in newJson
             for (id in oldJson.trackDb) {
                 if ( ! newJson.trackDb[id] )
                     $(document.getElementById('tr_' + id)).remove();
             }
             
             // Need to reorder the rows based upon abbr
             dragReorder.sort($(imgTbl));
         }
     },
     
     updateChromImg: function (response)
     {   // Parse out new chrom 'ideoGram' (if available)
         // e.g.: <IMG SRC = "../trash/hgtIdeo/hgtIdeo_hgwdev_larrym_61d1_8b4a80.gif"
-        //                BORDER=1 WIDTH=1039 HEIGHT=21 USEMAP=#ideoMap id='chrom'>
+        //                BORDER=1 WIDTH=1039 HEIGHT=21 USEMAP=#ideoMap id='chrom' style='display: inline;'>
+	// If the ideo is hidden or missing, we supply a place-holder for dynamic update later.
+        // e.g.: <IMG SRC = ""
+        //                BORDER=1 WIDTH=1039 HEIGHT=0 USEMAP=#ideoMap id='chrom' style='display: none'>
         // Larry's regex voodoo:
         var a = /<IMG([^>]+SRC[^>]+id='chrom'[^>]*)>/.exec(response);
         if (a && a[1]) {
-            var b = /SRC\s*=\s*"([^")]+)"/.exec(a[1]);
-            if (b && b[1]) {
+            var b = /SRC\s*=\s*"([^")]*)"/.exec(a[1]);
+            if (b) { // tolerate empty SRC= string when no ideo
                 $('#chrom').attr('src', b[1]);
+		var c = /style\s*=\s*'([^')]+)'/.exec(a[1]);
+    		if (c && c[1]) {
+		    $('#chrom').attr('style', c[1]);
+		}
+		var d = /HEIGHT\s*=\s*(\d*)/.exec(a[1]);
+    		if (d && d[1]) {
+		    $('#chrom').attr('HEIGHT', d[1]);
+		}
                 // Even if we're on the same chrom, ideoMap may change because the label
                 // on the left changes width depending on band name, and that changes px scaling.
                 var ideoMapMatch = /<MAP Name=ideoMap>[\s\S]+?<\/MAP>/.exec(response);
                 if (ideoMapMatch) {
                     var $oldMap = $("map[name='ideoMap']");
                     var $container = $oldMap.parent();
                     $oldMap.remove();
                     $container.append(ideoMapMatch[0]);
                 }
                 if (imageV2.backSupport) {
                     // Reinit chrom dragging.
                     if ($('area.cytoBand').length >= 1) {
                         $('img#chrom').chromDrag();
                     }
                 }
             }
         }
     },
 
     updateBackground: function (response)
     {
 	// Added by galt to update window separators
         // Parse out background image url
         // background-image:url("../trash/hgt/blueLines1563-118-12_hgwdev_galt_9df9_e33b30.png")
+        // background-image:url("../trash/hgt/winSeparators_hgwdev_galt_5bcb_baff60.png")
+	// This will only need to update when multi-region is on and is using winSeparators.
 
         var a = /background-image:url\("(..\/trash\/hgt\/winSeparators[^"]+[.]png)"\)/.exec(response);
         if (a && a[1]) {
-	    //warn("updateBackground called! winSepartors"+a[1]);
 	    $('td.tdData').css("background-image", "url("+a[1]+")");
 	}
 
     },
 
         
     requestImgUpdate: function (trackName,extraData,loadingId,newVisibility)
     {
         // extraData, loadingId and newVisibility are optional
         var data = "hgt.trackImgOnly=1&hgsid=" + getHgsid() + "&hgt.trackNameFilter=" + trackName;
         if (extraData && extraData !== "")
             data += "&" + extraData;
         if (!loadingId || loadingId === "")
             loadingId = showLoadingImage("tr_" + trackName);
         var getOrPost = "GET";