var sCurrent;
var cEl;

var objMenu = new Class({
    //implements
    Implements: [Options],
    
	initialize: function(el,options){
		this.setOptions(options);
		this.el = $(el);
		this.items = this.el.getElements('li');
		var a = 0;
        this.items.each(function(li,index) {
            sCurrent = li.get('id');
            sCurrent = sCurrent.substring(0,2);
            a = li.getElements('a');
            a.setStyle('opacity' , 0);
            if(sCurrent=='Li'){
                li.setStyle('background-image', 'none');
            }else{
               cEl = li;
            }
        });
    },
	
	show: function(obj, el) {
        if(cEl!=obj){
            el.set('morph', {duration: 50});
            el.morph({
                opacity: 1
            });
        }
	},
	
	hide: function(obj, el) {
        if(cEl!=obj){
            el.set('morph', {duration: 500});
            el.morph({
                opacity: 0
            });
        }
	}
});

window.addEvent('domready', function() {
    var menu = new objMenu('ulMenu');
    menu.items.each(function(li,index) {
        li.addEvents({
            'mouseover': function(){
                //menu.fade(li,"-" + li.getStyle('left') + ' -44px');
                menu.show(li,li.getElements('a'));
            },
            'mouseout': function(){
                //menu.fade(li,"-" + li.getStyle('left') + ' 0px');
                menu.hide(li,li.getElements('a'));
           }
        });
    });
    $('ulMenu').setStyle('opacity', 1);
});

