			function hideAllSelects() {
				for (var i = 0; i < document.forms.length; i++) {
					for (var j = 0; j < document.forms[i].elements.length; j++) {
						with (document.forms[i].elements[j]) {
							if (type == 'select-one' || type == 'select-multiple') {
							   style.visibility = 'hidden';
							}
						}
					}
				}
				if(document.forms[0].cr) document.forms[0].cr.style.visibility = 'visible';
				if(document.forms[0].dod) document.forms[0].dod.style.visibility = 'visible';
				if(document.forms[0].mod) document.forms[0].mod.style.visibility = 'visible';
				if(document.forms[0].yod) document.forms[0].yod.style.visibility = 'visible';
				if(document.forms[0].ddo) document.forms[0].ddo.style.visibility = 'visible';
				if(document.forms[0].mdo) document.forms[0].mdo.style.visibility = 'visible';
				if(document.forms[0].ydo) document.forms[0].ydo.style.visibility = 'visible';
				if(document.forms[0].id_terminu) document.forms[0].id_terminu.style.visibility = 'visible';
			}
			
			function showAllSelects() {
				for (var i = 0; i < document.forms.length; i++) {
					for (var j = 0; j < document.forms[i].elements.length; j++) {
						with (document.forms[i].elements[j]) {
							if (type == 'select-one' || type == 'select-multiple') {
								style.visibility = 'visible';
							}
						}
					}
				}
			}
			
			function getRef(id) {
				if (isDOM) return document.getElementById(id);
				if (isIE4) return document.all[id];
				if (isNS4) return document.layers[id];
			}

			function getSty(id) {
				return (isNS4 ? getRef(id) : getRef(id).style);
			} 
			
			
			function popOver(menuNum, itemNum, menu) {
			var menu = menu;
				//hideAllSelects();
				clearTimeout(popTimer);
				hideAllBut(menuNum, menu);
				litNow = getTree(menuNum, itemNum, menu);
				changeCol(litNow, true, menu);
				targetNum = menu[menuNum][itemNum].target;
				if (targetNum > 0) {
					thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
					thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);
						with (menu[targetNum][0].ref) {
							left = parseInt(thisX + menu[targetNum][0].x);
							top = parseInt(thisY + menu[targetNum][0].y);
							visibility = 'visible';
						}
				}
			}
			

			function popOut(menuNum, itemNum, menu) {
			var menu = menu;
				//showAllSelects();
				litNow = getTree(menuNum, itemNum, menu);
				if ((menuNum == 0) && !menu[menuNum][itemNum].target)
				hideAllBut(0, menu)
				else
				popTimer = setTimeout('hideAllBut(0, ' + menu[0][0].name + ')', 1);
			}

			function getTree(menuNum, itemNum, menu) {
			var menu = menu;
				itemArray = new Array(menu.length);
				while(1) {
					itemArray[menuNum] = itemNum;
					if (menuNum == 0) return itemArray;
					itemNum = menu[menuNum][0].parentItem;
					menuNum = menu[menuNum][0].parentMenu;
				}
			}

			function changeCol(changeArray, isOver, menu) {
			var menu = menu;
			
				for (menuCount = 0; menuCount < changeArray.length; menuCount++) {
					if (changeArray[menuCount]) {
						if (menu[menuCount][changeArray[menuCount]].disabled) {
							newCol = isOver ? menu[menuCount][0].overColDisabled : menu[menuCount][0].backColDisabled;
						} else {
							newCol = isOver ? menu[menuCount][0].overCol : menu[menuCount][0].backCol;
						}

						with (menu[menuCount][changeArray[menuCount]].ref) {
							if (isNS4) bgColor = newCol;
								else backgroundColor = newCol;
						}
					}
				}
			}

			function hideAllBut(menuNum, menu) {
			var menu = menu;
				var keepMenus = getTree(menuNum, 1, menu);
				for (count = 0; count < menu.length; count++)
					if (!keepMenus[count])
						menu[count][0].ref.visibility = 'hidden';
				changeCol(litNow, false, menu);
			}

			function Menu(MenuName, isVert, align, popInd, x, y, width, overCol, backCol, overColDisabled, backColDisabled, borderClass, textClass, textClassDisabled) {
				this.isVert = isVert;
				this.popInd = popInd
				this.x = x;
				this.y = y;
				this.width = width;
				this.overCol = overCol;
				this.backCol = backCol;
				this.overColDisabled = overColDisabled
				this.backColDisabled = backColDisabled
				this.borderClass = borderClass;
				this.textClass = textClass;
				this.textClassDisabled = textClassDisabled;
				this.parentMenu = null;
				this.parentItem = null;
				this.name = MenuName;
				this.align = align;
				this.ref = null;
			}

			function Item(text, href, frame, length, spacing, target, overCol, backCol, piktogram, disabled) {
				this.text = text;
				this.href = href;
				this.frame = frame;
				this.length = length;
				this.spacing = spacing;
				this.target = target;
				this.disabled = disabled;
				this.overCol = overCol;
				this.backCol = backCol;
				this.piktogram = piktogram;
				this.ref = null;
			}

			function writeMenus(menu) {
			
				if (!isDOM && !isIE4 && !isNS4) {
					alert('Váš prohlížeč nepodporuje technologii Java');
					return;
				}
				
				for (currMenu = 0; currMenu < menu.length; currMenu++) with (menu[currMenu][0]) {

					var str = '', itemX = 0, itemY = 0;

					for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem]) {
						var itemID = menu[0][0].name + currMenu + 'item' + currItem;

						var w = (isVert ? width : length);
						var h = (isVert ? length : width);

						if (isDOM || isIE4) {
							str += '<div id="' + itemID + '" style="position: absolute; left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
							if (disabled) {
								if (backColDisabled) str += 'background: ' + backColDisabled + '; ';
							} else {
								if (backCol) str += 'background: ' + backCol + '; ';
							}
							str += '" ';
						}
					
						if (isNS4) { 
							str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' +  w + '" height="' + h + '" visibility="inherit" ';
							if (disabled) {
								if (backColDisabled) str += 'bgcolor="' + backColDisabled + '" ';
							} else {
								if (backCol) str += 'bgcolor="' + backCol + '" ';
							}
						}
						if (borderClass) str += 'class="' + borderClass + '" ';	

						str += 'onMouseOver="popOver(' + currMenu + ',' + currItem + ', ' + menu[0][0].name + ')" onMouseOut="popOut(' + currMenu + ',' + currItem + ', ' + menu[0][0].name + ')">';

						str += '<table width="' + w + '" border="0" style="' + (isVert? 'BORDER-TOP: black 1px solid; BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid': 'BORDER-RIGHT: white 2px solid') + '"  cellspacing="0" cellpadding="1"><tr><td align="left" width="' + (isVert?(piktogram?30:15):0) + '">' + (piktogram?'<img src="Icons/' + piktogram + '" border="0">':'&nbsp;') + '</td><td align="' + align + '" height="' + h + '" wrap>' + (disabled ? '<span class="' + textClassDisabled + '">' + text + '</span>' : '<a class="' + textClass + '" href="' + href + '"' + (frame ? ' target="' + frame + '">' : '>') + text + '</a>') + '</td>';
						
						if (target > 0) {

						menu[target][0].parentMenu = currMenu;
						menu[target][0].parentItem = currItem;

						if (popInd) str += '<td class="' + (disabled ? textClassDisabled : textClass ) + '" align="right" nowrap><b>' + popInd + '&nbsp;</b></td>';
					}
					str += '</tr></table>' + (isNS4 ? '</layer>' : '</div>');
					if (isVert) itemY += length + spacing;
					else itemX += length + spacing;
				}
				if (isDOM) {
					var newDiv = document.createElement('div');
					document.getElementsByTagName('body').item(0).appendChild(newDiv);
					newDiv.innerHTML = str;
					ref = newDiv.style;
					ref.position = 'absolute';
					ref.visibility = 'hidden';
				}

				if (isIE4) {
					document.body.insertAdjacentHTML('beforeEnd', '<div id="menu' + currMenu + 'div" ' + 'style="position: absolute; visibility: hidden">' + str + '</div>');
					ref = getSty(menu[0][0].name + currMenu + 'div');
				}

				if (isNS4) {
					ref = new Layer(0);
					ref.document.write(str);
					ref.document.close();
				}

				for (currItem = 1; currItem < menu[currMenu].length; currItem++) {
					itemName = menu[0][0].name + currMenu + 'item' + currItem;
					if (isDOM || isIE4) menu[currMenu][currItem].ref = getSty(itemName);
					if (isNS4) menu[currMenu][currItem].ref = ref.document[itemName];
				}
			}
			with(menu[0][0]) { 
				ref.left = x;
				ref.top = y;
				ref.visibility = 'visible';
			}
		}
		

	var visibleVar="null";

	if (navigator.appName == "Netscape") {
		layerStyleRef="layer.";
		layerRef="document.layers";
		styleSwitch="";
		visibleVar="show";
	}else{
		layerStyleRef="layer.style.";
		layerRef="document.all";
		styleSwitch=".style";
		visibleVar="visible";
	}

 function showLayer(layerName){
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
 	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.display="block"');
}

 function hideLayer(layerName){
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.display="none"');
 }

 function Switch(layerName){
	if (eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility == visibleVar')){
		hideLayer(layerName);
	}else{
		showLayer(layerName);
	}
}