function getPageElement(name)
{
   var el = null;
   if (document.getElementById)
   {
      el = document.getElementById(name);
   }
   return(el);
}

function showPopupDivId(divId, zobraz, obj, width) 
{
   var divEl = getPageElement(divId);
   if (divEl != null)
   {
      var text = divEl.innerHTML;
      showPopupDiv(text, zobraz, obj, width);
   }
}

function showPopupDiv(text, zobraz, obj, width) 
{	
	if (!width || width == null) width = "250";

   var infoPopupDiv = getPageElement("infoPopupDiv");
	if (infoPopupDiv == null)
	{
      return;	    
	}
	var infoPopupDivIframe = getPageElement("infoPopupDivIframe");
   
   if (zobraz == false)
   {
   	infoPopupDiv.style.display="none";
   	if (infoPopupDivIframe != null) infoPopupDivIframe.style.display="none";
   	return;
   }
   
   if (!text) return;

	var posX = obj.offsetLeft;
	var posY = obj.offsetTop - 100;
	aTag = obj;
	do
	{
		aTag = aTag.offsetParent;
		if (aTag != null)
		{
			posX += aTag.offsetLeft;
			posY  += aTag.offsetTop;
		}
	} while (aTag && aTag.tagName != 'BODY');
	
	
	if (posX > 600)
	{
	   posX = posX - width;
	   if (obj.offsetWidth) posX = posX + obj.offsetWidth;
	}
	
	//window.status = posX+" y="+posY + " text=" + text;
   infoPopupDiv.style.display="block";
   infoPopupDiv.style.top = posY + "px";
   infoPopupDiv.style.left = posX + "px";   
   
   if (text.length < 50)
   {
   	infoPopupDiv.style.width = "auto";
   }
   else
   {   
   	infoPopupDiv.style.width = width+"px";
   }
   
   infoPopupDiv.innerHTML = text;
   
   if (infoPopupDivIframe != null)
	{
	   infoPopupDivIframe.style.left = infoPopupDiv.style.left;
	   infoPopupDivIframe.style.top = infoPopupDiv.style.top;				
	   infoPopupDivIframe.style.width = infoPopupDiv.offsetWidth + "px";
	   infoPopupDivIframe.style.height = infoPopupDiv.offsetHeight+"px";
	   //window.status = infoPopupDiv.offsetHeight;
	   infoPopupDivIframe.style.display = "block";
	}
}