offSetLeft=0;
offSetTop=0;

lastShown='';
timer='';


function show(elemID, parentID)
{
if (lastShown) hideElem(lastShown);

lPos = relPosX(parentID)+offSetLeft;
tPos = relPosY(parentID)+offSetTop;

poseElem(elemID, tPos, lPos);
showElem(elemID);
lastShown = elemID;
waitHide();
}


function poseElem(elemId, eTop, eLeft)
{
document.getElementById(elemId).style.top=eTop;
document.getElementById(elemId).style.left=eLeft;
}


function hide()
{

if (lastShown) 
	{
	elem = document.getElementById(lastShown);
	if (elem.locked) return 0;
	hideElem(lastShown);
	}
	
lastShown = '';

if (timer) clearTimeout(timer);
}


function waitHide()
{
if (timer) clearTimeout(timer);
timer = setTimeout("hide()", 1500);
}


function colorChange(elem) {
elem.style.backgroundColor = elem.getAttribute('selColor');
elem.style.color = elem.getAttribute('bgColor');
}

function colorBack(elem) {
elem.style.backgroundColor = elem.getAttribute('bgColor');
elem.style.color = elem.getAttribute('selColor');
}


function menuLock(elemId)
{
document.getElementById(elemId).locked=1;
}

function menuUnlock(elemId)
{
document.getElementById(elemId).locked=0;
waitHide();
}
