var timerDelay = 1;
var movementSpeed = 8;
var maxLeft = 3;
var minLeft = -148;
var curPosition = minLeft;
var isClosed = true;
var isProcessing = false;
var stepWidth = 201;

function step_slide() {
	if(isClosed){
		menu = document.getElementById('step');
		if (curPosition < maxLeft){
			curPosition += movementSpeed;
			var innerStep = document.getElementById('stepInner');
			innerStep.style.width = (curPosition - maxLeft + stepWidth)+'px';
			setTimeout("step_slide()", timerDelay);
		} else {
			document.getElementById('step_content_0').style.display = 'none';
			document.getElementById('step_content_1').style.display = 'block';
			isClosed = false;
			curPosition = maxLeft
			isProcessing = false;
		}
	}else{
		menu = document.getElementById('step');
		if (curPosition > minLeft){
			curPosition -= movementSpeed;
			//menu.style.left = curPosition + 'px';
			var innerStep = document.getElementById('stepInner');			
			innerStep.style.width = (curPosition - maxLeft + stepWidth)+'px';
			setTimeout("step_slide()", timerDelay);
		}else{
			document.getElementById('step_content_0').style.display = 'block';
			document.getElementById('step_content_1').style.display = 'none';
			isClosed = true;
			curPosition = minLeft;
			isProcessing = false;
		}
	}
}

function doMovement(){
	if (!isProcessing){
		isProcessing = true;
		if(!isClosed){
			document.getElementById('step_content_0').style.display = 'block';
			document.getElementById('step_content_1').style.display = 'none';
		}
		step_slide();
	}
}
function makeItOpened(){
	menu = document.getElementById('step');
	document.getElementById('step_content_0').style.display = 'none';
	document.getElementById('step_content_1').style.display = 'block';
	isClosed = false;
	curPosition = maxLeft;
	isProcessing = false;
	var innerStep = document.getElementById('stepInner');	
	innerStep.style.width = (curPosition - maxLeft + stepWidth)+'px';
}
