var ano=["0","0","0","0","0","0","0","0"]; 
var hore=0; 
var dole=0; 
var coH;
var coL;
var maxi;
var intervalH=10;	//interval pro rozbaleni
var krokH=5;		//krok pro rozbaleni
var intervalL=10;	//interval pro sbaleni
var krokL=20;		//krok pro sbaleni

function sbal()
{
var jj;
var blok;
	blok = "text"+coL;
	if (intervalL==0)
	{
			document.all.item(blok).className = 'slouplow';
			clearInterval(dole);
			dole=0;
	}
	else
	{
		jj = document.all.item(blok).offsetHeight - krokL;
		if (jj>0)
		{
			document.all.item(blok).style.overflow = "hidden";
		 	document.all.item(blok).style.height = jj;
		}
		if (jj < krokL)
		{
			clearInterval(dole);
			dole=0;
		 	document.all.item(blok).style.height = 1;
			document.all.item(blok).className = 'slouplow';

			id = "plus" + coL; 
			document.all.item(id).style.display =  "";
			id = "minus" + coL; 
			document.all.item(id).style.display = "none";
		}
	}
}

function rozbal()
{
var jj;
var blok;
	blok = "text"+coH;
	if (intervalH==0)
	{
	 	document.all.item(blok).style.height = maxi;
		document.all.item(blok).style.overflow = "auto";
		clearInterval(hore);
		hore=0;
	}
	else
	{
		if (document.all.item(blok).offsetHeight < maxi )
		{
			jj = document.all.item(blok).offsetHeight + krokH;
		 	document.all.item(blok).style.height = jj;
		}
		if (jj > (maxi - krokH))
		{
			clearInterval(hore);
			hore=0;
		 	document.all.item(blok).style.height = maxi;
			document.all.item(blok).style.overflow = "auto";

			id = "plus" + coH; 
			document.all.item(id).style.display =  "none";
			id = "minus" + coH; 
			document.all.item(id).style.display = "";
		}
	}
}

function Display(elementID) 
// zobrazi menu s animaci
{ 
var id;
var i;
var vyska;
var m;
	vyska = eval(document.all.item("menu").offsetHeight);
	vyska = vyska - 5 * 30 - 15;
	m = vyska;

var s = "12";
var j = eval(vyska);
//	alert(dole+" / "+hore);
	if ((dole == 0) && (hore == 0))
	{

		id = "text" + elementID; 
		if (ano[elementID]==0)
		{
			for (i = 1; i <= 5; i++)
			{
				ano[i]=0;
			}
			ano[elementID]=1;
		}
		else
		{
			for (i = 1; i <= 5; i++)
			{
				ano[i]=0;
			}
			ano[elementID]=0;
		}
		for (i = 1; i <= 5; i++)
		{
			if (ano[i]==0)
			{
				id = "text" + i; 
				if (document.all.item(id).offsetHeight > 0)
				{
					id = "nadpis" + i; 
					document.all.item(id).className = 'nadpislow';

//					id = "plus" + i; 
//					document.all.item(id).style.display =  "";
//					id = "minus" + i; 
//					document.all.item(id).style.display = "none";

					id = "text" + i; 
					coL = i;
					document.all.item(id).style.overflow = "hidden";
				 	document.all.item(id).style.height = j-krokL;
					dole = setInterval("sbal()", intervalL);
				}
			}
		}	
		for (i = 1; i <= 5; i++)
		{
			if (ano[i]==1)
			{
				id = "nadpis" + i; 
				document.all.item(id).className = 'nadpishigh';

//				id = "plus" + i; 
//				document.all.item(id).style.display =  "none";
//				id = "minus" + i; 
//				document.all.item(id).style.display = "";

				id = "text" + i; 
				document.all.item(id).style.height = 1;
				document.all.item(id).className = 'slouphigh';
				coH = i;
				maxi = j;
				document.all.item(id).style.overflow = "hidden";
				hore = setInterval("rozbal()", intervalH);
			}
		}
	}
} 

function Hned(elementID) 
// zobrazi menu bez animace
{ 
var id;
var i;
var vyska;
var m;
	vyska = eval(document.all.item("menu").offsetHeight);
	vyska = vyska - 5 * 30 - 15;
	m = vyska;

var s = "12";
var j = eval(vyska);
//	alert(dole+" / "+hore);
	if ((dole == 0) && (hore == 0))
	{

		id = "text" + elementID; 
		if (ano[elementID]==0)
		{
			for (i = 1; i <= 5; i++)
			{
				ano[i]=0;
			}
			ano[elementID]=1;
		}
		else
		{
			for (i = 1; i <= 5; i++)
			{
				ano[i]=0;
			}
			ano[elementID]=0;
		}
		for (i = 1; i <= 5; i++)
		{
			if (ano[i]==0)
			{
				id = "text" + i; 
				if (document.all.item(id).offsetHeight > 0)
				{
					id = "nadpis" + i; 
					document.all.item(id).className = 'nadpislow';
					id = "plus" + i; 
					document.all.item(id).style.display =  "";
					id = "minus" + i; 
					document.all.item(id).style.display = "none";
				}
			}
		}	
		for (i = 1; i <= 5; i++)
		{
			if (ano[i]==1)
			{
				id = "nadpis" + i; 
				document.all.item(id).className = 'nadpishigh';
				id = "plus" + i; 
				document.all.item(id).style.display =  "none";
				id = "minus" + i; 
				document.all.item(id).style.display = "";
				id = "text" + i; 
				id = "text" + i; 
			 	document.all.item(id).style.height = j;
				document.all.item(id).className = 'slouphigh';
			}
		}
	}
} 

