/**
 * Light Menu System v0.1
 * @author Jonathan Schemoul
 * @copyright 2006-2007 Holdiland
 * @license GPL V2 or newer
 */
 
// Requires Mootools!
 
function preloadImages() {
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
 
var navMenuEffects = new Class({
        initialize: function(selector, options) {
                this.options = Object.extend({
                        subElement: false,
                        subElementSelector: 'a'
                }, options || {})
                this.selector = selector;
                this.currTimer = 500;
                $ES(selector + ' li ul').each(function(el) {
                        el.setStyles({
                                'display': 'block'
                        });
                        normalHeight = el.offsetHeight;
                        el.setStyles({
                                'height': 0,
                                'overflow': 'hidden'
                        });
                        elParent = $(el.parentNode);
                        
                        currentMenu = new Fx.Style(el, 'height');
                        elParent.addEvents({
                                'mouseover': function(submenu, myParent, targetValue) {
                                        myParent.addClass('hover');
                                        submenu.clearTimer();
                                        submenu.custom(targetValue);
                                }.pass([currentMenu, elParent, normalHeight]),
                                'mouseout': function(submenu, myParent, targetValue) {
                                        myParent.removeClass('hover');
                                        submenu.clearTimer();
                                        submenu.custom(targetValue);
                                }.pass([currentMenu, elParent, 0])
                        })
                }.bind(this));
        }
});
function navProcessMenuEffects (){
        var navMenus = new navMenuEffects('#menu_0', {
                subElement: true
        });
		var storeMenus = new navMenuEffects('#menu_1', {
                subElement: true
        });
}
window.onDomReady(navProcessMenuEffects);
