//
// popupToggle()
//

function popupToggle(t,e)
{
	if (e.style.visibility=='visible')
	{
		popupHide(t,e);
	}
	else
	{
		popupShow(t,e);
	}
}

//
// popupShow()
//

function popupShow(t,e)
{
	e.style.position='absolute';
	e.style.zIndex='10';

	_moveTo(e, _getXPos(t), _getYPos(t) + t.offsetHeight); 

	e.style.visibility='visible';
	e.style.display='block';
}

//
// popupHide()
//

function popupHide(t,e)
{
	e.style.visibility='hidden';
	e.style.display='none';
}

//
// _moveTo()
//

function _moveTo(e,x,y)
{
	e.style.left = x + 'px';
	e.style.top = y + 'px';
}

//
// _getXPos()
//

function _getXPos(e)
{
	if (e.x)
	{
		return e.x;
	}

	var res = 0;
	
	while(e.offsetParent)
	{
		res+=e.offsetLeft;
		e = e.offsetParent;
	}

	return res;
}

//
// _getYPos()
//

function _getYPos(e)
{
	if (e.y)
	{
		return e.y;
	}

	var res = 0;
	
	while(e.offsetParent)
	{
		res+=e.offsetTop;
		e = e.offsetParent;
	}

	return res;
}