function ContextMenu(name) {
	this.items = new Array();	// array of CMItems
	this.width = null;
	this.name = name;
	this.submenus = new Array();

	this.addItem = function (item) {
		this.items.push(new CloneObject(item));	// clone the object so that other menus don't change properties of it (since it's just a reference normally)
		if (item instanceof CMSubmenu) {
			this.submenus.push(this.items[this.items.length - 1]);
			this.submenus[this.submenus.length - 1].subId = this.submenus.length - 1;
			this.submenus[this.submenus.length - 1].linkId = "cm_" + this.name + "_" + this.submenus.length;
		}
	}

	// myArray should be an array of CMItems
	this.addItems = function (myArray) {
		for (x in myArray) {
			this.addItem(myArray[x]);
		}
	}

	this.setWidth = function (newWidth) {
		this.width = parseInt(newWidth);
	}

	this.clear = function () {
		this.items = new Array();
	}

	this.draw = function (subText) {
		var out = "";
		for (var i = 0; i < this.items.length; i++) {
			out += this.items[i].draw(subText);
		}
		return out;
	}
}
