var pos_block_right=0;
var obj_run;
var max_step=0;
var cur_max_step=0;

function move_go_right(obj,limit_max_step) {
	max_step=limit_max_step;
	cur_max_step--;
	
	if(Math.abs(cur_max_step)<=max_step){
		obj_run=document.getElementById(obj);
		cur_pos_block_right=parseInt(document.getElementById(obj).style.right,10);
		new_pos_block_right=cur_pos_block_right- 90;
		
		
		animate_right(cur_pos_block_right,new_pos_block_right);
		pos_block_right=new_pos_block_right + "px";
	
		//$("#mutag_space_id").animate({right: pos_block_right}, "slow");
		//alert(cur_max_step);
		document.getElementById('got_left').style.display='';
		  if(Math.abs(cur_max_step)==max_step){
			 //alert("Right: " + cur_max_step);	
			 document.getElementById('go_right').style.display='none';
		  }
	}
}

function move_go_left(obj,limit_max_step) {
	max_step=limit_max_step;
	cur_max_step++;
	
	if(cur_max_step<=2){	
		obj_run=document.getElementById(obj);
		cur_pos_block_right=parseInt(document.getElementById(obj).style.right,10);
		new_pos_block_right=cur_pos_block_right+ 90;
		
		animate_left(cur_pos_block_right,new_pos_block_right);
		pos_block_right=new_pos_block_right + "px";
	//$("#mutag_space_id").animate({right: pos_block_right}, "slow");
		//alert(cur_max_step);
		document.getElementById('go_right').style.display='';
	
		  if(cur_max_step==2){
			//alert("Left: " + cur_max_step);	
			document.getElementById('got_left').style.display='none';
		  }
	}
}
///////////////////////////////////////////////////////////
function animate_left(pos,new_pos){
		setTimeout(function(){obj_run.style.right=pos;pos+=10;if(pos<=new_pos){animate_left(pos,new_pos);}},1);
}
//////////////////////////////////////////////////////
function animate_right(pos,new_pos){
		setTimeout(function(){obj_run.style.right=pos;if(Math.abs(new_pos)!=(Math.abs(pos))){pos-=10; animate_right(pos,new_pos);}},1);
}
/////////////////////////////////////////////////////////////

