/******************* MENU ************************/
var slideDuration = 600;

function menuItem(linkid, containerid, level, parentlink)
{
	this.parentlink = parentlink;
	this.link = RBS.Dom.GetElement(linkid);
	this.container = RBS.Dom.GetElement(containerid);
	this.innerHeight = 0;
	this.containervisible = false;
	this.level = level;
	this.slide = null;
	
	if (this.container != null)
	{
		this.innerHeight = this.container.offsetHeight + 10;
		this.slide = new Fx.Slide(containerid, {duration: slideDuration});
		this.slide.hide();
	}
	
	this.Toggle = function(e) {
	    if (this.level == 3)
	    {
	        if (this.link.tagName.toLowerCase() == "a")
	            this.link.click();
	        else
	            this.link.getElementsByTagName("a")[0].click();
	        return;
	    }
	        
		if (this.containervisible == false)
			this.link.className = "lk-level-" + this.level + " active";
		else
			this.link.className = "lk-level-" + this.level;
		this.containervisible = !this.containervisible;
		
		if (this.container != null)
		{
			this.container.style.height = this.innerHeight + 'px';
		
			//e = new Event(e);
			this.slide.toggle();
			//e.stop();
		}
	};
	this.Show = function (e) {
		this.link.className = "lk-level-" + this.level + " active";
		this.containervisible = true;
		if (this.container != null)
		{
			this.container.style.height = this.innerHeight + 'px';
			this.slide.show();
		}
	};
}
function showMenuItem(link)
{
	var l = link;
	while (l != null)
	{
		l.Show();
		l = l.parentlink;
	}
}

