if( typeof window.menu == 'undefined' )
    window.menu = {};

(function()
{
    var _this           = this;
    
    this.attribute      = {submenu:'submenu', submenu_position:'submenu_position', menuitem:'menuitem'};
    this.hideDelay      = 500; // millisec
    this.flashHideMode  = 'wmode'; // visibility, wmode
    this.mmperiod       = 5; // mintavételezés periódusa
    this._hideAllTimeout= null;
    
    
    this._browser       = getBrowser();
    this._currentItem   = null; // az az elem amelyik fölött van aktuálisan az egér
    this._currentCont   = null; // az a container amelyik fölött van aktuálisan az egér
    this._windowLoaded  = false;
    this._flashHidden   = false;
    this._mmperiod      = 0;
    this._checkBounds   = ['root'];
    this._displayIframe = false;
    this._bounds        = {
        root            : [],
        container       : [],
        items           : []
    };
    
    this.assign = function(selector, position)
    {
        //if( this._browser.safari ) this.flashHideMode = 'visibility';
        if( this._browser.op ) this._displayIframe = true;
        //if( this._browser.ie ) this._displayIframe = true;
        
        if( !_this._windowLoaded )
            addEvent(window, 'load', null, function(ev){ var e = ev || window.event; _this._handler('window_load', e, {selector:selector, position:position}); });
        else
            this._handler('window_load', null, {selector:selector, position:position});
    };
    
    this.hideFlash = function(hide)
    {
        if( this._flashHidden === hide ) return;
        this._flashHidden = hide;
        
        $('embed, object').each(function(flash)
        {
            switch(this.flashHideMode)
            {
                case 'visibility':
                    flash.style.visibility = hide ? 'hidden' : 'visible';
                break;
            
                case 'wmode':
                    
                    if(flash.nodeName.toLowerCase() == 'embed')
                    {
                        var wmode = flash.getAttribute('wmode');
                        if( hide && (!wmode || wmode.toLowerCase() == 'window') )
                        {
                            flash.setAttribute('wmode', 'transparent');
                            flash._wmodeChanged = true;
                        }
                        else if( !hide && flash._wmodeChanged )
                        {
                            flash.setAttribute('wmode', 'window');
                        }
                        
                        if(flash._wmodeChanged)
                        {
                            if( (nextNode = flash.nextSibling) )
                                flash.parentNode.insertBefore(flash, nextNode);
                            else
                                flash.parentNode.appendChild(flash);
                        }
                    }
                    else
                    {
                        var nwmode = $('param[name=wmode]', flash);
                        var swmode = 'window';
                        if( nwmode.length && nwmode[0].length && nwmode[0][0].nodeType == 1 ) swmode = nwmode[0][0].getAttribute('value');
                        
                        if( hide && swmode.toLowerCase() == 'window' )
                        {
                            nwmode[0][0].setAttribute('value', 'transparent');
                            //dump(nwmode[0][0].getAttribute('value'));
                            flash._wmodeChanged = true;
                            this._displayIframe = true;
                        }
                        else if( !hide )
                            nwmode[0][0].setAttribute('value', 'window');
                    }
                break;
            }
        }, this);
    };
    
    this._parseStruct = function(selector, position, node, menu_item, container)
    {
        $(selector, node || document, true).each(function(node)
        {
            //alert(node);
            var attr = '';
            if( node && node.nodeType == 1 )
                switch(true)
                {
                    //menuitem
                    case !!(attr = node.getAttribute(_this.attribute.submenu)):
                        var mi = _this._createMenuItem(node, container);
                        _this._parseStruct(attr, 'right', node, mi, null);
                    break;
                
                    //menu container
                    case !!(attr = node.getAttribute(_this.attribute.menuitem)):                        
                        var mc = _this._createMenuContainer(node, position, menu_item);                        
                        _this._parseStruct(attr, 'right', node, null, mc);
                    break;
                
                    default:
                        _this._createMenuItem(node, container);
                    break;
                }
        });
    };
    
    this._createMenuItem = function(node, container)
    {
        var mi = new MenuItem(node, container);
        
        if( container instanceof MenuContainer )
            container.itemList.push(mi);
        
        return mi;
    };
    
    this._createMenuContainer = function(node, position, menu_item)
    {
        var mc = new MenuContainer(node, menu_item, {position:position});
        
        if( menu_item instanceof MenuItem )
        {
            menu_item.hasSubMenu = true;
            menu_item.subMenuContainer = mc;
        }
        
        return mc;
    };
    
    this._handlerMouseMove = function(evt)
    {
        if( this._mmperiod != this.mmperiod )
        {
            this._mmperiod++;
            return;
        }
        else
            this._mmperiod = 0;
        var m = {};
        if(window.event)
        {
            m._x  = evt.clientX + getScrollLeft();
            m._y  = evt.clientY + getScrollTop();         	
        }
        else
        {
            m._x  = evt.pageX;
            m._y  = evt.pageY;
        }
        
        for(var z=0, area ; area = this._checkBounds[z] ; z++)
        {
            switch(area)
            {
                case 'root':
                    var enter = null;
                    
                    for(var k=0, bound ; k<this._bounds[area].length ; k++)
                    {
                        var bound = this._bounds[area][k];
                        if( pointInBox(bound, m, bound.offset) )
                        {
                            if( enter )
                                enter.MenuItem.mouseLeave();
                            enter = bound;
                        }
                        else
                            bound.MenuItem.mouseLeave();
                    }
                    
                    if( enter )
                    {
                        this.hideFlash(true);
                        this._checkBounds = ['root', 'container', 'items'];
                        this._currentItem = enter.MenuItem;
                        enter.MenuItem.mouseEnter();                        
                    }
                    else
                        this._currentItem = null;
                break;
            
                case 'items':
                    var start = this._bounds.root.length;
                case 'container':
                    if( typeof start == 'undefined' ) start = 0;                        
                    var enter = null;
                    var obj = (area == 'items' ? 'MenuItem' : 'MenuContainer');
                    
                    for(var j=0 ; j<this._bounds[area].length ; j++)
                    {
                        if( !this._bounds[area][j] ) continue;
                        
                        for(var i=start, bound ; i<this._bounds[area][j].length ; i++)
                        {
                            bound = this._bounds[area][j][i];
                            if( !bound[obj].visible ) continue;
                            
                            if( pointInBox(bound, m, bound.offset) && !(area == 'items' && this._currentCont && this._currentCont !== bound[obj].MenuContainer && boxIntercept(this._currentCont.getBound(), bound)) )
                            {
                                if( enter )
                                    enter[obj].mouseLeave();
                                enter = bound;                                        
                            }
                            else
                                bound[obj].mouseLeave();
                        }
                    }
                    
                    if( enter )
                    {
                        if( area == 'container' )
                        {
                            if( enter[obj].parentMenuItem.visible )
                                enter[obj].mouseEnter();
                            this._currentCont = enter[obj];
                        }
                        else if( area == 'items' )
                        {
                            if( enter[obj].MenuContainer.visible )
                                enter[obj].mouseEnter();
                            this._currentItem = enter[obj];
                        }
                    }
                    else
                    {
                        if( area == 'container' )   this._currentCont = null;
                        if( area == 'items' )       this._currentItem = null;
                    }                          
                    
                break;
            }
        }
        
        if( this._hideAllTimeout && (this._currentCont !== null || this._currentItem !== null))
        {
            clearTimeout(this._hideAllTimeout);
            this._hideAllTimeout = null;
        }
    };
    
    this._handler = function(name, evt, param)
    {
        switch(name)
        {
            case 'document_click':
                this._hideAll();
            break;
        
            case 'window_resize':
                //dump('window_resize');
                // a root boundokat újraolvasni
            break;
        
            case 'window_load':
                this._parseStruct(param.selector);
                //dump(this._bounds);
            break;
        }
    };
    
    this._hideAll = function()
    {
        if( this._currentCont === null && this._currentItem === null )
        {
            for(var k=0, bound ; bound = this._bounds.root[k] ; k++)
            {
                if( !bound.MenuItem.hasSubMenu ) continue;
                bound.MenuItem.subMenuContainer.hide(true);
                bound.MenuItem.subMenuContainer.hideAllSub();
            }
            this.hideFlash(false);
            this._checkBounds = ['root'];
        }
    };
    
    /**************************************************************
     * MenuContainer
     **************************************************************/
    function MenuContainer(node, mi, prop)
    {
        this.node               = node;
        this.parentMenuItem     = mi;
        this.prop               = prop || {};
        this.visible            = false;
        this.alloweHide         = true;
        this.boundIndex         = null;
        this.itemList           = [];
        this.IFrameId           = null;
        
        this._isMouseOver       = false;
        
        var pos = '';
        if( mi && mi.node && !!(pos = mi.node.getAttribute(_this.attribute.submenu_position)) )
            this.prop.position = pos;
            
        if( this.prop.position )
        {
            var regex = /^(top|right|bottom|left|relative)\s*(top|right|bottom|left|middle|center|(?:\#[\w\-_\.]*?))?\s*(-?\d+)?\s*(-?\d+)?\s*$/ig;
            regex.lastIndex = 0;
            var result = regex.exec(this.prop.position.toLowerCase());
            var pos = {};
            pos.primary     = result[1] ? result[1] : 'bottom';
            pos.secondary   = result[2] ? result[2] : (pos.primary == 'top' || pos.primary == 'bottom' ? 'left' : 'top');
            pos.offset_1    = result[3] ? parseInt(result[3], 10) : 0;
            pos.offset_2    = result[4] ? parseInt(result[4], 10) : 0;
            this.prop.position = pos;
            
            //alert(pos.primary+' '+pos.secondary);
        }
    };
    
    MenuContainer.prototype =
    {
        display: function()
        {
            if( this.visible || !this.node ) return;
            this.visible = true;
            
            this.node.style.visibility = 'hidden';
            this.node.style.display = 'block';
            this.node.style.zIndex = '100001';
            $('body').appendChild(this.node);
            
            var position = this._calcPosition(this.node);
            if( !position ) return;
            
            this.node.style.position = 'absolute';
            this.node.style.left = position.left+'px';
            this.node.style.top = position.top+'px';
            this.node.style.visibility = 'visible';
            
            var b = this.setBound();
            b.offset = position.offset;
            this.setBound(b);
            
            if( _this._displayIframe || (_this._browser.ie && _this._browser.ver <= 6) ) this.displayIFrame(true);                
            
            for(var k=0 ; k<this.itemList.length ; k++)
            {
                this.itemList[k].setBound();
                this.itemList[k].visible = true;
            }
            
            var evt_ondisplay = this.node.getAttribute('ondisplay');
            if( evt_ondisplay )
                new Function(evt_ondisplay).call(this.node);
            
            //this.displayBound();          
        },
        
        displayIFrame: function(visible)
        {
            if( !this.IFrameId ) this.IFrameId = 'menu-container-iframe-'+Math.ceil(Math.random()*10000);
            var iframe = null;
            if( !(iframe = document.getElementById(this.IFrameId)) )
            {
                iframe = document.createElement('iframe');
                iframe.setAttribute('id', this.IFrameId);
                iframe.setAttribute('src', 'about:blank');
                iframe.setAttribute('border', '0');
                iframe.style.border = "0px solid #FFFFFF";
                iframe.style.backgroundColor = '#000000';
                iframe.style.position = 'absolute';
                iframe.style.zIndex = '100000';
                //iframe.style.opacity = '0.01';
                //iframe.style.filter = 'alpha(opacity=1)';
            }
            if(visible)
            {
                var b = this.getBound();
                iframe.style.width      = b.width + 'px';
                iframe.style.height     = b.height + 'px';
                iframe.style.left       = b._x + 'px';
                iframe.style.top        = b._y + 'px';
                iframe.style.display    = 'block'; 
                this.node.parentNode.insertBefore(iframe, this.node);
            }
            else
                iframe.style.display = 'none'; 
            
        },
        
        hide: function(force, exclude)
        {
            if(typeof force == 'undefined')
                force = false;
            
            if( (!this.visible || !this.alloweHide) && !force ) return;
            this.visible = false;            
            this.node.style.display = 'none';
            if( _this._displayIframe || (_this._browser.ie && _this._browser.ver <= 6) ) this.displayIFrame(false);
            
            for(var i=0, item ; item = this.itemList[i] ; i++)
                item.visible = false;
        },
        
        hideAllSub: function(exclude)
        {
            for(var i=0, item ; item = this.itemList[i] ; i++)
            {
                if( exclude && item === exclude ) continue;
                if( !item.subMenuContainer || !item.subMenuContainer.visible ) continue;
                item.subMenuContainer.hide(true);
                item.subMenuContainer.hideAllSub();
            }
        },
        
        mouseEnter: function()
        {
            if( this._isMouseOver ) return;
            this._isMouseOver = true;
            
            if( this.parentMenuItem.MenuContainer )
                this.parentMenuItem.MenuContainer.alloweHide = false;
                
            //dump(this.node.id, 'container enter');
        },
        
        mouseLeave: function()
        {
            if( !this._isMouseOver ) return;
            this._isMouseOver = false;
            
            if( this.parentMenuItem.MenuContainer )
                this.parentMenuItem.MenuContainer.alloweHide = true;
            
            setTimeout(function()
            {
                if( _this._currentCont === null && _this._currentItem === null )
                    _this._hideAllTimeout = setTimeout(function(){ _this._hideAll() }, _this.hideDelay);  
            }
            , 50);
            
            //dump(this.node.id, 'container leave');
        },
        
        getBound: function()
        {
            if( this.boundIndex === null || !this.parentMenuItem ) return null;
            var parentIndex = this.parentMenuItem.boundIndex;
            
            return menu._bounds.container[parentIndex][this.boundIndex];
        },
        
        setBound: function(b)
        {
            if( this.parentMenuItem )
            {
                var parentIndex = this.parentMenuItem.boundIndex;
                
                if( typeof menu._bounds.container[parentIndex] == 'undefined' )
                    menu._bounds.container[parentIndex] = [];
                
                if( this.boundIndex === null )
                    this.boundIndex = menu._bounds.container[parentIndex].length;
                menu._bounds.container[parentIndex][this.boundIndex] = b || getBounds(this.node);
                menu._bounds.container[parentIndex][this.boundIndex].MenuContainer = this;
                //this.displayBound(); 
                return menu._bounds.container[parentIndex][this.boundIndex];
            }
            return null;
        },
        
        displayBound: function()
        {
            if( !this.bid ) this.bid = 'xyxyxy-'+Math.ceil(Math.random()*10000);
            var node = null;
            if( !(node = $('#'+this.bid)) )
            {
                node = document.createElement('div');
                node.setAttribute('id', this.bid);
                node.style.backgroundColor = '#81cbf0';
                node.style.backgroundColor = '#cc3300';
                node.style.position = 'absolute';
                node.style.opacity = '0.5';
                node.style.filter = 'alpha(opacity=50)';
                node.style.fontSize = '12px';
                node.innerHTML = this.node.id;
                node.style.zIndex = '100002';
            }
            
            var bo = this.getBound();
            var x = ['_x', '_y', 'width', 'height'];
            var c = ['left', 'top', 'width', 'height']
            var b = {};
            for( var i=0, t ; t=x[i] ; i++ )
                b[t] = bo[t];
            
            if(bo.offset)
                for(k in bo.offset)
                    b[k] += bo.offset[k];
            
            for( var i=0, t ; t=c[i] ; i++ )
                node.style[t] = b[x[i]]+'px';
                
            $('body').appendChild(node);
            
        },
        
        /**
         * pozíció definiálása:
         *          - relatív számítva a megjelenítő menüelemtől
         *          - formátuma: [elsődleges pozíció] [másodlagos pozíció] [offset 1] [offset 2]
         *                      - elsődleges pozíció: ez dönti el, hogy az almenü a menüleme melyik oldalán jelenjen meg (top, right, bottom, left) vagy hogy relatív legyen egy nodehoz képest (relative)
         *                      - másodlagos pozíció: ez dönti el hogy a menüpont oldalához viszonyítva hol helyezkedjen el ([top, bottom]: (left/center/right), [left, right]: (top/middle/bottom))
         *                                            ha az elsődlegesnek relative volt megadva akkor ide egy id-t kell írni így: #relative-node
         *                      - offset 1/2: az elsődleges/másodlagos pozíció eltolása pl.: top left 10 10 így 10 px-el magasabbra kerül a menüpont és 10px-el beljebb a bal oldaltól
         *                                    ha relative volt megadva akkor az x,y eltolást lehet itt megadni
         */
        _calcPosition: function(node, prevPos)
        {
            var win_windth  = getWindowWidth();
            var win_height  = getWindowHeight();
            var win_left    = getScrollLeft();
            var win_top     = getScrollTop();
            var bound_sub   = {width: node.offsetWidth, height: node.offsetHeight};
            var bound_menu  = this.parentMenuItem.getBound();
            var offset      = {};
            switch(this.prop.position.primary)
            {
                case 'top':
                    var top = bound_menu._y - bound_sub.height - this.prop.position.offset_1;
                    offset.height = bound_menu.height + this.prop.position.offset_1;
                break;
            
                case 'right':
                    var left = bound_menu._x + bound_menu.width + this.prop.position.offset_1;
                    offset._x = bound_menu._x - left;
                    offset.width = bound_menu.width + this.prop.position.offset_1;
                break;
            
                case 'bottom':
                    var top = bound_menu._y + bound_menu.height + this.prop.position.offset_1;
                    offset._y = bound_menu._y - top;
                    offset.height = bound_menu.height + this.prop.position.offset_1;
                break;
            
                case 'left':
                    var left = bound_menu._x - bound_sub.width - this.prop.position.offset_1;
                    offset.width = bound_menu.width + this.prop.position.offset_1;
                break;
            
                case 'relative':
                    if( this.prop.position.secondary )
                    {
                        var relativeNode = $(this.prop.position.secondary);
                        var relBounds = getBounds(relativeNode);
                        var left = relBounds._x + this.prop.position.offset_1;
                        var top = relBounds._y + this.prop.position.offset_2;
                        
                        offset._x = bound_menu._x - left;
                        offset._y = bound_menu._y - top;
                        offset.width = bound_menu.width;
                        offset.height = bound_menu.height;
                        
                        //offset._x = left;
                        //offset._y = top;                        
                    }
                break;
            }
            
            switch(this.prop.position.secondary)
            {
                case 'top': /*pri: right, left*/
                    var top = bound_menu._y + this.prop.position.offset_2;
                    offset.height = bound_menu.height - bound_sub.height;
                    offset._y = bound_menu._y - top;
                break;
            
                case 'right': /*pri: top, bottom*/
                    var left = bound_menu._x + bound_menu.width - bound_sub.width - this.prop.position.offset_2;
                    offset.width = bound_menu.width - bound_sub.width;
                    offset._x = bound_menu._x - left;
                break;
            
                case 'bottom': /*pri: right, left*/
                    var top = bound_menu._y + bound_menu.height - this.prop.position.offset_2;
                    offset.height = bound_menu.height - bound_sub.height;
                    offset._y = bound_menu._y - top;
                break;
            
                case 'left': /*pri: top, bottom*/
                    var left = bound_menu._x + this.prop.position.offset_2;
                    offset.width = bound_menu.width - bound_sub.width;
                    offset._x = bound_menu._x - left;
                break;
            
                case 'middle': /*pri: right, left*/
                    var top = Math.round(bound_menu.height / 2) + bound_menu._y + this.prop.position.offset_2;
                    offset.height = bound_menu.height - bound_sub.height;
                    offset._y = bound_menu._y - top;
                break;
            
                case 'center': /*pri: top, bottom*/
                    var left = bound_menu._x + (bound_menu.width / 2 - bound_sub.width / 2) + this.prop.position.offset_2;
                    offset.width = bound_menu.width - bound_sub.width;
                    offset._x = bound_menu._x - left;
                break;
            }
            
            if( left < win_left )
            {
                if( this.prop.position.primary == 'left' && prevPos != 'right' )
                    return this._recalcPosition(node, 'right');
                else
                    left = win_left;
            }
            
            if( top < win_top )
            {
                if( this.prop.position.primary == 'top' && prevPos != 'bottom' )
                    return this._recalcPosition(node, 'bottom');
                else
                    top = win_top
            }
            
            if( top + bound_sub.height > win_top + win_height )
            {
                if( this.prop.position.primary == 'bottom' )
                    return this._recalcPosition(node, 'top');
                else
                {
                    top = win_top + win_height - bound_sub.height;
                    if( typeof offset._y == 'number' )
                        offset._y = bound_menu._y - top;
                }
            }
            
            if( left + bound_sub.width > win_left + win_windth )
            {
                if( this.prop.position.primary == 'right' )
                    return this._recalcPosition(node, 'left');
                else
                {
                    left = win_left + win_windth - bound_sub.width;
                    if( typeof offset._x == 'number' )
                        offset._x = bound_menu._x - left;
                }
            }
            
            if( typeof left == 'number' &&  typeof top == 'number' )
                return {left:left, top:top, offset:offset};
            return null;
        },
        
        _recalcPosition: function(node, pos)
        {
            var op = this.prop.position.primary;
            this.prop.position.primary = pos;
            var p = this._calcPosition(node, op);
            //this.prop.position.primary = op;
            return p;
        }
    };
    
    /**************************************************************
     * MenuItem
     **************************************************************/
    function MenuItem(node, mc)
    {
        this.node               = node;
        this.MenuContainer      = mc;
        this.subMenuContainer   = null;
        this.visible            = mc ? false : true;
        this.hasSubMenu         = false;
        this.boundIndex         = null;
        this._isMouseOver       = false;
        this._type              = mc ? 'item' : 'root';
        
        if( !mc )
            this.setBound();
    };
    
    MenuItem.prototype =
    {
        mouseEnter: function()
        {
            if( this._isMouseOver ) return;
            this._isMouseOver = true;
            
            if( this.hasSubMenu && this.subMenuContainer instanceof MenuContainer )
                this.subMenuContainer.display();
                
            if( this._type == 'item' )
            {
                this.MenuContainer.alloweHide = false;
                this.MenuContainer.hideAllSub(this);
                
                var b = this.MenuContainer.getBound();
                b.offset = {};
                this.MenuContainer.setBound(b);
            }
            else
            {
                for(var k=0, bound ; bound = _this._bounds.root[k] ; k++)
                {
                    if( this.boundIndex !== null && this.boundIndex === k ) continue;
                    if( !bound.MenuItem.subMenuContainer ) continue;
                    
                    bound.MenuItem.subMenuContainer.hide(true);
                    bound.MenuItem.subMenuContainer.hideAllSub(this);
                }
            }
            
            //dump(this.node.innerHTML, 'items enter');
        },
        
        mouseLeave: function()
        {
            if( !this._isMouseOver ) return;
            this._isMouseOver = false;
            
            if( this.hasSubMenu && this.subMenuContainer instanceof MenuContainer )
            {
                if( !this.subMenuContainer._isMouseOver )
                {
                    this.subMenuContainer.hide();
                    this.subMenuContainer.hideAllSub();
                }
                
            }
            
            //dump(this.node.innerHTML, 'items leave');
        },
        
        getBound: function()
        {
            if( this.boundIndex === null ) return null;
            
            if( this.MenuContainer )
            {
                var parentIndex = this.MenuContainer.boundIndex;
                return menu._bounds.items[parentIndex][this.boundIndex];
            }
            else
            {
                return menu._bounds.root[this.boundIndex];
            }
        },
        
        setBound: function(b)
        {
            if( this.MenuContainer )
            {
                var parentIndex = this.MenuContainer.boundIndex;
                var now = false;
                
                if( typeof menu._bounds.items[parentIndex] == 'undefined' )
                {
                    now = true;
                    menu._bounds.items[parentIndex] = [];
                }
                
                if( this.boundIndex === null )
                    this.boundIndex = menu._bounds.items[parentIndex].length + (now ? menu._bounds.root.length : 0);
                
                menu._bounds.items[parentIndex][this.boundIndex] = b || getBounds(this.node);
                menu._bounds.items[parentIndex][this.boundIndex].MenuItem = this;
                
                if( !menu._bounds.items[parentIndex][this.boundIndex].offset )
                    menu._bounds.items[parentIndex][this.boundIndex].offset = {};
            }
            else
            {
                if( this.boundIndex === null )
                    this.boundIndex = menu._bounds.root.length;
                menu._bounds.root[this.boundIndex] = b || getBounds(this.node);
                menu._bounds.root[this.boundIndex].MenuItem = this;
                
                if( !menu._bounds.root[this.boundIndex].offset )
                    menu._bounds.root[this.boundIndex].offset = {};
            }
        }
    };
    
    /**************************************************************
     * Events
     **************************************************************/
    addEvent(document, 'mousemove', null, function(ev){ var e = ev || window.event; _this._handlerMouseMove(e); });
    addEvent(document, 'click', null, function(ev){ var e = ev || window.event; _this._handler('document_click', e); });
    addEvent(window, 'resize', null, function(ev){ var e = ev || window.event; _this._handler('window_resize', e); });
    addEvent(window, 'load', null, function(){ _this._windowLoaded = true; });
})
.call(window.menu);