/*
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ContextMenu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
	/**
	 *	ContextMenu
	 *	The context menu class provides a replacement to the system default context menu.
	 *
	 *	@param name (Optional) The name of this context menu.  This is the text that will be displayed at the top
	 *				of the menu
	 *	@param width (Optional) The width of this context menu, default = 200
	 *
	 *	@constructor
	 */
	function ContextMenu(name, width) {
		this.i_name = name;
		this.i_width = (width == undefined ? ContextMenu.i_defaultWidth : width);
		this.i_visible = false;
		this.i_left = 0;
		this.i_top = 0;
		
		this.i_items = Array();
	}
	
	/**
	 *	The default width of all context menu's which dont define a width
	 */
	ContextMenu.i_defaultWidth = 200;
	
	/**
	 *	The height of standard context menu items
	 */
	ContextMenu.standardHeight = 16;
	
	/**
	 *	Get the parent context menu item of this menu.  If this is the root menu, then undefined will be returned
	 *
	 *	@return the parent context menu item, or undefined if this is the root.
	 */
	ContextMenu.prototype.parent = function() {
		return this.i_parent;
	}
	
	/**
	 *	Get/Set the width of this context menu
	 *
	 *	@param width (Optional) The new width of this menu
	 *
	 *	@return the current width of this menu
	 */
	ContextMenu.prototype.name = function(name) {
		if (name != undefined) {
			if (this.i_name != name) {
				if (this.i_label != undefined) {
					if (this.i_name == "" || this.i_name == undefined) {
						// bringing back
						if (this.i_items.length > 0) {
							this.i_menu.insertBefore(this.i_label.getItem(), this.i_items[0].getItem());
							this.i_menu.insertBefore(this.i_title_bar.getItem(), this.i_items[0].getItem());
						}
						else {
							this.i_menu.appendChild(this.i_label.getItem());
							this.i_menu.appendChild(this.i_title_bar.getItem());
						}
					}
					if (name == "" && this.i_name != undefined) {
						// going away
						this.i_menu.removeChild(this.i_label.getItem());
						this.i_menu.removeChild(this.i_title_bar.getItem());
					}
					this.i_label.name(name);
				}
				this.i_name = name;
			}
		}	
		return this.i_name;
	}
	
	/**
	 *	Get/Set the left position of this context menu
	 *
	 *	@param x The left position of this menu
	 *
	 *	@return the current x position of this menu
	 */
	ContextMenu.prototype.left = function(x) {
		if (x != undefined) {
			this.i_left = x;
			if (this.i_menu != undefined) {
				this.i_menu.style.left = x + "px";
			}
		}
		return this.i_left;
	}
	
	/**
	 *	Get/Set the top position of this context menu
	 *
	 *	@param y (Optional) The new y position of this context menu
	 *
	 *	@return the current y position of this context menu
	 */
	ContextMenu.prototype.top = function(y) {
		if (y != undefined) {
			this.i_top = y;
			if (this.i_menu != undefined) {
				this.i_menu.style.top = y + "px";
			}
		}
		return this.i_top;
	}
	
	/**
	 *	Close all the child context menu's of this item
	 *
	 *	@private
	 *
	 *	@return true
	 */
	ContextMenu.prototype.closeChildren = function() {
		for (var x = 0; x < this.i_items.length; x++) {
			if (this.i_items[x].child != undefined) {
				if (this.i_items[x].child() != undefined) {
					this.i_items[x].child().visible(false);
				}
			}
		}
		return true;
	}
	
	/**
	 *	Get/Set the width of this context menu
	 *
	 *	@param width (Optional) The new width of this context menu
	 *
	 *	@return the current width of this context menu
	 */
	ContextMenu.prototype.width = function(width) {
		if (width != undefined) {
			this.i_width = width;
			if (this.i_menu != undefined) {
				this.i_menu.style.width = width + "px";
			}
		}
		return this.i_width;
	}
	
	/**
	 *	Get the height of this context menu
	 *
	 *	@return the current height of this menu
	 */
	ContextMenu.prototype.height = function() {
		this.getMenu();
		var height = ((this.name() == undefined || this.name() == "") ? 0 : this.i_label.height() + this.i_title_bar.height());
		for (var x = 0; x < this.i_items.length; x++) {
			if (this.i_items[x].visible()) {
				height+=this.i_items[x].height();
			}
		}
		return height;
		
	}
	
	/**
	 *	Get an array of items in this menu, or a single item if an index is provided
	 *
	 *	@param index (Optional) The index of the item you want to work with
	 *
	 *	@return an array of items, or a single item if an index was provided
	 */
	ContextMenu.prototype.items = function(index) {
		if (index != undefined) {
			return this.i_items[index];
		}
		return this.i_items;
	}
	
	/**
	 *	Add a new item to this context menu
	 *
	 *	@param item The item to add
	 *	@param beforeItem The item to place this item before
	 *
	 *	@return the item which was just added
	 */
	ContextMenu.prototype.addItem = function(item, beforeItem) {
		var append = true;
		item.i_parent = this;
		if (beforeItem != undefined) {
			for (var x = 0; x < this.i_items.length; x++) {
				if (this.i_items[x] == beforeItem) {
					append = false;
					this.i_items.splice(x, 0, item);
					if (this.i_menu != undefined) {
						this.i_menu.insertBefore(item.getItem(), beforeItem.getItem());
					}
					break;
				}
			}
		}
		if (append) {
			this.i_items[this.i_items.length] = item;	
			if (this.i_menu != undefined) {
				this.i_menu.appendChild(item.getItem());
			}
		}
		return item;
	}
	
	/**
	 *	Remove an item from the context menu
	 *
	 *	@param item The item to remove
	 *
	 *	@return true if the item was removed, false otherwise
	 */
	ContextMenu.prototype.removeItem = function(item) {
		for (var x = 0; x < this.i_items.length; x++) {
			if (this.i_items[x] == item) {
				this.i_items.splice(x, 1);
				item.i_parent = undefined;
				if (this.i_menu != undefined) {
					this.i_menu.removeChild(item.getItem());
				}
				return true;
			}
		}
		return false;
	}
	
	/**
	 *	Check to see if the cursor is currently over this menu item, or one of its decendents
	 *
	 *	@return true if the cursor is over this menu item, false otherwise
	 */
	ContextMenu.prototype.cursorFocus = function() {
		if (Environment.getCursorX() > this.left() && Environment.getCursorX() < this.left() + this.width()) {
			if (Environment.getCursorY() > this.top() && Environment.getCursorY() < this.top() + this.height()) {
				return true;
			}
		}
		for (var x = 0; x < this.i_items.length; x++) {
			if (this.i_items[x].child != undefined) {
				if (this.i_items[x].child() != undefined) {
					if (this.i_items[x].child().cursorFocus()) {
						return true;
					}
				}
			}

		}
		return false;
	}
	
	/**
	 *	Handle when the mouse is depressed anywhere on the document
	 *
	 *	@private
	 *
	 *	@param e The event that triggered this
	 *
	 *	@return true
	 */
	ContextMenu.prototype.handleMouseDown = function(e) {
		this.i_list.destroy();
		if (this.cursorFocus()) {
			
			this.i_list = EventControl.listen(document.body, "onmouseup", this.handleMouseUp, this);
		}
		else {
			
			this.visible(false);
			this.i_list = undefined;
		}
	}
	
	/**
	 *	Handle when the mouse is released anywhere on the document, after being depressed
	 *
	 *	@private
	 *
	 *`	@param e The event that triggered this
	 *
	 *	@return true
	 */
	ContextMenu.prototype.handleMouseUp = function(e) {
		this.i_list.destroy();
		if (!this.cursorFocus()) {
			this.visible(false);
		}
		this.i_list = undefined;
	}
	
	/**
	 *	Get/Set whether this context menu is currently visible or not
	 *
	 *	@param state (Optional) The new visible state of this context menu
	 *
	 *	@param the current visibility of this menu
	 */
	ContextMenu.prototype.visible = function(state) {
		if (state != undefined) {
			if (this.i_visible != state) {
				this.i_visible = state;
				if (state) {
					if (this.left() + this.width() > Environment.browserWidth()) {
						this.left(this.left() - this.width());
					}
					if (this.top() + this.height() > Environment.browserHeight()) {
						this.top(this.top() - this.height());
					}
				}
				
				if (this.i_init_vis == undefined) {
					this.i_init_vis = true;
					document.body.appendChild(this.getMenu());
				}
				if (this.i_menu != undefined) {
					this.i_menu.style.display = (state ? "" : "none");
				}
				if (!state) {
					this.closeChildren();
					if (this.i_list != undefined) {
						this.i_list.destroy();
					}
				}
				else {
					if (this.parent() == undefined) {
						this.i_list = EventControl.listen(document.body, "onmousedown", this.handleMouseDown, this);
					}
				}
				
			}
			
		}
		return this.i_visible;
	}
	
	/** 
	 *	Get the DIV that contains this menu
	 *
	 *	@return the DIV that contains this menu
	 */
	ContextMenu.prototype.getMenu = function() {
		if (this.i_menu == undefined) {
			this.i_menu = document.createElement('DIV');
			this.i_menu.className = "ContextMenu";
			this.i_menu.style.left = this.left() + "px";
			this.i_menu.style.top = this.top() + "px";
			this.i_menu.style.width = this.width() + "px";
			this.i_menu.style.display = (this.visible() == true ? "" : "none");
			
				
				this.i_label = new ContextMenuLabel(this.name(), "center");
				this.i_title_bar = new ContextMenuDivider();
				
				if (this.name() != "" && this.name() != undefined) {
					this.i_menu.appendChild(this.i_label.getItem());
					this.i_menu.appendChild(this.i_title_bar.getItem());
				}
				
				for (var x = 0; x < this.i_items.length; x++) {
					this.i_menu.appendChild(this.i_items[x].getItem());
				}
				
		}
		return this.i_menu;
	}
	
	
/*
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ContextMenuDivider %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
	/**
	 *	ContextMenuDivider
	 *	This class provides a simple divider line to place inside any context menu
	 *
	 *	@constructor
	 */
	function ContextMenuDivider() {
		this.i_visible = true;
	}
	
	/**
	 *	Get the height of this context menu item
	 *
	 *	@return the height of this item
	 */
	ContextMenuDivider.prototype.height = function() {
		return 3;
	}
	
	
	/**
	 *	Get/Set if this divider is visible
	 *
	 *	@param state (Optional) The new visible state of this dividier
	 *
	 *	@return the current visible state of this divider
	 */
	ContextMenuDivider.prototype.visible = function(state) {
		if (state != undefined) {
			this.i_visible = state;
			if (this.i_item != undefined) {
				this.i_item.style.display = (this.visible() ? "" : "none");
			}
		}
		return this.i_visible;
	}
	
	/**
	 *	Get the DIV that contains this menu item
	 *
	 *	@return the DIV that contains this menu item
	 */
	ContextMenuDivider.prototype.getItem = function() {
		if (this.i_item == undefined) {
			this.i_item = document.createElement('DIV');
			this.i_item.className = "ContextMenuDivider";
			this.i_item.style.height = this.height() + "px";
			this.i_item.style.display = (this.visible() ? "" : "none");
			
				this.i_item_bar = document.createElement('DIV');
				this.i_item_bar.className = "ContextMenuDivider_bar";
				this.i_item_bar.innerHTML = "&nbsp;";
				this.i_item.appendChild(this.i_item_bar);
		}
		return this.i_item;
	}
	
	
/*
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ContextMenuLabel %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
	/**
	 *	ContextMenuLabel
	 *	This class provides a simple text label inside a context menu
	 *
	 *	@param name The text to display for this label
	 *	@param align (Optional) The text alignment for this label (right, left, center)
	 *
	 *	@constructor
	 */
	function ContextMenuLabel(name, align) {
		this.i_name = name;
		this.i_align = (align == undefined ? "center" : align);;
		this.i_visible = true;
	}
	
	/**
	 *	Get/Set the name of this label.  This is the display text
	 *
	 *	@param name (Optional) The new name to set for this label
	 *
	 *	@return the current name of this label
	 */
	ContextMenuLabel.prototype.name = function(name) {
		if (name != undefined) {
			this.i_name = name;
			if (this.i_item != undefined) {
				this.i_item.innerHTML = name;
			}
		}
		return this.i_name;
	}
	
	/**
	 *	Get the height of this context menu item
	 *
	 *	@return the height of this item
	 */
	ContextMenuLabel.prototype.height = function() {
		return ContextMenu.standardHeight;
	}
	
	/**
	 *	Get/Set the text alignment of this label. 
	 *
	 *	@param align (Optional) The text alignment, either right, left, or center
	 *
	 *	@return the current alignment of this label
	 */
	ContextMenuLabel.prototype.align = function(align) {
		if (align != undefined) {
			this.i_align = align;
			if (this.i_item != undefined) {
				this.i_item.className = (this.align() == "center" ? "ContextMenuLabel_center" : (this.align() == "right" ? "ContextMenuLabel_right" : "ContextMenuLabel_left"));
			}
		}
		return this.i_align;
	}
	
	/** 
	 *	Get/Set if this label is visible
	 *
	 *	@param state (Optional) The new visible state of this label
	 *
	 *	@return the current visible state of this item
	 */
	ContextMenuLabel.prototype.visible = function(state) {
		if (state != undefined) {
			this.i_visible = state;
			if (this.i_item != undefined) {
				this.i_item.style.display = (this.visible() ? "" : "none");
			}
		}
		return this.i_visible;
	}
	
	/**
	 *	Get the DIV that contains this label
	 *
	 *	@return the DIV that contains this label
	 */
	ContextMenuLabel.prototype.getItem = function() {
		if (this.i_item == undefined) {
			this.i_item = document.createElement('DIV');
			this.i_item.className = (this.align() == "center" ? "ContextMenuLabel_center" : (this.align() == "right" ? "ContextMenuLabel_right" : "ContextMenuLabel_left"));
			this.i_item.style.height = this.height() + "px";
			this.i_item.style.lineHeight = this.height() + "px";
			this.i_item.innerHTML = this.name();
			this.i_item.style.display = (this.visible() ? "" : "none");
		}
		return this.i_item;
	}

	
	
/*
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ContextMenuItem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
	/**
	 *	ContextMenuItem
	 *	This is the universal context menu item, it should work for just about any need
	 *
	 *	@param name The name of this context menu item (the text to be displayed)
	 *	@param iconClass (Optional) The CSS class name that defines this context menu items icon image
	 *	@param enabled (Optional) Whether this item is enabled or not
	 *
	 *	@constructor
	 */
	function ContextMenuItem(name, iconClass, enabled) {
		this.i_name = name;
		this.i_iconClass = iconClass;
		this.i_enabled = (enabled == undefined ? true : enabled);
		this.i_visible = true;
		
		this.i_child;
	}
	
	/**
	 *	Handler for when this context menu item gets selected
	 *
	 *	@param e The event that triggered this
	 *		e.item = the context menu item that was selected
	 */
	ContextMenuItem.prototype.onclick = null;
	
	/**
	 *	Get the parent menu of this item
	 *
	 *	@return the parent menu
	 */
	ContextMenuItem.prototype.parent = function() {
		return this.i_parent;
	}
	
	/**
	 *	Get/Set the name of this context menu item
	 *
	 *	@param name (Optional) The new name for this context menu item
	 *
	 *	@return the current name of this context menu item
	 */
	ContextMenuItem.prototype.name = function(name) {
		if (name != undefined) {
			this.i_name = name;
			if (this.i_item != undefined) {
				this.i_item_label.innerHTML = this.name();
			}
		}
		return this.i_name;
	}
	
	/**
	 *	Get the top position of this context menu item
	 *
	 *	@return the top position of this menu item
	 */
	ContextMenuItem.prototype.top = function() {
		var top = this.parent().top() + ((this.parent().name() != "" && this.parent().name() != undefined) ? this.parent().i_label.height() + this.parent().i_title_bar.height() : 0);
		for (var x = 0; x < this.parent().i_items.length; x++) {
			if (this.parent().i_items[x] == this) {
				break;
			}
			top+=this.parent().i_items[x].height();
		}
		return top;
	}
	
	/**
	 *	Get/Set the icon css class name to use to define the icon image
	 *
	 *	@param iconClass (Optional) The new class to use to define the icon image
	 *
	 *	@return the current icon class being used
	 */
	ContextMenuItem.prototype.iconClass = function(iconClass) {
		if (iconClass != undefined) {
			this.i_iconClass = iconClass;
			this.updateStyle();
		}
		return this.i_iconClass;
	}
	
	/**
	 *	Get the height of this context menu item
	 *
	 *	@return the height of this item
	 */
	ContextMenuItem.prototype.height = function() {
		return ContextMenu.standardHeight;
	}
	
	/**
	 *	Get/Set whether this context menu item is enabled
	 *
	 *	@param state (Optional) Whether to set this item as enabled
	 *
	 *	@return the current state of this item
	 */
	ContextMenuItem.prototype.enabled = function(state) {
		if (state != undefined) {
			this.i_enabled = state;
			this.updateStyle();
		}
		return this.i_enabled;
	}
	
	/**
	 *	Get/Set the child menu of this context menu item
	 *
	 *	@param child (Optional) The new child menu of this menu item
	 *
	 *	@return the current child of this menu item.
	 */
	ContextMenuItem.prototype.child = function(child) {
		if (child != undefined) {
			if (child == false) {
				this.i_child = undefined;
			}
			else {
				this.i_child = child;
			}
			this.updateStyle();
		}
		return this.i_child;
	}
	
	/**
	 *	Get/Set if this item is visible
	 *
	 *	@param state (Optional) The new visible state of this item
	 *
	 *	@return the current visibility of this item
	 */
	ContextMenuItem.prototype.visible = function(state) {
		if (state != undefined) {
			this.i_visible = state;
			if (this.i_item != undefined) {
				this.i_item.style.display = (this.visible() ? "" : "none");	
			}
		}
		return this.i_visible;
	}
	
	/**
	 *	Get/Set whether this menu item is selected
	 *
	 *	@param state (Optional) The new selected state of this menu item
	 *
	 *	@return the current selected state of this menu item
	 */
	ContextMenuItem.prototype.selected = function(state) {
		if (state != undefined) {
			this.i_selected = state;
			this.updateStyle();
		}
		return this.i_selected;
	}
	
	/**
	 *	Update the style of this context menu item
	 *
	 *	@private
	 *
	 *	@return true
	 */
	ContextMenuItem.prototype.updateStyle = function() {
		if (this.i_item != undefined) {
			this.i_item.className = "ContextMenuItem" + (this.child() != undefined ? " ContextMenuItem_children" : "") +
								    (this.selected() == true ? " ContextMenuItem_selected" : "") +
								    (this.enabled() == false ? " ContextMenuItem_disabled" : "") + 
								    (this.iconClass() != undefined ? " " + this.iconClass() : "");
		}
	}
	
	/**
	 *	Handle when the mouse hovers over this item
	 *
	 *	@private
	 *
	 *	@param e The event that triggered this
	 *
	 *	@return true
	 */
	ContextMenuItem.prototype.handleMouseOver = function(e) {
		this.parent().closeChildren();
		if (this.enabled()) {
			this.selected(true);		
			if (this.child() != undefined) {
				this.child().left(this.parent().left() + this.parent().width());
				this.child().top(this.top());
				this.child().visible(true);
			}
		}
	}
	
	/**
	 *	Handle when the mouse hovers away from this item
	 *
	 *	@private
	 *
	 *	@param e The event that triggered this
	 *
	 *	@return true
	 */
	ContextMenuItem.prototype.handleMouseOut = function(e) {
		this.selected(false);
	}
	
	/**
	 *	Handle when this item is selected
	 *
	 *	@private
	 *
	 *	@param e The event that triggered this
	 *
	 *	@return true
	 */
	ContextMenuItem.prototype.handleClick = function(e) {
		if (this.enabled()) {
			this.parent().visible(false);
			if (this.onclick != undefined) {
				var o = new Object();
				o.type = "click";
				o.item = this;
				this.onclick(o);
			}
		}
	}
	
	/**
	 *	Get the DIV that contains this menu item
	 *
	 *	@return the DIV that contains this menu
	 */
	ContextMenuItem.prototype.getItem = function() {
		if (this.i_item == undefined) {
			this.i_item = document.createElement('DIV');
			EventControl.listen(this.i_item, "onmouseover", this.handleMouseOver, this);
			EventControl.listen(this.i_item, "onmouseout", this.handleMouseOut, this);
			EventControl.listen(this.i_item, "onclick", this.handleClick, this);
			this.i_item.style.display = (this.visible() ? "" : "none");
			

				this.i_item_label = document.createElement('DIV');
				this.i_item_label.className = "ContextMenuItem_label";
				this.i_item_label.innerHTML = this.name();
				this.i_item_label.style.height = this.height() + "px";
				this.i_item_label.style.lineHeight = this.height() + "px";
				this.i_item.appendChild(this.i_item_label);
			
			this.updateStyle();
		
		}
		return this.i_item;
	}
	
/*
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ContextMenuRadio %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
	/**
	 *	ContextMenuRadio
	 *	This class provides a grouped radio like selection structure in a context menu
	 *
	 *	@param groupId The common ID that all radio's in this cluster share
	 *	@param name The name of this context menu item (the display text)
	 *	@param enabled (Optional) Whether this option is enabled or not
	 *	@param state (Optional) The selected state of this option.
	 *	
	 *	@constructor
	 */
	function ContextMenuRadio(groupId, name, enabled, state) {
		this.i_group = groupId;
		this.i_name = name;
		this.i_enabled = (enabled != undefined ? enabled : true);
		this.i_state = (state != undefined ? state : false);
		this.i_iconClass = (state == true ? "ContextMenuRadio_selected" : "ContextMenuRadio");
		
	}
	
	/**
	 *	Get the group ID of this context menu item
	 *
	 *	@return the current group Id of this menu item
	 */
	ContextMenuRadio.prototype.group = function() {
		return this.i_group;
	}
	
	/**
	 *	Get/Set the state of this radio.  If set to true, all other radios in this group will be unselected
	 *
	 *	@param state (Optional) the new selected state of this radio option
	 *
	 *	@return the current state of this radio
	 */
	ContextMenuRadio.prototype.state = function(state) {
		if (state != undefined) {
			if (this.i_state != state) {
				this.i_state = state;
				if (state) {
					if (this.parent() != undefined) {
						for (var x = 0; x < this.parent().items().length; x++) {
							if (this.parent().items(x).group != undefined) {
								if (this.parent().items(x).group() == this.group()) {
									this.parent().items(x).state(false);
								}
							}
						}
					}
				}
				this.iconClass(state == true ? "ContextMenuRadio_selected" : "ContextMenuRadio");
			}
		}
		return this.i_state;
	}
	
	ContextMenuRadio.inherit(ContextMenuItem);
	
/*
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ContextMenuBoolean %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
	/**
	 *	ContextMenuBoolean
	 *	This class provides a context menu option with two states
	 *
	 *	@param name The name of this menu item (the display text
	 *	@param enabled (Optional) The enabled state of this item
	 *	@param state (Optional) The state of this menu item
	 *
	 *	@constructor
	 */
	function ContextMenuBoolean(name, enabled, state) {
		this.i_name = name;
		this.i_enabled = (enabled != undefined ? enabled : true);
		this.i_state = (state != undefined ? state : false);
		
		this.i_iconClass = (state == true ? "ContextMenuBoolean_selected" : "ContextMenuBoolean");
	}
	
	/**
	 *	Get/Set the state of this boolean option.   
	 *
	 *	@param state (Optional) the new selected state of this boolean option
	 *
	 *	@return the current state of this boolean option
	 */
	ContextMenuBoolean.prototype.state = function(state) {
		if (state != undefined) {
			this.i_state = state;
			this.iconClass(state == true ? "ContextMenuBoolean_selected" : "ContextMenuBoolean");
		}
		return this.i_state;
	}
	
	ContextMenuBoolean.inherit(ContextMenuItem);
	

