/* Slidemenu */
var isExtended = 0;
// var height = 300;
var width = 187;
var slideDuration = 500;
//var opacityDuration = 1000;

function extendContract(){
	if(isExtended == 0){
		sideBarSlide(0, width);
		//sideBarOpacity(0, 1);
		isExtended = 1;
		// make expand tab arrow image face left (inwards)
		$('sideBarTab').childNodes[0].src = $('sideBarTab').childNodes[0].src.replace(/(\.[^.]+)$/, '-active$1');
	}
	else{
		sideBarSlide(width, 0);
		//sideBarOpacity(1, 0);
		isExtended = 0;
		// make expand tab arrow image face right (outwards)
		$('sideBarTab').childNodes[0].src = $('sideBarTab').childNodes[0].src.replace(/-active(\.[^.]+)$/, '$1');
	}
}
function sideBarSlide(fromWidth, toWidth){
		var myEffects = new Fx.Styles('sideBarContents', {duration: slideDuration, transition: Fx.Transitions.linear});
		myEffects.custom({
			 // 'height': [fromHeight, toHeight],
			 'width': [fromWidth, toWidth]
		});
}
function init(){
	$('sideBarTab').addEvent('click', function(){extendContract()});
	$('sideBarTab').addEvent('click', function(e){
    e = new Event(e);
    e.stop();
    });
}
window.addEvent('domready', function(){init()});