
// modified TinyMenu by Andy Brandt
// adapted from http://www.leigeber.com/2008/11/drop-down-menu/

var menu=function()
{
	var t=200; // close timeout
	var z=50,s=6,a;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c)
	{
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;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];
		clearTimeout(c.t);
		if(f)
		{
			p.className+=' '+a;
			c.style.overflow = 'visible';
			c.style.display = 'block';
			c.style.zIndex = z;
			z++;
		}
		else
		{
			p.className=p.className.replace(a,'');
			c.t=setTimeout(function(){cl(c)},t);
		}
	}
	function cl(c){
		c.style.overflow='hidden';
		c.style.display = 'none';
	}	
	return{dd:dd}
}();
