// 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 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)
  		if (!obj) return false;
  		obj.style.display = "inline";
  		obj.style.top  = eval(coordY - (obj.offsetHeight / 2)) + "px";
  		obj.style.left = eval(coordX + 15) + "px";
	}

	function hideHint(pageElement) {
		var div_node = document.getElementById(pageElement)
		if (!div_node) return false;
		var parent_node = div_node.parentNode;
		parent_node.removeChild(div_node);
		//document.getElementById(pageElement).style.display = 'none';
	}

    function createHint(thisObj, hintText, hintId) {
    	thisObj.title = '';
    	hintId = hintId + "_hint";
    	if (hintText == '') return false;

  		// First remove old DIV if exists and Add new DIV element with defined ID and HINT
  		var hint = document.createElement("div");
  		hint.id = hintId;
  		hint.className = "hint";
  		hint.innerHTML = hintText;

  		document.body.appendChild(hint);
  		// 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, hintId);};
    		element.onmouseout  = function() {hideHint(hintId);};
  		} else {
    		element.setAttribute("onmousemove", "showHint(event, '" + hintId + "');");
    		element.setAttribute("onmouseout", "hideHint('" + hintId + "');");
  		}
    }

    function createPopup(popupHTML) {

		var popupId = 'popup_id';
		var popup;
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();

		popup = document.getElementById(popupId);
		if (popup) {
			popup.innerHTML = popupHTML;
		}
		else {
  			popup = document.createElement("div");
  			popup.id = popupId;
  			popup.className = "popup";
  			popup.innerHTML = popupHTML;

  			document.body.appendChild(popup);
		}

  		popup.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');

		return false; // nefunkcni click na href
    }


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