 
        function CoToInit() {                        
        
		
		coto = new tooltip("coto",
		                        "ELEMENTS=a, th, div, img, td, input, select, span, strong, tr, abbr, strike, h2,li",         // aplikuje se na vsechny elementy P = odstavce
					        	"", 
							    "", 
								 50,
								 250, 
								 100 );
      
        
    }
    
    
function sFunc() { if (IE) { oldBodyText = document.body.innerHTML; reg = /<ABBR/g; newBodyText = oldBodyText.replace(reg, '<ACRONYM style="border-bottom: 1px dotted black"'); reg = /\/ABBR>/g; newBodyText = newBodyText.replace(reg, '/ACRONYM>'); document.body.innerHTML = newBodyText;}
CoToInit();}
var tooltip; var timeout; var IE = document.all?true:false; var IEStd; if (IE)
if (document.compatMode)
if (document.compatMode != "BackCompat") IEStd = 1; var Opera = navigator.userAgent.indexOf("Opera") > -1 ? true : false; var UAVer = navigator.appVersion; var Opera7 = navigator.userAgent.indexOf("Opera 7") > -1 ? true : false; if (Opera) IE = false; if (typeof document.attachEvent!='undefined') { window.attachEvent('onload',sFunc); document.attachEvent('onmousemove',getMouseXY);} else { window.addEventListener('load',sFunc,false); document.addEventListener('mousemove',getMouseXY,false);}
var X = 0; var Y = 0; var shown; var currentTooltip; var docX = document.offsetWidth; var docY = document.offsetHeight; var minY, maxY, minX, maxX; var all = document.all ? document.all : document.getElementsByTagName('*');
function getMouseXY(e) {
if (IE)
{
	
		var tempX = event.clientX + document.documentElement.scrollLeft;
	
	
	
	var tempY = event.clientY + (document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop);
} else { tempX = e.pageX
tempY = e.pageY
}
if (tempX < 0){tempX = 0}
if (tempY < 0){tempY = 0}
X = tempX; Y = tempY; if ((X <= minX || X >= maxX) || (Y <= minY || Y >= maxY) && currentTooltip) { hideTooltip();}
else { if (currentTooltip) { showTooltip();}
}
return true
}
function findPosX(obj)
{
var curleft = 0;
if(obj.offsetParent)
	while(1)
	{
		curleft += obj.offsetLeft;
		if(!obj.offsetParent) break;
		obj = obj.offsetParent;
	}
else if(obj.x)
	curleft += obj.x; return curleft;
}
function findPosY(obj)
{
	var curtop = 0;
	if(obj.offsetParent)
while(1)
{
	curtop += obj.offsetTop;
	if(!obj.offsetParent) break;
	obj = obj.offsetParent;
}
else if(obj.y)
	curtop += obj.y;
	
return curtop;
}
function hideTooltip() { window.clearTimeout(timeout); if ((X <= minX || X >= maxX) || (Y <= minY || Y >= maxY) && currentTooltip) { if (currentTooltip) currentTooltip.style.visibility = 'hidden'; currentTooltip = 0; shown = 0;}
}
function showIt(){ if (currentTooltip.style && shown) currentTooltip.style.visibility = 'visible';}
function showTooltip(objTooltip, objOver, text, delay, maxWidth)
{
if (delay)
 {
	timeout = setTimeout("showIt()", delay);
 }
if (!objTooltip && currentTooltip)
 {
	 objTooltip = currentTooltip;
 }
if (!objTooltip) return;
if (text) objTooltip.innerHTML = text;
if (IE)
	{
		if (maxWidth && objTooltip.offsetWidth > maxWidth) objTooltip.style.width = maxWidth + "px";
		if (maxWidth && objTooltip.offsetWidth <= maxWidth) objTooltip.style.width = "auto";
	}
if (objOver)
 { 
	 res = CoToGetElementAbsolutePos(objOver);
	 minX = res.x;
	 minY = res.y; 
	 maxX = minX + objOver.offsetWidth + 3; 
	 maxY = minY + objOver.offsetHeight + 3;
 }
if (X + objTooltip.offsetWidth < document.body.offsetWidth-10)
 { 
	 objTooltip.style.left = eval(X + 8) + "px";
 }
else
 { 
	 objTooltip.style.left = eval(X - 8 - objTooltip.offsetWidth) + "px";
 }
if (Y - objTooltip.offsetHeight > 10)
 {
	 objTooltip.style.top = eval(Y - objTooltip.offsetHeight) - 8 + "px";
 }
else
{ 
	objTooltip.style.top = Y + "px";
}
currentTooltip = objTooltip;
shown = 1;
if (delay === 0) showIt();
document.getElementById
}
function applyTooltip(obj, applyRules, tName, tClassName, tDelay, tMaxWidth) { if (!tDelay) tDelay = 0; if (!tMaxWidth) tMaxWidth = 0; var applyElements, applyClasses, currentElement, currentObject; if (applyRules.substring(0, 9).toUpperCase() == "ELEMENTS=") { applyElements = applyRules.substring(9).toUpperCase()+",";}
if (applyRules.substring(0, 8).toUpperCase() == "CLASSES=") { applyClasses = applyRules.substring(8).toUpperCase()+",";}
if (!applyElements) { if (applyRules == 'default') applyElements = "ACRONYM,ABBR,"; if (applyRules == '*') applyElements = "*"; if (!applyElements) applyElements = applyRules.toUpperCase()+",";}
if (!applyClasses) applyClasses = "*"; for (var element = 0; element < all.length; element++) { if (IE) { all[element].setAttribute("onmouseout", null); all[element].setAttribute("onmousemove", null);}
if (Opera7) { all[element].onmousemove = null; all[element].onmouseout = null;}
clBranch = 0; if (all[element].className != "") { classes = all[element].className.toUpperCase().split(" "); i = 0; while (classes[i]) { if (applyClasses.indexOf(classes[i]+",") > -1) clBranch = 1; i++;}
}
if ((applyElements == "*" || applyElements.indexOf(all[element].tagName+",") > -1 || clBranch) && (all[element].getAttribute('title') != null && all[element].getAttribute('title') != ""))
{
	oldTitle = all[element].getAttribute('title');
	onMouseMove = "";
	onMouseOut = "";
	if (!IE && !Opera7)
	{ 
		if (all[element].getAttribute("onmousemove"))
			{
				if (all[element].getAttribute("onmousemove").indexOf("showTooltip") == -1)
				 {
					 onMouseMove = all[element].getAttribute("onmousemove") + "; " + "showTooltip("+tName+".tooltip, this, '"+all[element].getAttribute('title')+"', "+tDelay+", "+tMaxWidth+")";
				 }
			}
			else
			{
				onMouseMove = "showTooltip("+tName+".tooltip, this, '"+all[element].getAttribute('title')+"', "+tDelay+", "+tMaxWidth+")";
			}
			if (all[element].getAttribute("onmouseout"))
			{

				//alert(all[element].getAttribute("onmouseout"));
				//if (all[element].getAttribute("onmousemove").indexOf("showTooltip") == -1)
				onMouseOut = all[element].getAttribute("onmouseout") + "; " + "hideTooltip()";
			}
			else
			{
				onMouseOut = "hideTooltip()";
			}
		all[element].setAttribute("title", " ");
		if (onMouseMove) all[element].setAttribute("onmousemove", onMouseMove);
			if (onMouseOut) all[element].setAttribute("onmouseout", onMouseOut);
		} 
		else
		{
			all[element].setAttribute("title", "");
			currObject = all[element];
			all[element].reference = currObject;
			all[element].onmouseover = new Function( "showTooltip("+tName+".tooltip, all["+element+"].reference, '"+oldTitle+"', "+tDelay+", "+tMaxWidth+");" );
			all[element].onmouseout = new Function("hideTooltip();");
}
if (tClassName) { if (all[element].className) { all[element].className = tClassName;} else { all[element].className = all[element].className + " " + tClassName;}
}
}
}
}
function tooltip(tName, appliesTo, className, targetClassName, tDelay, tMaxWidth, tOpacity) { if (appliesTo) { this.apply = appliesTo } else { this.apply = "default" }
this.name = tName; if (targetClassName) this.tClassName = targetClassName; if (tDelay) this.delay = tDelay; if (tMaxWidth) this.maxWidth = tMaxWidth; if (tOpacity) { this.opacity = tOpacity;} else { this.opacity = 100;}
this.tooltip = document.createElement('DIV'); if (className) { this.tooltip.className = className;} else { this.tooltip.style.cssText = "text-align:left;border: 1px solid #9C9C9C;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px; background: #ECEBDE; padding: 2px 4px;  font-family: sans-serif; z-index: 20; line-height: 95%;color:#000000;font-size:14px;" }
this.tooltip.style.visibility = 'hidden'; this.tooltip.style.position = 'absolute'; this.tooltip.style.top = 0; document.getElementsByTagName('BODY')[0].appendChild(this.tooltip); if (tOpacity && tOpacity < 100) { if (IE) { this.tooltip.style.filter="alpha(opacity="+tOpacity+")";} else { this.tooltip.style.opacity=eval("'0."+tOpacity+"'"); this.tooltip.style.MozOpacity=eval("'0."+tOpacity+"'"); this.tooltip.style.KhtmlOpacity=eval("'0."+tOpacity+"'");}
}
if (!IE && this.maxWidth) this.tooltip.style.maxWidth = this.maxWidth + "px"; applyTooltip(this.tooltip, this.apply, this.name, this.tClassName, this.delay, this.maxWidth);}


function CoToGetElementAbsolutePos(elemID) {  
     var element;  
     if (typeof(elemID) == "string") {  
         element = document.getElementById(elemID);  
     }  
     else {  
         element = elemID;  
     }  
   
     var res = new Object();  
     res.x = 0; res.y = 0;  
     if (element !== null) {  
         res.x = element.offsetLeft;  
   
         var offsetParent = element.offsetParent;  
         var offsetParentTagName = offsetParent != null ? offsetParent.tagName.toLowerCase() : "";  
   
         if (__isIENew  && offsetParentTagName == 'td') {  
             res.y = element.scrollTop;  
         }  
         else {  
             res.y = element.offsetTop;  
         }  
           
         var parentNode = element.parentNode;  
         var borderWidth = null;  
   
         while (offsetParent != null) {  
             res.x += offsetParent.offsetLeft;  
             res.y += offsetParent.offsetTop;  
               
             var parentTagName = offsetParent.tagName.toLowerCase();   
   
             if ((__isIEOld && parentTagName != "table") || (__isFireFoxNew && parentTagName == "td")  || __isChrome) {            
                 borderWidth = __getBorderWidth(offsetParent);  
                 res.x += borderWidth.left;  
                 res.y += borderWidth.top;  
             }  
               
             if (offsetParent != document.body && offsetParent != document.documentElement) {  
                 res.x -= offsetParent.scrollLeft;  
                 res.y -= offsetParent.scrollTop;  
             }  
   
   
             //next lines are necessary to fix the problem with offsetParent  
             if (!__isIE && !__isOperaOld || __isIENew) {  
                 while (offsetParent != parentNode && parentNode !== null) {  
                     res.x -= parentNode.scrollLeft;  
                     res.y -= parentNode.scrollTop;  
                     if (__isFireFoxOld || __isWebKit) {  
                         borderWidth = __getBorderWidth(parentNode);  
                         res.x += borderWidth.left;  
                         res.y += borderWidth.top;  
                     }  
                     parentNode = parentNode.parentNode;  
                 }      
             }  
   
             parentNode = offsetParent.parentNode;  
             offsetParent = offsetParent.offsetParent;  
         }  
     }  
     return res;  
 }
function __getIEVersion() {  
     var rv = -1; // Return value assumes failure.  
     if (navigator.appName == 'Microsoft Internet Explorer') {  
         var ua = navigator.userAgent;  
         var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");  
         if (re.exec(ua) != null)  
             rv = parseFloat(RegExp.$1);  
     }  
     return rv;  
 }  
   
 function __getOperaVersion() {  
     var rv = 0; // Default value  
     if (window.opera) {  
         var sver = window.opera.version();  
         rv = parseFloat(sver);  
     }  
     return rv;  
 }  
   
 var __userAgent = navigator.userAgent;  
 var __isIE =  navigator.appVersion.match(/MSIE/) != null;  
 var __IEVersion = __getIEVersion();  
 var __isIENew = __isIE && __IEVersion >= 8;  
 var __isIEOld = __isIE && !__isIENew;  
   
 var __isFireFox = __userAgent.match(/firefox/i) != null;  
 var __isFireFoxOld = __isFireFox && ((__userAgent.match(/firefox\/2./i) != null) || (__userAgent.match(/firefox\/1./i) != null));  
 var __isFireFoxNew = __isFireFox && !__isFireFoxOld;  
   
 var __isWebKit =  navigator.appVersion.match(/WebKit/) != null;  
 var __isChrome =  navigator.appVersion.match(/Chrome/) != null;  
 var __isOpera =  window.opera != null;  
 var __operaVersion = __getOperaVersion();  
 var __isOperaOld = __isOpera && (__operaVersion < 10);  
   
 function __parseBorderWidth(width) {  
     var res = 0;  
     if (typeof(width) == "string" && width != null && width != "" ) {  
         var p = width.indexOf("px");  
         if (p >= 0) {  
             res = parseInt(width.substring(0, p));  
         }  
         else {  
             //do not know how to calculate other values (such as 0.5em or 0.1cm) correctly now  
             //so just set the width to 1 pixel  
             res = 1;   
         }  
     }  
     return res;  
 }  
   
   
 //returns border width for some element  
 function __getBorderWidth(element) {  
     var res = new Object();  
     res.left = 0; res.top = 0; res.right = 0; res.bottom = 0;  
     if (window.getComputedStyle) {  
         //for Firefox  
         var elStyle = window.getComputedStyle(element, null);  
         res.left = parseInt(elStyle.borderLeftWidth.slice(0, -2));    
         res.top = parseInt(elStyle.borderTopWidth.slice(0, -2));    
         res.right = parseInt(elStyle.borderRightWidth.slice(0, -2));    
         res.bottom = parseInt(elStyle.borderBottomWidth.slice(0, -2));    
     }  
     else {  
         //for other browsers  
         res.left = __parseBorderWidth(element.style.borderLeftWidth);  
         res.top = __parseBorderWidth(element.style.borderTopWidth);  
         res.right = __parseBorderWidth(element.style.borderRightWidth);  
         res.bottom = __parseBorderWidth(element.style.borderBottomWidth);  
     }  
      
     return res;  
 }  

