Getting an menu on right click of dhtmlxTree

Hi,
I am creating an tree object in a layout. I am trying to pass an xml file on right click of tree object to get the menu.As my code follows below.So, please can any one help me in this.

As my code is like this,

document.oncontextmenu=new Function (“return false”);
menu = new dhtmlXMenuObject();
menu.setImagePath(“images/”);
menu.setIconsPath(“images/”);
menu.renderAsContextMenu();
menu.setOpenMode(“web”);
//docCmenu.attachEvent(“onClick”,onButtonClick);
menu.loadXML(“${path}/dhtmlx/grid/context_menu.xml”, function(){
alert(“the data is loaded”);
});

If you are using pro version - just use

    tree.enableContextMenu(menu);

In case of standard edition, you can try to use

tree.attachEvent("onRightClick", function(id, e){ //show menu from here });