	var gst = new Array();
	var menu_height = new Array();
	var showEx = new Array();
	
	function showExtraMenu(el_id) {
		var menu;
		menu = document.getElementById(el_id);
		if(menu) {
			showEx[el_id] = true;
			gst[el_id] = setTimeout('showExtraMenuAfterTimeout(\''+el_id+'\')',200);
		}
	}
	
	function hideExtraMenu(el_id) {
		var menu;
		menu = document.getElementById(el_id);
		if(menu) {
			showEx[el_id] = false;
			gst[el_id] = setTimeout('hideExtraMenuAfterTimeout(\''+el_id+'\')',200);
		}
	}
	
	
	function showExtraMenuAfterTimeout(el_id) {
		menu = document.getElementById(el_id);
		if(menu && showEx[el_id]) {
			block = (menu.style.display == 'block');
			menu.style.display = 'block';
			if(menu_height[el_id] == undefined) {
				if(menu.offsetHeight >= 171) {
					menu_height[el_id] = '171px';
				} else {
					menu_height[el_id] = "auto";
					menu.style.marginTop = '-21px';
				}
			}
			//alert('height '+menu_height+', '+menu.offsetHeight);
			menu.style.height = menu_height[el_id];
			updateMenuPosition(el_id);
			clearTimeout(gst[el_id]);
		}
	}
	
	function hideExtraMenuAfterTimeout(el_id) {
		menu = document.getElementById(el_id);
		if(menu && !showEx[el_id]) {
			menu.style.display = 'none';
		}
	}
	
	function getObjectLeft(el)
	{    
    var x = el.offsetLeft;
    el = el.parentNode;
    while(el.tagName != 'BODY')
    {
      x = x+el.offsetLeft;  
      el = el.parentNode;    
    }
    return x;
  }
	
	function getPageDimension(){
	
	var xScroll, yScroll;
	var scrollLeft=0, scrollTop=0;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	var arrayPageSize = {"pageWidth":pageWidth,"pageHeight":pageHeight,"windowWidth":windowWidth,"windowHeight":windowHeight};
	return arrayPageSize;
}

	
	function updateMenuPosition(el_id) // musi se vejit na monitor
	{
      var menu = document.getElementById(el_id);
      menu.style.width = '184px'

    var dim = getPageDimension();

      if (document.all) // pro IE
      {    
    if (dim.pageWidth >= 1050) return;
    	el_main = document.getElementById("toplinka");
    	var x1 = getObjectLeft(el_main)+el_main.offsetWidth;
      var menuWidth = menu.offsetWidth;
    	var menuLeft = menu.offsetLeft;
      var x2 = menuLeft+menuWidth;
            
      var elx = getObjectLeft(document.getElementById("menuprave"));
        
      if (x1 < x2) 
      {        
        menuLeft = elx-menuWidth-64;
      }
      }
      else
      {
      if (dim.pageWidth >= 1032) return;

      el_main = document.getElementById("toplinka");
    	var x1 = getObjectLeft(el_main)+el_main.offsetWidth;
      var menuWidth = menu.offsetWidth;
    	var menuLeft = menu.offsetLeft;
      var x2 = menuLeft+menuWidth;
            
      var elx = getObjectLeft(document.getElementById("menuprave"));
      if (x1 < x2+10) 
      {              
        if (dim.pageWidth > 990)
        {
          menuLeft = elx-Math.ceil(menuWidth+108+((dim.pageWidth-991)*1.8));
        } else menuLeft = elx-(menuWidth+108);
      }  
      }    
              
      if (menuLeft != menu.offsetLeft)
      {
        menu.style.left = menuLeft+'px';
      }  
  }

	var msl1 = 0;
	var msl2 = 0;
	var timing = new Array();
	function showMenuproducts() {
		behavior = (document.getElementById('menuproductsUl_1').style.display == 'none') ? 'block' : 'none';
		msl1 = 1;
		document.getElementById('menuproductsUl_1').style.display = 'block';
		document.getElementById('menumarksUl_1').style.display = 'none';
	}
	function showMenumarks() {
		behavior = (document.getElementById('menumarksUl_1').style.display == 'none') ? 'block' : 'none';
		msl2 = 1;
		document.getElementById('menumarksUl_1').style.display = 'block';
		document.getElementById('menuproductsUl_1').style.display = 'none';
	}
	function showMenuproductsSubmenu(id,parentId) {
		behavior = (document.getElementById('menuproductsUl_' + id).style.display == 'none') ? 'block' : 'none';
		document.getElementById('menuproductsUl_' + id).style.display = behavior;
	}
	function hideMenu() {
		document.getElementById('menuproductsUl_1').style.display = 'none';
		document.getElementById('menumarksUl_1').style.display = 'none';
	}
	function findPosition(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent);
			return [curleft,curtop];
		}
	}
	function switchOffFlash(off)
	{
		var objectarray = document.getElementsByTagName("object");
		for(var i in objectarray)
		 if(objectarray[i].style.visibility != null   )objectarray[i].style.visibility = (off)?"hidden":"";
	}