function c_menuitem(menu_parent, i_index, i_size)
{
	/////////////////////
	// private members //
	/////////////////////
	this.menu_parent = menu_parent;							// the menu in which this item exists
	this.i_index = i_index;									// the index of this item within the menu
	this.i_size = i_size;									// the dimension of this menu item
	this.s_id = menu_parent.get_id() +'_'+ i_index;			// the id of this item and its html layer
	this.s_link = '';										// the menu link itself - the contents of the c_menu items layer
	this.s_content = '';									// the contents of the c_menu content layer
	this.s_background_off = '#ffffff';						// the background colour of this item when it's not selected
	this.s_background_on = '#121212';						// the background colour of this item when it is selected


	/////////////////////////////////////
	// private member access functions //
	/////////////////////////////////////
	this.get_parent				= function() { return this.menu_parent; };
	this.get_index				= function() { return this.i_index; };
	this.get_size				= function() { return this.i_size; };
	this.get_id					= function() { return this.s_id; };
	this.get_link				= function() { return this.s_link; };
	this.get_content			= function() { return this.s_content; };
	this.get_background_off		= function() { return this.s_background_off; };
	this.get_background_on		= function() { return this.s_background_on; };


	this.set_size				= function(i_value) {
		this.i_size = i_value;
		return this.get_size();
	};

	this.set_link				= function(s_value) {
		this.s_link = s_value;
		return this.get_link();
	};

	this.set_content			= function(s_value) {
		this.s_content = s_value;
		return this.get_content();
	};

	this.set_background_off		= function(s_value) {
		this.s_background_off = s_value;
		return this.get_background_off();
	};

	this.set_background_on		= function(s_value) {
		this.s_background_on = s_value;
		return this.get_background_on();
	};


	////////////////////////////////////
	// complementary access functions //
	////////////////////////////////////
	this.get_parentid			= function() { return this.get_parent().get_id(); };
	this.get_vertical			= function() { return this.get_parent().get_vertical(); };
	this.get_contentlayer		= function() { return this.get_parent().get_contentlayer(); };
	this.get_changelayer		= function() { return this.get_parent().get_changelayer(); };
	this.get_mouseclick			= function() { return this.get_parent().get_mouseclick(); };

	this.get_layer				= function() {
		if(window.document.getElementById(this.get_id()))
			return window.document.getElementById(this.get_id());

		return false;
	};

	this.get_source				= function(i_position) {
		s_trigger = 'onmouseover';
		if(this.get_mouseclick()) s_trigger = 'onclick';

		var s_source  = '<div id="'+ this.get_id() +'" style="position: absolute; ';

		if(this.get_vertical())
			s_source += 'left: 0px; top: '+ i_position +'px; width:100%; height: '+ this.get_size() +'px;';
		else
			s_source += 'left: '+ i_position +'px; top: 0px; width: '+ this.get_size() +'px; height:100%;';

		s_source += ' background: '+ this.get_background_off() +';" '+ s_trigger +'="javascript:'+ this.get_parentid() +'.mouse_event('+ this.get_index() +');">\n'+ this.get_link() +'\n</div>\n';

		return s_source;
	};


	///////////////////////////
	// proprietary functions //
	///////////////////////////
	this.change_background_off	= function() {
		this.get_layer().style.background = this.get_background_off();
		return;
	};

	this.change_background_on	= function() {
		this.get_layer().style.background = this.get_background_on();
		return;
	};


	this.show					= function() {
		this.change_background_on();
		if(this.get_changelayer())
		{
			window.document.getElementById(this.get_content()).style.visibility = 'visible';
		}
		else
		{
			this.get_contentlayer().innerHTML = this.get_content();
		}

		return;
	};

	this.hide					= function() {
		this.change_background_off();
		if(this.get_changelayer())
		{
			window.document.getElementById(this.get_content()).style.visibility = 'hidden';
		}

		return;
	};

}

/////////////////////////////////////////////////////////////////////////////////////////
//
// c_menu
//
// DESCRIPTION:	
//
// ARGUMENTS:	(string)	s_id: the id of this object
//				(uint)		i_width: the total width of this menu
//				(uint)		i_height: the total height of this menu
//				(uint)		i_menusize: the size of the menu element
//				(boolean)	b_vertical: vertical menu or not
//				(boolean)	b_contentfirst: show the content left/right (vertical), top/bottom (not vertical)
//
// RETURNS:		none
//
/////////////////////////////////////////////////////////////////////////////////////////
function c_menu(s_id, i_width, i_height, i_menusize, b_vertical, b_contentfirst)
{
	/////////////////////
	// private members //
	/////////////////////
	this.s_id = s_id;									// the id of this object and the js var it is stored in
	this.itemar_options = new Array();					// array of c_menuitem objects
	this.i_width = i_width;								// the total width of the menu object
	this.i_height = i_height;							// the total height of the menu object
	this.i_menusize = i_menusize;						// the size of the menu element
	this.b_vertical = b_vertical;						// vertical or not
	this.b_contentfirst = b_contentfirst;				// show content first or not
	this.b_changelayer = false;
	this.b_mouseclick = false;							// if true, menu changes when user clicks - otherwise mouse over


	/////////////////////////////////////
	// private member access functions //
	/////////////////////////////////////
	this.get_id					= function() { return this.s_id; };
	this.get_items				= function() { return this.itemar_options; };
	this.get_width				= function() { return this.i_width; };
	this.get_height				= function() { return this.i_height; };
	this.get_menusize			= function() { return this.i_menusize; };
	this.get_vertical			= function() { return this.b_vertical; };
	this.get_contentfirst		= function() { return this.b_contentfirst; };
	this.get_changelayer		= function() { return this.b_changelayer; };
	this.get_mouseclick			= function() { return this.b_mouseclick; }


	this.set_width				= function(i_value) {
		this.i_width = i_value;
		return this.get_width();
	};

	this.set_height				= function(i_value) {
		this.i_height = i_value;
		return this.get_height();
	};

	this.set_menusize			= function(i_value) {
		this.i_menusize = i_value;
		return this.get_menusize();
	};

	this.set_vertical			= function(b_value) {
		if(b_value) this.b_vertical = true;
		else this.b_vertical = false;

		return this.get_vertical();
	};

	this.set_contentfirst		= function(b_value) {
		if(b_value) this.b_contentfirst = true;
		else this.b_contentfirst = false;

		return this.get_contentfirst();
	};

	this.set_changelayer		= function(b_value) {
		if(b_value) this.b_changelayer = true;
		else this.b_changelayer = false;

		return this.get_changelayer();
	};

	this.set_mouseclick			= function(b_value) {
		if(b_value) this.b_mouseclick = true;
		else this.b_mouseclick = false;

		return this.get_mouseclick();
	};


	////////////////////////////////////
	// complementary access functions //
	////////////////////////////////////
	this.get_contentsize		= function() {
		if(this.get_vertical())
			return this.get_width() - this.get_menusize();
		else
			return this.get_height() - this.get_menusize();
	};

	this.get_itemcount			= function() { return this.get_items().length; };
	this.get_item				= function(i_index) {
		if(i_index >= 0 && i_index < this.get_itemcount())
		return this.get_items()[i_index];
	};

	this.get_layer				= function() {
		if(window.document.getElementById(this.get_id()))
			return window.document.getElementById(this.get_id());

		return false;
	};

	this.get_contentlayer		= function() {
		if(window.document.getElementById(this.get_id() + '_content'))
			return window.document.getElementById(this.get_id() + '_content');

		return false;
	};


	this.set_item				= function(item_value, i_index) {
		if(i_index >= 0 && i_index <= this.get_itemcount())
		this.itemar_options[i_index] = item_value;

		return this.get_item(i_index);
	};

	this.add_item				= function(i_size, s_link, s_content, s_background_off, s_background_on) {
		var item_new = new c_menuitem(this, this.get_itemcount(), i_size);
		item_new.set_link(s_link);
		item_new.set_content(s_content);
		item_new.set_background_off(s_background_off);
		item_new.set_background_on(s_background_on);
		this.set_item(item_new, this.get_itemcount());

		return this.get_item(this.get_itemcount()-1);
	};


	///////////////////////////
	// proprietary functions //
	///////////////////////////
	this.get_markup				= function() {
		var s_source  = '<div id="'+ this.get_id() +'_items" style="position: absolute; ';

		if(this.get_vertical())
		{
			if(this.get_contentfirst())	s_source += 'right';
			else						s_source += 'left';

			s_source += ': 0px; top: 0px; width: '+ this.get_menusize() +'px; height: 100%;">\n';
		}
		else
		{
			s_source += 'left: 0px; ';

			if(this.get_contentfirst())	s_source += 'bottom';
			else						s_source += 'top';

			s_source += ': 0px; width: 100%; height: '+ this.get_menusize() +'px;">\n';
		}

		// add menuitems
		var i_position = 0;

		for(var i_count = 0; i_count < this.get_itemcount(); i_count++)
		{
			s_source += this.get_item(i_count).get_source(i_position);
			i_position += this.get_item(i_count).get_size();
		}


		s_source += '</div>\n';


		if(!this.get_changelayer())
		{
			// add content
			s_source += '<div id="'+ this.get_id() +'_content" style="position: absolute; ';

			if(this.get_vertical())
			{
				if(this.get_contentfirst())	s_source += 'left';
				else						s_source += 'right';

				s_source += ': 0px; top: 0px; width: '+ this.get_contentsize() +'px; height: 100%;';
			}
			else
			{
				s_source += 'left: 0px; ';

				if(this.get_contentfirst())	s_source += 'top';
				else						s_source += 'bottom';

				s_source += ': 0px; width: 100%; height: '+ this.get_contentsize() +'px;';
			}

			s_source += ' background: #aaaaaa;">\n</div>\n';
		}

		//alert(s_source);

		return s_source;
	};


	this.create					= function() {
		if(this.get_layer())
		{
			if(!this.get_changelayer())
			{
				this.get_layer().style.width = this.get_width() + 'px';
				this.get_layer().style.height = this.get_height() + 'px';
			}
			else
			{
				if(this.get_vertical())
				{
					this.get_layer().style.width = this.get_menusize() + 'px';
					this.get_layer().style.height = this.get_height() + 'px';
				}
				else
				{
					this.get_layer().style.width = this.get_width() + 'px';
					this.get_layer().style.height = this.get_menusize() + 'px';
				}
			}


			this.get_layer().innerHTML = this.get_markup();
			this.mouse_event(0);
		}

		return;
	};


	this.mouse_event			= function(i_index) {
		for(var i_count = 0; i_count < this.get_itemcount(); i_count++)
		{
			if(i_count == i_index)
			{
				this.get_item(i_count).show();
			}
			else
			{
				this.get_item(i_count).hide();
			}
		}

		return;
		
	};
	
	

}




  