Answering your question - use contextmenu
event, like below:
if (document.addEventListener) {_x000D_
document.addEventListener('contextmenu', function(e) {_x000D_
alert("You've tried to open context menu"); //here you draw your own menu_x000D_
e.preventDefault();_x000D_
}, false);_x000D_
} else {_x000D_
document.attachEvent('oncontextmenu', function() {_x000D_
alert("You've tried to open context menu");_x000D_
window.event.returnValue = false;_x000D_
});_x000D_
}
_x000D_
<body>_x000D_
Lorem ipsum..._x000D_
</body>
_x000D_
But you should ask yourself, do you really want to overwrite default right-click behavior - it depends on application that you're developing.