var NavigationMenu=Class.create({initialize:function(A){if(!$(A)){throw ("Attempted to initalize NavigationMenu with id: "+A+" which was not found.")}typeof A=="string"?this.menu=$(A):this.menu=A;this.animated=true;this.animationSpeed="0.3";this.closedIcon="/static/img/ico_section_closed.gif";this.openIcon="/static/img/ico_section_open.gif";if(this.animated==true&&typeof Effect=="undefined"){throw ("dashboard-pane.js requires including script.aculo.us' effects.js library!")}this.togglers=this._getTogglers();this.submenus=this._getSubmenus();Event.observe(this.menu,"click",this._clickController.bindAsEventListener(this));this._initTogglers();this.initMenu();log("----- NavigationMenu constructor finished for: #"+A+" -----")},_getTogglers:function(){var A=new Array();var B="#"+this.menu.id+" li ul";$$(B).each(function(D,C){A[C]=D.up("li").down("a")});return A},_getSubmenus:function(){var A="#"+this.menu.id+" li ul";return $$(A)},_clickController:function(A){eventEl=Event.element(A);if(eventEl.tagName.toLowerCase()=="a"){if(eventEl.next()&&eventEl.next().tagName.toLowerCase()=="ul"){A.stop();var B=eventEl.next();this.toggle(B)}}},_initTogglers:function(){this.togglers.each(function(B){B.setStyle({cursor:"pointer"});var A=B.up("li").down("ul");this.toggleIcon(B,true)}.bind(this))},closeMenu:function(A){if(this.animated){if(A.visible()){Effect.BlindUp(A,{duration:this.animationSpeed,afterUpdate:this.toggleIcon(A.up("li").down("a"),false)})}}else{A.hide();this.toggleIcon(A.up("li").down("a"),false)}},openMenu:function(A){if(this.animated){Effect.BlindDown(A,{duration:this.animationSpeed,afterUpdate:this.toggleIcon(A.up("li").down("a"),true)});A.show()}else{A.show();this.toggleIcon(A.up("li").down("a"),true)}},showMenu:function(A){A.show();this.toggleIcon(A.up("li").down("a"),true)},hideMenu:function(A){A.hide();this.toggleIcon(A.up("li").down("a"),false)},closeAll:function(){this.submenus.each(function(A){this.closeMenu(A)}.bind(this))},closeAllExceptActive:function(){this.submenus.each(function(A){if(!A.down("li.active")){this.closeMenu(A)}}.bind(this))},openAll:function(){this.submenus.each(function(A){this.openMenu(A)}.bind(this))},toggle:function(A){if(this.animated){if(A.style.display=="none"){Effect.BlindDown(A,{duration:this.animationSpeed,afterUpdate:this.toggleIcon(A.up("li").down("a"),true)})}else{Effect.BlindUp(A,{duration:this.animationSpeed,afterUpdate:this.toggleIcon(A.up("li").down("a"),false)})}}else{A.toggle();this.toggleIcon(A.up("li").down("a"),A.visible())}},toggleIcon:function(B,A){if(A){B.setStyle({background:'url("'+this.openIcon+'") no-repeat 95% center'})}else{B.setStyle({background:'url("'+this.closedIcon+'") no-repeat 95% center'})}},initMenu:function(){this.closeAllExceptActive()}});
