var targetHeighta = 300;
//var targetHeighta = 434;
//var targetHeighta = 50;
var targetSpeeda = 50;
var pausea = 10;
if(navigator.appName == 'Microsoft Internet Explorer')
{
	targetSpeeda = 150;
	pausea = 5;
}
if(navigator.appName == 'Opera')
{
	targetSpeeda = 150;
	pausea = 5;
}
var resDiva;
var resDira;
var divThisa;
var dirThisa;
var obja;
var firstHeighta;
var newHeighta;
var t;
var seta = '0';
var storDiva = '';
function doResStep()
{
	firstHeighta = parseInt(obja.style.height);
	if (firstHeighta < targetHeighta)
	{
		newHeighta = firstHeighta + targetSpeeda;
		obja.style.height = newHeighta + "px";
		t = setTimeout(doResStep, pausea);
	}
	else
	{
		obja.style.height = targetHeighta+"px";
		storDiva = divThisa;
	}
}
function dontResStep()
{
	firstHeighta = parseInt(obja.style.height);
	if (firstHeighta > 0 )
	{
		newHeighta = firstHeighta - targetSpeeda;
		obja.style.height = newHeighta + "px";
		t = setTimeout(dontResStep, pausea);
	}
	else 
	{
		obja.style.height = "0px";
		clearTimeout(t);
		storDiva = '';
		if(seta === '1')
		{
			obja = document.getElementById(divThisa);
			objaRoot = document.getElementById('res'+divThisa);
			seta = '0';
			doResStep();
		}
	}
}
function clearOldStep()
{
	if(storDiva != '')
	{
		obja = document.getElementById(storDiva);
		dontResStep();
		seta = '1';
	}
	else
	{
		obja = document.getElementById(divThisa);
		objaTmp = 'res'+divThisa;
		objaRoot = document.getElementById(objaTmp);
		seta = '0';
		storDiva = '';
		doResStep();
	}
}

function showStep(resDiva, resDira)
{
	divThisa = resDiva;
	dirThisa = resDira;
	if(dirThisa === '1')
	{
		clearTimeout(t);
		document.getElementById(divThisa).style.visibility="visible";
		clearOldStep();
	}
	else if(dirThisa === '2')
	{
		obja = document.getElementById(divThisa);
		objaTmp = 'res'+divThisa;
		objaRoot = document.getElementById(objaTmp);
		dontResStep();
	}
}
