function show(ID)
{
	if (document.getElementById(ID).style.display == 'none')
	{
		document.getElementById(ID).style.display = '';

		// do cookie vlozim otevrene adresare
		allcookies=document.cookie;
		tree=getbycookie("petree");
		if (tree) tree=tree+"-"+ID;
		else tree=ID;
		
	}
	else
	{
		document.getElementById(ID).style.display = 'none';
		
		// z cookie zavrene adresare vytahnu
		allcookies=document.cookie;
		treec=getbycookie("petree");
		if (treec) {
			treearray=treec.split("-"); 
			tree="";
			citac=0;
			for (x=0; x<treearray.length; x++) {
				if (treearray[x]!=ID) {
					if (citac) tree+="-";
					tree+=treearray[x];
					citac++;
				}
			}
		}
	}
	//document.cookie="petree="+tree;
	document.cookie="petree="+tree+";path=/";
}

function getbycookie(VSTUP)
{
	VSTUP+="="; // připojím nakonec rovnítko
	allcookies=document.cookie; // do proměnné natáhnu celou cookie uloženou na počítači
	pos=allcookies.indexOf(VSTUP); // vyhledám začátek proměnné v získaném stringu
	if (pos!=-1) // jestli jsem začátek našel, provedu dohledání
	{
		start=pos + VSTUP.length; // začátek hodnoty cookie
		end=allcookies.indexOf(";", start); // konec hodnoty cookie
		if (end==-1) end = allcookies.length; // ošetření na konec řetězce
		VYSTUP=allcookies.substring(start, end); // zjištění hodnoty vystřižením ze stringu
		return VYSTUP; // vrátím získané hodnoty
	}
	// jestli jsem nic nenašel, vrátím chybu
	else return false;
}

function openmenu()
{
	tree=getbycookie("tree");
	if (tree) {
		arr=tree.split("-");
		for (x=0; x<arr.length; x++) {
			if (document.getElementById(arr[x])) document.getElementById(arr[x]).style.display = '';
		}
	}
}

function open1menu(menu)
{
	document.getElementById(menu).style.display = '';
}

