c647b8ca4f3aae5e9abedfa9a137f2a73429443c
tdreszer
  Wed Oct 20 12:10:07 2010 -0700
Restrict track description popup to 900px and set focus on search input in some restricted cases.
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index eb78d07..fb103f9 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -1312,10 +1312,18 @@
         $("#tabs").tabs({
                             show: function(event, ui) {
                                 $('#currentSearchTab').val(ui.panel.id);
+                            },
+                            select: function(event, ui) {
+                                if( ui.panel.id == 'simpleTab' && $('div#found').length < 1) {
+                                    setTimeout("$('input#simpleSearch').focus();",20); // delay necessary, since select event not afterSelect event
+                                }
                             }
                         });
         $('#tabs').show();
         $("#tabs").tabs('option', 'selected', '#' + val);
+        if(val =='simpleTab' && $('div#found').length < 1) {
+            $('input#simpleSearch').focus();
+        }
         $("#tabs").css('font-family', jQuery('body').css('font-family'));
         $('#simpleSearch').keydown(searchKeydown);
         $('#descSearch').keydown(searchKeydown);
@@ -1990,6 +1998,8 @@
                            });
     if(popUpTrackDescriptionOnly) {
         var myWidth =  $(window).width() - 300;
+        if(myWidth > 900)
+            myWidth = 900;
         $('#hgTrackUiDialog').dialog("option", "maxWidth", myWidth);
         $('#hgTrackUiDialog').dialog("option", "width", myWidth);
         $('#hgTrackUiDialog').dialog('option' , 'title' , trackDbJson[popUpTrackName].shortLabel + " Track Description");