Context Menu giving error

Hi,

I’m getting an error when trying to run something based on this sample…
dhtmlx.com/docs/products/dhtmlxM … cript.html

<script src="/exercises/collect/javascripts/dhtmlx/dhtmlxMenu/codebase/dhtmlxcommon.js?1277991135" type="text/javascript"></script>
<script src="/exercises/collect/javascripts/dhtmlx/dhtmlxMenu/codebase/dhtmlxmenu.js?1277991135" type="text/javascript"></script>
<script src="/exercises/collect/javascripts/dhtmlx/dhtmlxMenu/codebase/ext/dhtmlxmenu_ext.js?1277991135" type="text/javascript"></script>
...
<script>
	function onButtonClick(menuitemId, type) {
   		alert('HEY');
	}
	menu = new dhtmlXMenuObject();
	menu.setIconsPath("/javascripts/dhtmlx/dhtmlxMenu/codebase/imgs/dhxmenu_dhx_skyblue");
	menu.renderAsContextMenu();
	menu.attachEvent("onClick", onButtonClick);
	menu.addNewSibling(null, "file", "File", false); // IF COMMENT OUT THIS LINE THERE IS NO ERROR

	var grid = new dhtmlXGridObject('mygrid');
             ...
	grid.enableContextMenu(menu);
</script>

The error is:
Error: polygon has no properties
Source File: localhost:27110/exercises/collec … 1277991135
Line: 45

Which is

 main_self._doOnClick(this.id.replace(main_self.idPrefix, ""), tc+td+"n", cas);break};return false};var polygon = this.idPull["polygon_"+this.itemPull[id]["parent"]];if (pos != null){pos++;if (pos < 0){pos = 0};if (pos > polygon.childNodes.length - 1){pos = null}};if (pos != null){polygon.insertBefore(k, polygon.childNodes[pos])}else {polygon.appendChild(k)};this.idPull[k.id] = k};dhtmlXMenuObject.prototype._renderSeparator = function(id, pos) {var level = (this.context?"SubLevelArea":(this.itemPull[id]["parent"]==this.idPrefix+this.topId?"TopLevel":"SubLevelArea"));if (level == "topLevel" && this.context)return;var main_self = this;var k = document.createElement("DIV");k.id = "separator_"+id;k.className = "dhtmlxMenu_"+this.skin+"_"+level+"_Separator";k.onselectstart = function(e) {e = e || event;e.returnValue = false};k.onclick = function(e) {e = e || event;e.cancelBubble = true;var cas = {"ctrl": e.ctrlKey, "alt": e.altKey, "shift": e.shiftKey};main_self._doOnClick(this.id.replace("separator_" + main_self.idPrefix, ""), "--s", cas)};if (level == "TopLevel"){if (pos != null){pos++;if (pos < 0){pos = 0};if (this.base.childNodes[pos] != null){this.base.insertBefore(k, this.base.childNodes[pos])}else {this.base.appendChild(k)};this._redistribTopLevelPositions()}else {var last = this.base.childNodes[this.base.childNodes.length-1];if (String(last).search("TopLevel_Text") == -1) {this.base.appendChild(k)}else {this.base.insertBefore(k, last)}}}else {var polygon = this.idPull["polygon_"+this.itemPull[id]["parent"]];if (pos != null){pos++;if (pos < 0){pos = 0};if (pos > polygon.childNodes.length - 1){pos = null}};if (pos != null){polygon.insertBefore(k, polygon.childNodes[pos])}else {polygon.appendChild(k)}};this.idPull[k.id] = k};dhtmlXMenuObject.prototype.addNewSeparator = function(nextToId, itemId) {itemId = this.idPrefix+(itemId!=null?itemId:this._genStr(24));var parentId = this.idPrefix+this.getParentId(nextToId);this._addItemIntoGlobalStrorage(itemId, parentId, "", "separator", false, "", "");this._renderSeparator(itemId, this.getItemPosition(nextToId))};dhtmlXMenuObject.prototype.hide = function() {this._clearAndHide()};dhtmlXMenuObject.prototype.clearAll = function() {for (var a in this.itemPull){if (this.itemPull[a]["parent"] == this.idPrefix+this.topId){this.removeItem(String(a).replace(this.idPrefix,""))}};this._isInited = false};dhtmlXMenuObject.prototype.unload = function() {var obj = this.idPull;for (var a in obj){var el = obj[a];el.onmouseover = null;el.onmouseout = null;el.onclick = null;el.onselectstart = null;el.oncontextmenu = null;if (el.parentNode)el.parentNode.removeChild(el);el = null;obj[a] = null;try {delete obj[a]}catch(e){}};this.idPull = null;for (var a in this.itemPull)this.itemPull[a] = null;this.itemPull = null;if (this.base != null){this.base.className = "";this.base.oncontextmenu = null;this.base.onselectstart = null;this.base = null};this.setSkin = null;var basicMethods = new Array("_enableDacSupport", "_selectedSubItems", "_openedPolygons", "_addSubItemToSelected", "_removeSubItemFromSelected",

I did this…

     menu.addNewChild(menu.topId, 0, "file", "File", false);

taken from another sample instead of this…

     menu.addNewSibling(null, "file", "File", false); 

…and it works