var menu = function()
{
	function dd(n)
	{
		this.n = n;
		this.h = [];
		this.c = [];
	}
	
	dd.prototype.init=function(p)
	{
		var w = document.getElementById(p), s = w.getElementsByTagName('ul'), l = s.length;
		for(var i=0;i<l;i++)
		{
			var h = s[i].parentNode;
			this.h[i] = h;
			this.c[i] = s[i];
			h.onmouseover = new Function(this.n + '.st('+i+', true)');
			h.onmouseout = new Function(this.n + '.st('+i+')');
		}
	}

	dd.prototype.st = function(x, f)
	{
		var c = this.c[x], h = this.h[x], p = h.getElementsByTagName('a')[0];
		clearInterval(c.t);
		c.style.overflow = 'hidden';
		if(f)
		{
			if(!c.mh)
			{
				c.style.display = 'block';
				c.mh = c.offsetHeight;
				c.style.height = 0;
			}
			if(c.mh == c.offsetHeight)
			{
				c.style.overflow = 'visible';
			}
			else
			{
				c.style.zIndex = 1;
				c.t = setInterval(function() { sl(c,1) });
			}
		}
		else
		{
			c.t = setInterval(function() { sl(c, -1) });
		}
	}

	function sl(c, f)
	{
		var height = c.offsetHeight;
		var d = (f == 1) ? Math.ceil(c.mh - height) : height;
		c.style.height = height + (d * f) + 'px';
	}
	return {dd:dd}
}();
