var isExtended = 0;
var isExtendedLeft = 0;

function slideSideBar(){

	new Effect.toggle('sideBarContents', 'blind', {scaleX: 'true', scaleY: 'true;', scaleContent: false});

	if(isExtended==0){
		$('sideBarTab').childNodes[0].src = $('sideBarTab').childNodes[0].src.replace(/(\.[^.]+)$/, '-active$1');
		new Effect.Fade('sideBarContents',
   	{ duration:1.0, from:0.0, to:1.0 });
		
		isExtended++;
	}
	else{
		$('sideBarTab').childNodes[0].src = $('sideBarTab').childNodes[0].src.replace(/-active(\.[^.]+)$/, '$1');
		
		new Effect.Fade('sideBarContents',
   	{ duration:1.0, from:1.0, to:0.0 });
		
		isExtended=0;
	}
	
}

function slideSideBarL(){

	new Effect.toggle('sideBarContentsL', 'blind', {scaleX: 'true', scaleY: 'true;', scaleContent: false});
	
	if(isExtendedLeft==0){
		$('sideBarTabL').childNodes[0].src = $('sideBarTabL').childNodes[0].src.replace(/(\.[^.]+)$/, '-active$1');
		
		new Effect.Fade('sideBarContentsL',
   	{ duration:1.0, from:0.0, to:1.0 });
		
		isExtendedLeft++;
	}
	else{
		$('sideBarTabL').childNodes[0].src = $('sideBarTabL').childNodes[0].src.replace(/-active(\.[^.]+)$/, '$1');
		
		new Effect.Fade('sideBarContentsL',
   	{ duration:1.0, from:1.0, to:0.0 });
		
		isExtendedLeft=0;
	}
	
}

function init(){
	Event.observe('sideBarTabL', 'click', slideSideBarL, true);
	Event.observe('sideBarTab', 'click', slideSideBar, true);
}

Event.observe(window, 'load', init, true);