var t=0;
var subs = $$("#menubar ul");
var fx = new Fx.Elements(subs,{duration:20,transition:Fx.Transitions.quadOut});
var hideobj = {};

subs.each(function(sub,i) { { hideobj[i] = { "height": 0 }; } });

$$("#menubar").getElements("a")[0].addEvent("mouseover",function(e) {
	$clear(t);
	if (this.getParent().getParent().id=="menubar") {
	  var obj = {};
	  var sub = this.getParent().getElement("ul");
		subs.each(function(other,i){
		  if (other==sub) { obj[i] = { "height": sub.getSize().scrollSize.y }; }
			else { obj[i]={"height":0}; }
		});
		fx.start(obj);
	}
});

$$("#menubar").getElements("a")[0].addEvent("mouseout",function(e) {
	t = function() { fx.start(hideobj);}.delay(20);
});



