var treeCordian;var TreeCordian=new Class({initialize:function(what){this.what=$(what);this.slides=[];$$('#'+what+' ul li.parent a').each(function(link){this.setUpLink(link);}.bind(this))},addArrows:function(list){var topArrow=new Element('li',{html:'<a href="#" class="treemore tup">MORE</a>',styles:{padding:'3px','text-align':'center',display:'none'}});var botArrow=new Element('li',{html:'<a href="#" class="treemore tdown">MORE</a>',styles:{padding:'3px','text-align':'center',display:'none'}});topArrow.addClass('disabled');topArrow.setOpacity(0);botArrow.setOpacity(0);topArrow.set('morph',{duration:'short'});botArrow.set('morph',{duration:'short'});list.set('next',6);list.set('prev',0);topArrow.addEvent('click',function(list){botArrow.removeClass('disabled');var scrollTo=list.getChildren()[list.get('prev')];if(scrollTo){var myFx=new Fx.Scroll(list).toElement(scrollTo);list.set('next',list.get('next').toInt()-5);list.set('prev',list.get('next').toInt()-14);}
if(list.get('prev').toInt()<=0){list.set('prev',0);list.set('next',6);}}.bind(this).pass(list));botArrow.addEvent('click',function(list,arrow){topArrow.removeClass('disabled');var scrollTo=list.getChildren()[list.get('next')];if(scrollTo){var myFx=new Fx.Scroll(list).toElement(scrollTo);list.set('next',list.get('next').toInt()+5);list.set('prev',list.get('next').toInt()-9);}else{botArrow.addClass('disabled');}
if(list.get('next').toInt()>=(list.getChildren().length-1).toInt()){list.set('prev',((list.getChildren().length/2)-2).toInt());list.set('next',list.getChildren().length-1);botArrow.addClass('disabled');}}.bind(this).pass(list,botArrow));list.setStyle('height',186);list.setStyle('overflow','hidden');list.set('scrollable',true);topArrow.inject(list.getParent(),'top');botArrow.inject(list.getParent(),'bottom');},setUpLink:function(link){var list=$(link.getParent().getNext().getChildren()[0]);var max=11;if(list.getChildren().length>max){this.addArrows(list);}
list.ani=new Fx.Slide(list,{duration:650,transition:Fx.Transitions.Quad.easeOut,link:'cancel',onComplete:function(){var se=list.getParent().getParent().getPrevious();if(this.open){se.addClass('active');if(list.getChildren().length>max){se.getNext().getFirst().morph({opacity:1,display:'block'});se.getNext().getLast().morph({opacity:1,display:'block'});}}else{se.removeClass('active');if(list.getChildren().length>max){se.getNext().getFirst().morph({opacity:0,display:'none'});se.getNext().getLast().morph({opacity:0,display:'none'});}}}});list.ani.hide();this.slides.push(list.ani);link.addEvent('click',function(e){e.stop();this.slides.each(function(slide){slide.slideOut();});this.toggleLinks(link,list);}.bind(this));},expand:function(slide){slide.toggle();this.slides.each(function(slide){slide.slideOut();});},toggleLinks:function(lnk,a){var t=lnk.getParent();$$('#subNav li.parent').each(function(e){if(e!=t){e.removeClass('active');}});a.ani.toggle('vertical');}});