var tormoz = null;  //Таймер
var tormoznoy_put = 10; // Количество итераций
var speed = 25; // Скорость в мс
var currentStep = 1; // Текущий шаг
var showhide = 'show'; // Показывать или прятать
var currentId = 'block_hy';

//Принимает запрос и запускает таймер
function goFullText(id)
{
	if(tormoz)
	{
		clearInterval(tormoz);
	}
	currentId = id;
	tormoz = setInterval(fullText,speed);
	
}


function fullText()
{
	if(currentStep < tormoznoy_put)
	{
		
		if(showhide == 'show')
		{
			if(currentStep == 1)
			{
				document.getElementById(currentId).style.height = '0px';
			}
			
			var actStep = (currentStep+1)*20;
		}
		else if(showhide == 'hide')
		{
			if(currentStep == 1)
			{	
				document.getElementById(currentId).style.height = '100%';
			}
			
			var actStep = (tormoznoy_put-currentStep)*20;
		}
		currentStep ++;
		document.getElementById(currentId).style.height = actStep+'px';
	}
	else 
	{
		if(showhide == 'show')
		{
			document.getElementById(currentId).style.height = 'auto';
			//Переключаем в прятать
			showhide = 'hide';
		}
		else
		{
			document.getElementById(currentId).style.height = '0px';
			//Переключаем в показывать
			showhide = 'show';
		}
		currentStep = 1;
		clearInterval(tormoz);
	}	
}
