var isExtended = 0;
var height = 450;
var width = 600;
var slideDuration = 1000;
var opacityDuration = 1500;

function extendContract(){
	if(isExtended == 0){
		sideBarSlide(0, height, 1, width);
		sideBarOpacity(0, 1);
		isExtended = 1;
		
		$('sideBarTab').childNodes[0].src = $('sideBarTab').childNodes[0].src.replace(/(\.[^.]+)$/, '-active$1');
	}
	else{
		sideBarSlide(height, 0, width, 1);
		sideBarOpacity(1, 0);
		isExtended = 0;
		
		$('sideBarTab').childNodes[0].src = $('sideBarTab').childNodes[0].src.replace(/-active(\.[^.]+)$/, '$1');
	}
}
function sideBarSlide(fromHeight, toHeight, fromWidth, toWidth){
		var morph = new Fx.Morph('sideBarContents');
		morph.start({
			'height': [fromHeight, toHeight],
			'width': [fromWidth, toWidth]
		});
		
}

function sideBarOpacity(from, to){
		var morph = new Fx.Morph('sideBarContents');
		morph.start({
			'opacity': [from, to]
		});
		
}

function init(){
	$('sideBarTab').addEvent('click', function(){extendContract()});
}

window.addEvent('load', function(){init()});