 function getClientWidth()  
 {  
   return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;  
 }  
   
 function getClientHeight()  
 {  
   return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;  
 } 

function getElementComputedStyle(elem, prop)
{
  if (typeof elem!="object") elem = document.getElementById(elem);
  
  // external stylesheet for Mozilla, Opera 7+ and Safari 1.3+
  if (document.defaultView && document.defaultView.getComputedStyle)
  {
    if (prop.match(/[A-Z]/)) prop = prop.replace(/([A-Z])/g, "-$1").toLowerCase();
    return document.defaultView.getComputedStyle(elem, "").getPropertyValue(prop);
  }
  
  // external stylesheet for Explorer and Opera 9
  if (elem.currentStyle)
  {
    var i;
    while ((i=prop.indexOf("-"))!=-1) prop = prop.substr(0, i) + prop.substr(i+1,1).toUpperCase() + prop.substr(i+2);
    return elem.currentStyle[prop];
  }
  
  return "";
}

function getAbsolutePos(el)
	{
	var r = { x: el.offsetLeft, y: el.offsetTop };
	if (el.offsetParent)
		{
		var tmp = getAbsolutePos(el.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
		}
	return r;
	}


function show_entry_link(popupElement,e,disp,deltay,ParentElement,img_size) {     
  var x = 0, y = 0;
  
  doc_y = getClientHeight();
  
  doc_x = 1000;  
   	
  if (!img_size) img_size = 300;
  if (!e) e = window.event;

  if (e.pageX || e.pageY)
  {
    x = e.pageX;	
    y = e.pageY;
    x_otn = x;    
    if (e.clientX)
      x_otn = e.clientX;    
    y_otn = y;     
    if (e.clientY)
      y_otn = e.clientY;      
  }
  else if (e.clientX || e.clientY)
  {
    x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;    
    y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
    x_otn = x;    
    if (e.clientX)
      x_otn = e.clientX;    
    y_otn = y;     
    if (e.clientY)
      y_otn = e.clientY;
  }

  
  Par = getAbsolutePos(document.getElementById(ParentElement));
  	y = y_otn;
  	  img_width = document.getElementById(popupElement).clientWidth;
  	  img_height = document.getElementById(popupElement).clientHeight;
  	  if (!img_width)
  	     img_width = img_size;
  	  if (!img_height)
  	     img_height = img_size;
	  if (x) {
	  
	  /*	    
	  if (Par.x)
	    x -=  Par.x - 15;
	  */
	 
	  x +=  15;
	  x_bot = x_otn + img_width + 20;
	  
	  if (x_bot > doc_x) 
	    x -= img_width + 20;  
	 
	  
	  document.getElementById(popupElement).style.left=x+'px';	  	  
	 
	  }
	  if (y) {

	  if (deltay==0) {	
	  y_bot = y_otn + img_height + 20;
	  
	  if (!doc_y) doc_y=700;
	  if (doc_y>1000) doc_y=700;
	  
	  if (y_bot > doc_y) 
	    y -= img_height + 20;	  
	  }
	  /*if (Par.y)
	    y -=  Par.y - 15;
	    */
	    y += 15;
	  /* y -=deltay;*/ 
	   
	  document.getElementById(popupElement).style.top=y+'px';
	  }
	  if (disp) {
	  	if (typeof document.body.style.maxHeight != "undefined")	{
			document.getElementById(popupElement).style.position = 'fixed';
			document.getElementById(popupElement).style.display = disp;  
		}
		else {
			document.getElementById(popupElement).style.position = 'absolute';
			document.getElementById(popupElement).style.top='0px';
			document.getElementById(popupElement).style.left='0px';		
			document.getElementById(popupElement).style.display = 'none';  	
		}
      	
      }

 
}

function show_entry_link_popup(popupElement) {

      if (document.getElementById(popupElement).style.display == "none") {
      document.getElementById(popupElement).style.display = "block";

      } else if (document.getElementById(popupElement).style.display == "block") {
      document.getElementById(popupElement).style.display = "none";

  }
}