window.addEvent('domready',function() {
	if( $('menubar') )
	{
		var topbar = $('menubar').set('tween',{ duration: 200 }), topDistance = 30, fadeTo = 0.5;
		var topbarME = function() { topbar.tween('opacity',1); }, topbarML = function() { topbar.tween('opacity',fadeTo); };
		var events = {
			mouseenter: topbarME,
			mouseleave: topbarML
		};
		var ss = new ScrollSpy({
			min: topDistance,
			max: window.getScrollSize().y + 1000,
			onLeave: function() {
				topbarME();
				topbar.removeEvents(events);
			},
			onEnter: function() {
				topbarML();
				topbar.addEvents(events);
			}
		});
		/*
		var barItems = $$('.menubaritems').each(function(item){
			var myEffect = new Fx.Morph(item, {
    			duration: 1000,
    			transition: Fx.Transitions.Sine.easeOut
			});
			item.addEvents({
				mouseenter: function(){
					myEffect.start('.active');
				}
				/*,
				mouseleave: function(){
					item.getChildren('a').tween('color', '#636363');
				}
			});
    	});*/
	}
});

