(function(e){var t=[],n=[],r=activeItem=null,i=e('
')[0],s=e('')[0],o=e('')[0],u=e('')[0],a=e(''),f={showDelay:200,hideDelay:200,hoverOpenDelay:0,offsetTop:0,offsetLeft:0,minWidth:0,onOpen:null,onClose:null,onClick:null,arrowSrc:null,addExpando:false,copyClassAttr:false};e(function(){a.appendTo("body")});e.extend({MenuCollection:function(e){this.menus=[];this.init(e)}});e.extend(e.MenuCollection,{prototype:{init:function(e){if(e&&e.length){for(var t=0;t-1){if(--o<0)o=u.length-1;e.Menu.closeAll();u[o].show();u[o].setActive();if(u[o].menuItems.length)u[o].menuItems[0].hoverIn(true)}}break;case 38:if(r)r.selectNextItem(-1);break;case 39:if(!r)r=n[0];var a,i=r,f=activeItem?activeItem.subMenu:null;if(i){if(f&&f.menuItems.length){f.show();f.menuItems[0].hoverIn()}else if(i=i.inMenuCollection()){var o,u=i.menuCollection.menus;if((o=e.inArray(i,u))>-1){if(++o>=u.length)o=0;e.Menu.closeAll();u[o].show();u[o].setActive();if(u[o].menuItems.length)u[o].menuItems[0].hoverIn(true)}}}break;case 40:if(!r){if(n.length&&n[0].menuItems.length)n[0].menuItems[0].hoverIn()}else r.selectNextItem();break}if(t.keyCode>36&&t.keyCode<41)return false},closeAll:function(){while(n.length)n[0].hide()},setDefaults:function(t){e.extend(f,t)},prototype:{init:function(){var n=this;if(!this.target)return;else if(this.target instanceof e.MenuItem){this.parentMenuItem=this.target;this.target.addSubMenu(this);this.target=this.target.$eLI}t.push(this);this.$eDIV=e(i.cloneNode(1));this.$eUL=e(s.cloneNode(1));this.$eDIV[0].appendChild(this.$eUL[0]);a[0].appendChild(this.$eDIV[0]);if(!this.parentMenuItem){e(this.target).click(function(e){n.onClick(e)}).hover(function(e){n.setActive();if(n.settings.hoverOpenDelay){n.openTimer=setTimeout(function(){if(!n.visible)n.onClick(e)},n.settings.hoverOpenDelay)}},function(){if(!n.visible)e(this).removeClass("activetarget");if(n.openTimer)clearTimeout(n.openTimer)})}else{this.$eDIV.hover(function(){n.setActive()},function(){})}},setActive:function(){if(!this.parentMenuItem)e(this.target).addClass("activetarget");else this.active=true},addItem:function(t){if(t instanceof e.MenuItem){if(e.inArray(t,this.menuItems)==-1){this.$eUL.append(t.$eLI);this.menuItems.push(t);t.parentMenu=this;if(t.subMenu)this.subMenus.push(t.subMenu)}}else{this.addItem(new e.MenuItem(t,this.settings))}},addItems:function(e){for(var t=0;t-1)this.menuItems.splice(n,1);t.parentMenu=null},hide:function(){if(!this.visible)return;var t,i=e.inArray(this,n);this.$eDIV.hide();if(i>=0)n.splice(i,1);this.visible=this.active=false;e(this.target).removeClass("activetarget");for(t=0;t=r)n=0;else if(n<0)n=r-1}while(this.menuItems[n].separator);this.menuItems[n].hoverIn(true)},inMenuCollection:function(){var e=this;while(e.parentMenuItem)e=e.parentMenuItem.parentMenu;return e.menuCollection?e:null},destroy:function(){var n,r;this.hide();if(!this.parentMenuItem)e(this.target).unbind("click").unbind("mouseover").unbind("mouseout");else this.$eDIV.unbind("mouseover").unbind("mouseout");while(this.menuItems.length){r=this.menuItems[0];r.destroy();delete r}if((n=e.inArray(this,t))>-1)t.splice(n,1);if(this.menuCollection){if((n=e.inArray(this,this.menuCollection.menus))>-1)this.menuCollection.menus.splice(n,1)}this.$eDIV.remove()}}});e.extend({MenuItem:function(t,n){if(typeof t=="string")t={src:t};this.src=t.src||"";this.url=t.url||null;this.urlTarget=t.target||null;this.addClass=t.addClass||null;this.data=t.data||null;this.$eLI=null;this.parentMenu=null;this.subMenu=null;this.settings=e.extend({},f,n);this.active=false;this.enabled=true;this.separator=false;this.init();if(t.subMenu)new e.Menu(this,t.subMenu,n)}});e.extend(e.MenuItem,{prototype:{init:function(){var t,n,r=this.src,i=this;this.$eLI=e(o.cloneNode(1));if(this.addClass)this.$eLI[0].setAttribute("class",this.addClass);if(this.settings.addExpando&&this.data)this.$eLI[0].menuData=this.data;if(r==""){this.$eLI.addClass("menu-separator");this.separator=true}else{n=typeof r=="string";if(n&&this.url)r=e('"+r+"");else if(n||!r.length)r=[r];for(t=0;t