c4cf39d819e7051bdf1f018a0cbdf09463b54731
tdreszer
  Tue Jun 28 15:18:00 2011 -0700
Fixed redmine 2813 note 23.  The gene autocomplete dialog overflowed the page and had bad css.
diff --git src/hg/js/hgGateway.js src/hg/js/hgGateway.js
index 5e3d794..76d4f76 100644
--- src/hg/js/hgGateway.js
+++ src/hg/js/hgGateway.js
@@ -1,28 +1,40 @@
 var newJQuery = false;       // temporary #define for use while testing jQuery 1.5/jQuery UI 1.8 in dev trees
 
 $(document).ready(function()
 {
     if(document.getElementById("hgt.newJQuery") != null) {
         newJQuery = true;
     }
     if(newJQuery) {
         $('input#suggest').autocomplete({
                                             delay: 500,
                                             minLength: 2,
                                             // XXXX necessary still? autowidth: true,
                                             source: ajaxGet(function () {return document.orgForm.db.value;}, new Object, true),
+                                            open: function(event, ui) {
+                                                var pos = $(this).offset().top + $(this).height();
+                                                if (!isNaN(pos)) {
+                                                    var maxHeight = $(window).height() - pos - 30;  // take off a little more because IE needs it
+                                                    var auto = $('.ui-autocomplete');
+                                                    var curHeight = $(auto).children().length * 21;
+                                                    if (curHeight > maxHeight)
+                                                        $(auto).css({maxHeight: maxHeight+'px',overflow:'scroll'});
+                                                    else
+                                                        $(auto).css({maxHeight: 'none',overflow:'hidden'});
+                                                }
+                                            },
                                             select: function (event, ui) {
                                                 document.mainForm.position.value = ui.item.id;
                                                 makeSureSuggestTrackIsVisible();
                                             }
                                         });
     } else {
         $('input#suggest').autocomplete({
                                             delay: 500,
                                             minchars: 2,
                                             autowidth: true,
                                             ajax_get: ajaxGet(function () {return document.orgForm.db.value;}, new Object, false),
                                                 callback: function (obj) {
                                                 document.mainForm.position.value = obj.id;
                                                 makeSureSuggestTrackIsVisible();
                                             }