fires before the moment when a context menu appears on the right mouse click
myTree.attachEvent("onBeforeContextMenu", function(id){ // your code here });