/*************************************************/
/* tooltip.js                                    */
/*                                               */
/* V1.0 01.06.2007 Ausgabe von Tooltips,         */
/*  getestet auf Firefox 2.0, Opera 9.21, IE 6   */
/*                                               */
/*************************************************/

var wmtooltip = null;
var posttx = 20; // Korrektur Position Tooltip X-Richtung 
var postty = -20; // Korrektur Position Tooltip Y-Richtung 
var posx, posy;
var scrollx, scrolly;

document.onmousemove = updateToolTip;

function updateToolTip(e)
{
 if ( self.pageYOffset )
 {
  scrollx = self.pageXOffset;
  scrolly = self.pageYOffset;
 }
 else if ( document.documentElement && document.documentElement.scrollTop )
 {
  scrollx = document.documentElement.scrollLeft;
  scrolly = document.documentElement.scrollTop;
 }
 else if ( document.body )
 {
  scrollx = document.body.scrollLeft;
  scrolly = document.body.scrollTop;
 }
	
 posx = (document.all) ? window.event.x + scrollx : e.pageX;
 posy = (document.all) ? window.event.y + scrolly : e.pageY;

 var correct = posx - ( ( getWindowWidth() - 0 ) / 2 );
	 
 if ( correct > 800 )
 {
  posttx = -230;
 }
 else
 {
  posttx = 20;
 }

 if (wmtooltip != null)
 {
  wmtooltip.style.left = ( posx + posttx ) + "px";
  wmtooltip.style.top  = ( posy + postty ) + "px";
 }
}

function showToolTip(id)
{
 wmtooltip = document.getElementById(id);
 wmtooltip.style.display = "block"
 wmtooltip.style.left = ( posx + posttx ) + "px";
 wmtooltip.style.top  = ( posy + postty ) + "px";
}

function hideToolTip(id)
{
 wmtooltip = document.getElementById(id);
 wmtooltip.style.display = "none"
 wmtooltip.style.left = ( posx + posttx ) + "px";
 wmtooltip.style.top  = ( posy + postty ) + "px";
}

function getWindowWidth()
{
 if ( window.innerWidth ) return window.innerWidth;
 else if ( document.body && document.body.offsetWidth ) return document.body.offsetWidth;
 else return 0;
}

function getWindowHeight()
{
 if ( window.innerHeight ) return window.innerHeight;
 else if ( document.body && document.body.offsetHeight ) return document.body.offsetHeight;
 else return 0;
}
