code: function(element) {
          var depth = 3, // limit the search depth
              button;
          do {
              if(OpenLayers.Element.hasClass(element, "olButton")) {
                  // hit!
                  button = element;
                  break;
              }
              element = element.parentNode;
          } while(--depth > 0 && element);
          return button;
      }
docs: Method: getPressedButton
  Get the pressed button, if any. Returns undefined if no button
  was pressed.
  
  Arguments:
  element - {DOMElement} The event target.
  
  Returns:
  {DOMElement} The button element, or undefined.