// JavaScript Document
    function KatUkSk(coK){
      displ = document.getElementById('coK'+coK).style.display;
    	if(displ==''){
    	  document.getElementById('coK'+coK).style.display='none';
    		document.getElementById('coIK'+coK).src='/img/tree-c.gif';
    	}else{
    	  document.getElementById('coK'+coK).style.display='';
    		document.getElementById('coIK'+coK).src='/img/tree-o.gif';
      }
    }
// Zobrazí popup okno s obrázkem
function PopupPic(sPicURL, imageWidth, imageHeight)
{
	var elemId = "popup-image";
	var NS = (navigator.appName=="Netscape")?true:false;
	var el = document.getElementById(elemId);
	if (el)
	{
		document.body.removeChild(el);
	}

	el = document.createElement('img');
	el.setAttribute('src', sPicURL);	
	el.style.position = 'absolute';
	el.style.visibility = 'hidden';
	el.style.padding = '0px';
	//el.style.-moz-border-radius = '5px';
	//el.style.-webkit-border-top-right-radius = '5px';

	// border (CSS rule)
	el.style.border = '2px solid #E4E4E4';
	el.style.zIndex = '999';
	el.style.cursor = 'pointer';
	el.title = "";
	el.id = elemId;
	
	// click to close
	if (window.addEventListener)
		el.addEventListener('click', doPopupClick, false);
	else if (window.attachEvent)
		el.attachEvent('onclick', doPopupClick);

	document.body.appendChild(el);

	// centre the image
	if (this.innerHeight) {
		windowHeight = this.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		windowHeight = document.body.clientHeight;
	}
	if (this.innerWidth) {
		windowWidth = this.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		windowWidth = document.documentElement.clientWidth;
	} else if (document.body) {
		windowWidth = document.body.clientWidth;
	}
	
	// Scrollbars
	if (this.pageYOffset != null)
		offsetY = this.pageYOffset;
	else if (document.body.scrollTop != null)
		offsetY = document.documentElement.scrollTop;
	if (this.pageXOffset != null)
		offsetX = this.pageXOffset;
	else if (document.body.scrollLeft != null)
		offsetX = document.documentElement.scrollLeft;
	
	// Zdroj velikosti okna
	if (imageWidth <= 0)
		imageWidth = el.offsetWidth;
	if (imageHeight <= 0)
		imageHeight = el.offsetHeight;	
	
	// Případné omezení velikosti příliš velkého obrázku (zatím upravujeme jen jeden, aby se zachovali proporce)
	if (imageHeight > windowHeight)
	{
		var oldWidth = el.width;
		if (oldWidth == 0)
			oldWidth = imageWidth;
		
		el.height = windowHeight - windowHeight / 6;
		var ratio = el.height / imageHeight;
		imageHeight = el.height;
				
		// dopocitani sirky
		el.width = imageWidth * ratio;
		imageWidth = el.width;
	}
	if (imageWidth > windowWidth)
	{
		var oldHeight = el.height;
		if (oldHeight == 0)
			oldHeight = imageHeight;
		
		el.width = windowWidth - windowWidth / 6;
		var ratio = el.width / imageWidth;
		imageWidth = el.width;
				
		// dopocitani vysky
		el.height = imageHeight * ratio;
		imageHeight = el.height;
	}

	// Pozice okna
	el.style.left = (windowWidth / 2 - imageWidth / 2 + offsetX).toString() + 'px';
	el.style.top = (windowHeight / 2 - imageHeight / 2 + offsetY).toString() + 'px';

	el.style.visibility = 'visible';
}

function doPopupClick(e)
{
	var obj = e.target || e.srcElement;
	obj.parentNode.removeChild(obj);
}

