window.addEvent('domready', function() {

var activeelement;

		//create our Accordion instance
	var myAccordion = new Accordion($('menurx'), 'h3.toggler', 'div.element', {
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#41464D');
			
			activeelement = element.id;

			if($('tree_container')){
				$('tree_container').innerHTML="";
			}

		},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#528CE0');
		},
		onComplete:function(toggler, element){
		
			if(activeelement=='srctree'){
				opentree();
			}
		
		}
	});

	if($('menubt')){
	
		$('container2b').setStyle('margin-left', '0px');
		$('container3').setStyle('margin-left', '0px');
		$('menurx').setStyle('margin-right', '-320px');
			
		$('menubt').addEvent('click', function(e){ e.stop();


		if($('container3').getStyle('margin-left')!='0px'){
			$('container2b').tween('margin-left', [-320, 0]);
			$('container3').tween('margin-left', [320, 0]);
			$('menurx').tween('margin-right', [0, -300]);
		}else{
			$('container2b').tween('margin-left', [0,-320]);
			$('container3').tween('margin-left', [0,320]);
			$('menurx').tween('margin-right', [-300,0]);
		}
	
	});
	}
	
	Element.implement({
		//implement show
		
		show: function() {
			//this.setStyle('display','');
			 this.set('tween', {duration: 0});
			 this.tween('opacity',1);
		},
		//implement hide
		hide: function() {
			//this.setStyle('display','none');
			  this.set('tween', {duration: 0});
			  this.tween('opacity',0);
		},
		
		fancyShow: function() {
			this.set('tween', {duration: 500});
			 this.tween('opacity',1);			
			//this.fade('in');
		},
		//implement hide
		fancyHide: function() {
			
			  //this.fade('out');
			 this.set('tween', {duration: 500});
			 this.tween('opacity',0);
		}
		
	});


});
