/**
 * expverticalmenu - MooTools script for collapsing split menus
 * 
 * @version		1.0
 * @copyright	gnu/gpl
*/

 var Expverticalmenu=new Class({'options':{'menuClass':'ul.menu'},initialize:function(options){this.setOptions(options);this.menus=$$(this.options.menuClass);this.elements=[];this.menus.each(function(menu){var parent=menu.getChildren().filter(function(el){return el.hasClass('parent')});if(parent.length)this.elements.push(parent)},this);this.htmlize()},htmlize:function(){var self=this;this.elements.each(function(menu){menu.each(function(element){var ul=element.getElement('ul');var span=element.getFirst('a').getFirst('span');if(span)span.setStyle('background','none');var slide=new Fx.Slide(ul)[element.hasClass('active')?'show':'hide']();var div=new Element('div',{'class':element.hasClass('active')?'split-arrow-open':'split-arrow-close'}).inject(element.setStyle('position','relative'),'top');div.addEvent('click',self.toggle.bindWithEvent(self,[slide,div]))})})},toggle:function(event,slide,arrow){slide.toggle();if(!!!slide.open)arrow.removeClass('split-arrow-close').addClass('split-arrow-open');else arrow.removeClass('split-arrow-open').addClass('split-arrow-close')}});Expverticalmenu.implement(new Options); 