var toggleButtons = {
		
		'fun__showButton' : function (element, bodyId)
		{
			Element.removeClassName(element, 'hideMe');
			
			if ($(bodyId).hasClassName('hideMe'))
			{
				Element.addClassName(element, 'toggleDown');
			}
			else
			{
				Element.addClassName(element, 'toggleUp');
			}
		},
		
		'fun__toggleButton' : function (element, bodyId)
		{
			var box = $(bodyId);
			var bodyVisible = false;
			if (box.toggling == true)
			{
				return;
			}
			box.toggling = true;

			if (box.hasClassName('hideMe'))
			{
				Effect.BlindDown(box,
					{ 
						beforeStart:function() 
						{ box.style.display = 'none'; Element.removeClassName(box, 'hideMe'); },
						afterFinish:function() 
						{ box.toggling=false; },
						duration:0.4 
					});
				Element.removeClassName(element, 'toggleDown');
				Element.addClassName(element, 'toggleUp');
				bodyVisible = true;
			}
			else
			{
				Effect.BlindUp(box,{ afterFinish:function() { box.toggling=false; Element.addClassName(box, 'hideMe'); }, duration:0.4 });
				Element.removeClassName(element, 'toggleUp');
				Element.addClassName(element, 'toggleDown');
			}
				
			new Ajax.Request('/ajax/toggle.php', {method:'post', postBody:'toggleId=' + bodyId + '&toggleValue='+bodyVisible });
			return false;		
		},
	
	
		'#navigationNavigationHead a' : function(element)
		{
			this.fun__showButton(element, 'navigationNavigationDiv');

			element.onclick = this.fun__toggleButton.bind(this, element, 'navigationNavigationDiv');

		},
		
		'#navigationMyHead a' : function(element)
		{
			this.fun__showButton(element, 'navigationMyDiv');
			
			element.onclick = this.fun__toggleButton.bind(this, element, 'navigationMyDiv');
			{
			}
		},
		
		'#navigationOnlineStatsHead a' : function(element)
		{
			this.fun__showButton(element, 'onlineStatsDiv');
			
			element.onclick = this.fun__toggleButton.bind(this, element, 'onlineStatsDiv');
		}
	};
	
Behaviour.register(toggleButtons);