function menuitem(text,url)
{
	this.itemmenu = menu;
	this.itemtext = text;
	this.itemurl = url;
}

function menu(id)
{
	_this = this;
	this.itemid = document.getElementById(id);
	this.menuid = 'menu'+id;
	this.menu = document.createElement('div');
	this.menu.setAttribute('id','menu'+id);
	this.menu.style.backgroundImage = "url(images/menushadow.png)";
	this.menu.style.color = "#000000";
	this.menu.style.position = "absolute";
	this.menu.style.minWidth = "250px";
	this.menu.style.left = -17 + "px";
	this.menu.style.top = 40 + "px";
	this.menu.style.zIndex = "100";
	this.menu.style.display = "none";

	this.menufooter = document.createElement('img');
	this.menufooter.src = "images/menufooter.png";
	this.menufooter.style.cssText = "position: absolute; z-index: 100; left: 0px; bottom: -20px; border: 0px;";
	this.menu.appendChild(this.menufooter);
	
	this.itemid.appendChild(this.menu);

	this.items = new Array();
	this.additem = additem;
	this.getnumitems = getnumitems;
	this.getitem = getitem;
	this.showmenu = showmenu;
	this.hidemenu = hidemenu;

	/*this.itemid.onmouseover = function()
	{
		_this.showmenu(_this.menuid);
	}

	this.itemid.onmouseout = function()
	{
		_this.hidemenu(_this.menuid);
	}*/
}

function additem(text,url)
{
	var item = new menuitem(text,url);
	this.items[this.items.length] = item; // not needed but kept for some reason
	var par = document.createElement('a');
	par.setAttribute('href',url);
	par.style.display = "block";
	par.style.textDecoration = "none";
	par.style.color = "#444444";
	par.style.fontSize = "8pt";
	par.style.marginLeft = "17px";
	par.style.marginRight = "17px";
	par.style.padding = "0px";
	par.style.paddingLeft = "20px";
	par.style.lineHeight = "35px";
	par.style.borderBottom = "1px dotted #cccccc";
	par.innerHTML = text;
	par.onmouseover = function()
	{
		par.style.backgroundColor = "#dddddd";
	}
	par.onmouseout = function()
	{
		par.style.backgroundColor = "#ffffff";
	}
	this.menu.appendChild(par);
}

function getnumitems()
{
	return this.items.length;
}

function getitem(i)
{
	return this.items[i];
}

function showmenu()
{
	this.menu.style.display = "block";
}

function hidemenu()
{
	this.menu.style.display = "none";
}
