/**
 * Light Menu System v0.1
 * @author Jonathan Schemoul
 * @copyright 2006-2007 Holdiland
 * @license GPL V2 or newer
 */
var menuEffects = new Class({
    initialize: function(selector, options) {
        this.options = Object.extend({
            subElement: false,
            subElementSelector: 'a',
            dropWidth: '122px'
        }, options || {})
        this.selector = selector;
        this.currTimer = 500;
        $$(selector + ' li ul').each(function(el) {
            el.setStyles({
                'display': 'block',
                'width': this.options['dropWidth']
            });
            normalHeight = el.offsetHeight;
            el.setStyles({
                'height': 0,
                'overflow': 'hidden'
            });
            if (!Browser.Engine.presto) {
                el.setStyle('width', 'auto');
            }
            elParent = $(el.parentNode);
            
            currentMenu = new Fx.Tween(el, {
                property: 'height'
            });
            elParent.addEvents({
                'mouseenter': function(submenu, myParent, targetValue, el, newWidth) {
                    myParent.addClass('hover');
                    el.setStyles({
						'width': newWidth,
						'zIndex': 102
					});
                    submenu.cancel();
                    submenu.start(targetValue);
                }.pass([currentMenu, elParent, normalHeight, el, this.options.dropWidth]),
                'mouseleave': function(submenu, myParent, targetValue, el, newWidth) {
                    myParent.removeClass('hover');
                    el.setStyles({
						'width': newWidth,
						'zIndex': 101
					});
                    submenu.cancel();
                    submenu.start(targetValue);
                }.pass([currentMenu, elParent, 0, el, this.options.dropWidth])
            });
        }.bind(this));
        $$(selector + ' li.category').each(function(el) {
            el.addEvents({
                'mouseenter': function(){ this.addClass('hover'); },
                'mouseleave': function(){ this.removeClass('hover'); }
            });
        });
    }
});
function processMenuEffects (){
    var basepath = '/';
    var myMenus = new menuEffects('#myajaxmenu', {
        subElement: true,
        dropWidth: '122px'
    });

    var menu_roll = new Asset.image(basepath + 'assets/templates/els/images/menu_roll.png');

    /*$('logo').addEvents({
        'mouseenter': function(){
            this.src = basepath + 'assets/images/logos/logo_roll.png';
        },
        'mouseleave': function(){
            this.src = basepath + 'assets/images/logos/swish-eastlancs.png';
        }
    });*/
}
document.addEvent('domready', processMenuEffects);
