cbddd64298817dc8ea6469351ae0b1455385aaaf
tdreszer
  Thu Dec 8 12:53:26 2011 -0800
IE8 triggers a second onchange event.  Add protection when a function is launched with a waitmask.
diff --git src/hg/js/utils.js src/hg/js/utils.js
index 5d7c7b8..968eaaf 100644
--- src/hg/js/utils.js
+++ src/hg/js/utils.js
@@ -984,30 +984,37 @@
     if(funcArgs.length > 0 && funcArgs[0].type != undefined) {
         if(funcArgs[0].type == 'button' && $(funcArgs[0]).hasClass('inOutButton')) {
             $(funcArgs[0]).css('borderStyle',"outset");
         }
     }
     // Now we can get rid of the wait cursor
     waitMaskClear();
 }
 
 function waitOnFunction(func)
 { // sets the waitMask (wait cursor and no clicking), then launches the function with up to 5 arguments
     if(!jQuery.isFunction(func)) {
         warn("waitOnFunction called without a function");
         return false;
     }
+    if (gWaitFunc != null)
+    {
+        if (gWaitFunc == func) // already called (sometimes hapens when onchange event is triggered
+            return true;       // by js (rather than direct user action).  Happens in IE8
+        warn("waitOnFunction called but already waiting on a function");
+        return false;
+    }
     if(arguments.length > 6) {
         warn("waitOnFunction called with " + arguments.length - 1 + " arguments.  Only 5 are supported.");
         return false;
     }
 
     waitMaskSetup(0);  // Find or create the waitMask (which masks the whole page) but gives up after 5sec
 
     // Special if the first var is a button that can visually be inset
     if(arguments.length > 1 && arguments[1].type != undefined) {
         if(arguments[1].type == 'button' && $(arguments[1]).hasClass('inOutButton')) {
             $(arguments[1]).css( 'borderStyle',"inset");
         }
     }
 
     // Build up the aruments array