if(!console) {
	var console={
		log: function(oObj) {}
	};
}
MenuHaut = Base.extend({
	constructor: function(oConfig) {
		this.config = oConfig;

		this.aLi = $$(this.config.menuitems);
		this.aLi.each(function(oLi, i) {
			var li = oLi.select('ul').first();
			if(li != undefined){
				oLi.Savedheight = li.getHeight();
				oLi.Savedwidth = li.getWidth();
				oLi.Savedfontsize = li.getStyle('font-size');
				new Effect.BlindUp(li,{
					duration : 0.2,
					afterFinish:function(){
						this.setStyle({
							left: '0px'
						});
					}.bind(li)
				});
				Event.observe(
					oLi,
					"mouseenter",
					function(event) {
						subMenu = this.select('ul').first();
						link = this.select('a').first();
						link.addClassName('actif');
						if(this.oEffectUp != undefined){
							this.oEffectUp.cancel();
							subMenu.setStyle({
								height: ''+this.Savedheight+'px',
								width: ''+this.Savedwidth+'px',
								fontSize: ''+this.Savedfontsize+''
							});
						}
						subMenu.setStyle({
							top: '-'+(this.Savedheight+32)+'px'
						});
						this.oEffectDown = new Effect.Grow(subMenu,{
							duration : 0.2,
							direction : 'bottom-left'
						});
					}.bindAsEventListener(oLi)
				);

				Event.observe(
					oLi,
					"mouseleave",
					function(event) {
						subMenu = this.select('ul').first();
						link = this.select('a').first();
						if(this.oEffectDown != undefined){
							this.oEffectDown.cancel();
							subMenu.setStyle({
								height: ''+this.Savedheight+'px',
								width: ''+this.Savedwidth+'px',
								fontSize: ''+this.Savedfontsize+''
							});
						}
						subMenu.setStyle({
							top: '-'+(this.Savedheight+32)+'px'
						});
						this.oEffectUp = new Effect.Shrink(subMenu,{
							duration : 0.2,
							direction : 'bottom-left',
							afterFinish:function(){
								this.removeClassName('actif');
							}.bind(link)
						});
					}.bindAsEventListener(oLi)
				);
			}
		});
	}
});

$(document).observe("dom:loaded", function() {
	new MenuHaut({
		"menuitems": "#menu_niv1 LI"
	});
});

