// Different functionality in MSIE 7 - Thanks to Miro [smreko AT szm DOT com]
    function documentElementAccordingMsie() {
      return (!window.opera && document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
    }
	
	function createHint(thisObj, hintText) {
		var hint = document.getElementById('hint');

		// pokud div hint neexistuje, vytvorime ho
		if (!hint) {
			hint = document.createElement("div");
			document.body.appendChild(hint);
	  		hint.id = 'hint';
		}
		hint.innerHTML = hintText;
  		// Modify element for showing hint
  		var element = thisObj;
  		// Check the browser - based on MSIE or other
  		// The only MSIE is different
  		if(navigator.appName.indexOf("Microsoft Internet Explorer") >= 0) {
    		element.onmousemove = function() {showHint(event, 'hint');};
    		element.onmouseout  = function() {hideHint('hint');};
  		} else {
    		element.setAttribute("onmousemove", "showHint(event, 'hint');");
    		element.setAttribute("onmouseout", "hideHint();");
  		}
    }

    function showHint(browserEvent, pageElement) {
	  	// Mouse coordinates
  		var coordX = 0;
  		var coordY = 0;
  		// Check the browser - based on MSIE or other
  		// The only MSIE is different
  		var msieElement = documentElementAccordingMsie();
  		if(navigator.appName.indexOf("Microsoft Internet Explorer") >= 0) {
		    coordX = msieElement.scrollLeft + event.clientX;
	    	coordY = msieElement.scrollTop  + event.clientY
  		} else {
		    coordX = browserEvent.pageX;
	    	coordY = browserEvent.pageY;
  		}
  		// Show hint
  		var obj = document.getElementById(pageElement)
  		obj.style.display = "block";
  		obj.style.top  = eval(coordY - (obj.offsetHeight / 2)) + "px";
  		obj.style.left = eval(coordX + 15) + "px";
	}

	function hideHint() {
		document.getElementById('hint').style.display = 'none';
		document.getElementById('hint').innerHTML = '';
	}

    function createPopup(popupHTML) {

		var popup;
		var popup_shadow;
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();

		popup_shadow = document.getElementById('popup_shadow');
		if (popup_shadow) {
			popup = document.getElementById('popup');
			popup_shadow.style.display = 'block';
			popup.innerHTML = popupHTML;
		}
		else {
			// vytvorime hlavni div popup_shadow, ktery je pres celou stranku, ale pod obsahovym divem popup
  			popup_shadow = document.createElement("div");
			popup_shadow.id = 'popup_shadow';
			popup_shadow.onclick = hidePopup;
			popup_shadow.style.height = (arrayPageSize[1] + 'px');
			
			// vytvorime obsahovy popup
			popup = document.createElement("div");
  			popup.id = 'popup';
  			popup.innerHTML = popupHTML;
			
			// nejprve do stranky vlozime div se stinem a do nej az obsah popupu
  			document.body.appendChild(popup_shadow);
			popup_shadow.appendChild(popup);
		}

  		popup_shadow.style.display = 'block';
		popup.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - popup.offsetHeight) / 2) + 'px');
		popup.style.left = (((arrayPageSize[0] - 20 - popup.offsetWidth) / 2) + 'px');
    }
	
	function hidePopup(e) {
		// zmacknut odkaz na zavreni
		if (e == 'close') document.getElementById('popup_shadow').style.display = 'none';
		else {
			var targ;
			if (!e) var e = window.event;
			if (e.target) targ = e.target;
			else if (e.srcElement) targ = e.srcElement;
			if (targ.nodeType == 3) { // defeat Safari bug
				targ = targ.parentNode;
			}
			// popup skryjeme pokud bylo kliknuto na div popup_shadow, jinak nechame otevreno
			if (targ.id == 'popup_shadow') document.getElementById('popup_shadow').style.display = 'none';
		}
	}

function getPageScroll() {

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;
	}
		arrayPageScroll = new Array(xScroll,yScroll)
	return arrayPageScroll;
}

function getPageSize() {

	var xScroll, yScroll;

	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;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}