

/** VSUVKA - Funkce pro natazeni obrazku do img boxu
	po natazeni jiz zustane a nevola se znovu
	*/
var dstvar = new Array();
function fillToolTip(txt, OID){
	//natazeni tooltipu boxu	
	ddrivetip(txt);
	var imgDivElm = document.getElementById( 'toolTipImage' + OID);	
	//dotazeni obrazku
	if ( dstvar[OID] ){
		//alert (dstvar[OID]);
		imgDivElm.src = dstvar[OID];
	}else{
		var url_ifrm = "wnd_tooltipbox.php?val=" + OID;
		document.getElementById('infoOverBox').src= url_ifrm;
	}
}
//funkce volana z ext. okna, naplni var
function setImageSrc(fsrc, OID){
	var imgDivElm = document.getElementById( 'toolTipImage' + OID);
	dstvar[OID] = fsrc;
	//alert ( "setPic" + fsrc );
	imgDivElm.src = dstvar[OID];
}
//okno pres ktere se definuje obsah divu uvnitr tooltipu
//document.write(	'<iframe src= name=infoOverBox id=infoOverBox width=5 height=5 style="display:none;"></iframe>');


/**	Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
	This notice MUST stay intact for legal use
	Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
	Modyfied by info@hrady.cz for freeze position when tool window reach right border
	INSERT TO element:
	onMouseover="ddrivetip('your text')"; onMouseout="hideddrivetip()"
	INSERT TO STYLE file:
	#dhtmltooltip{
	Remove below line to remove shadow. Below line should always appear last within this CSS
	filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);
	*/
document.write('<div id="dhtmltooltip" style="position:absolute;border:1px solid Silver;color:Gray;background:#F0F0F0;padding:2px;z-index:100;width:250px;visibility:hidden;text-align:left;filter:progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);"></div>');
document.write('<iframe src=blank.html name=infoOverBox id=infoOverBox width=10 height=10 style="display:none;position:absolute;z-index:auto;"></iframe>');
var offsetxpoint = 20 //Customize x offset of tooltip
var offsetypoint = 20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
	if (ns6||ie){
	if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
	tipobj.innerHTML=thetext;
	enabletip=true
	return false
	}
}

function positiontip(e){
if (enabletip){

var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint -20
var leftedge = (offsetxpoint < 0) ? offsetxpoint * (-1) : -500

//if the horizontal distance isn't enough to accomodate the width of the context menu
scrollX = (document.all)?document.body.scrollLeft:window.pageXOffset; 
var dif = tipobj.offsetWidth - rightedge - scrollX;

if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
if (ie){
	var stayPos = event.clientX - dif + offsetxpoint;
	tipobj.style.left =  stayPos + "px" ;
}else{
	var stayPos = e.clientX - dif + offsetxpoint;
	tipobj.style.left = stayPos + "px";
}

else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"
//same concept with the vertical position
	//alert (curY+ ", " +offsetypoint);
	if (bottomedge<tipobj.offsetHeight)
		tipobj.style.top= ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+10+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
	else
	tipobj.style.top=curY+offsetypoint +"px"
	tipobj.style.visibility="visible"
	}
}

function hideddrivetip(){
	if (ns6||ie){
	enabletip=false
	tipobj.style.visibility="hidden"
	}
}
document.onmousemove=positiontip
