	document.onmousemove = MouseMove;
	var m_nMouseX = 0;
	var m_nMouseY = 0;
	var m_pDivSmall = null;
	var m_pDivLarge = null; 
	var m_pContainer = null;
	var m_nScrollOffX = 0;
	var m_nScrollOffY = 0;


function ShowTip(pImgDiv, nNo, nWidth, nHeight)
{	HideTip();

	m_pDivSmall = pImgDiv;
	m_pDivLarge = document.getElementById("ttgallerie_div"+nNo);
	/*m_pDivLarge = m_pDivSmall.nextSibling;
	
	if (m_pDivLarge.className != "ttgallerie_img")
		m_pDivLarge = m_pDivLarge.nextSibling;
	
	if (m_pDivLarge.className != "ttgallerie_img")
	{	m_pDivSmall = null;
		m_pDivLarge = null;
		return;	
	}*/
	
	// Container scroll
	var pObj = m_pDivSmall;
	m_nScrollOffX = 0;
	m_nScrollOffY = 0;
	m_pContainer = null;
	while (pObj)
	{	if (pObj.scrollLeft) m_nScrollOffX -= pObj.scrollLeft;
		if (pObj.scrollTop) m_nScrollOffY -= pObj.scrollTop;
		if (pObj.className == "ttgallerie_table") m_pContainer = pObj;
		pObj = pObj.parentNode;
	}
	if (!ie)
	{	m_nScrollOffX += document.body.scrollLeft;
		m_nScrollOffY += document.body.scrollTop;
	}
	
	RefreshPos(nWidth, nHeight);
}

function RefreshPos(nWidth, nHeight)
{	if (m_pDivLarge == null) reurn;
	
	var nXPos = m_nMouseX; // GetAbsX(m_pDivSmall);
	var nYPos = m_nMouseY; // GetAbsY(m_pDivSmall);	
		
	if (nWidth <= 0) nWidth = m_pDivLarge.offsetWidth;
	if (nHeight <= 0) nHeight = m_pDivLarge.offsetHeight;

	var nWinX = GetWindowX();
	var nWinY = GetWindowY();
	var nWinW = GetWindowWidth()-16;
	var nWinH = GetWindowHeight()-16;
	
	//console.log("Win: "+nWinX+" "+nWinY+" "+nWinW+" "+nWinH);
	//console.log("Maus: ")+
	
	// Auf Seite einpassen
	if (nXPos + nWidth > nWinX + nWinW)
		nXPos = nWinX + nWinW - nWidth;
			
	if (nXPos < nWinX) nXPos = nWinX;

	if (nYPos + nHeight > nWinY + nWinH)
		nYPos = nWinY + nWinH - nHeight;

	if (nYPos < nWinY) nYPos = nWinY;
	
	SetPos(m_pDivLarge, nXPos, nYPos);
	m_pDivLarge.style.display = "block";
}

function HideTip()
{	if (m_pDivLarge != null)
	{	m_pDivLarge.style.display = "none";
		m_pDivSmall = null;
		m_pDivLarge = null;
	}
}

function MouseMove(e)
{	m_nMouseX = e? e.pageX : window.event.x;
	m_nMouseY = e? e.pageY : window.event.y;
	
	// Hide?	
	if (m_pDivLarge != null)
	{	var x = GetAbsX(m_pDivSmall);
		var y = GetAbsY(m_pDivSmall)
		var w = GetWidth(m_pDivSmall);
		var h = GetHeight(m_pDivSmall);
		
		x += m_nScrollOffX;
		y += m_nScrollOffY;
		
		if (m_nMouseX < x || m_nMouseX > x+w ||
			m_nMouseY < y || m_nMouseY > y+h)
		{	//x = GetAbsX(m_pDivLarge);
			//y = GetAbsY(m_pDivLarge);
			//w = GetWidth(m_pDivLarge);
			//h = GetHeight(m_pDivLarge);
			//if (m_nMouseX < x || m_nMouseX > x+w ||
			//	m_nMouseY < y || m_nMouseY > y+h)
			{	HideTip();
				//console.log("Hide from Mouse "+x+" "+y+" "+w+" "+h+":"+m_nMouseX+" "+m_nMouseY);
			}
		}				
	}	
	if (m_pDivLarge != null) RefreshPos(-1, -1);
}
