if ((evt.BUTTON1_MASK & evt.getModifiers()) != 0)
button = 0;
else
if ((evt.BUTTON3_MASK & evt.getModifiers()) != 0)
button = 2;
MouseEvent mevent = (MouseEvent)
// DOM Level 2 6.5 cast from Document to DocumentEvent is ok
((DocumentEvent)elmt.getOwnerDocument()).createEvent("MouseEvents");
// deal with the related node/target
node = evt.getRelatedNode();
EventTarget relatedTarget =
(EventTarget)context.getElement(node);
mevent.initMouseEvent(eventType, true, cancelok, null,
evt.getClickCount(),
screen.x, screen.y,
(int)Math.floor(pos.getX()),
(int)Math.floor(pos.getY()),
evt.isControlDown(), evt.isAltDown(),