var dropdownIdx = 0;
var dropdownTimer;

function showDropDown(ctrl, idx)
{
	var dd = document.getElementById('dropdown' + idx);
	var menu = document.getElementById('menu' + idx);
	
	if(dd==null || menu==null)
		return;
		
	if(idx!=dropdownIdx)
		hideDropDown();
		
	clearTimeout(dropdownTimer);
	
	dd.style.top = (findTopOfControl(ctrl) + ctrl.offsetHeight) + "px";
	dd.style.left = (findLeftOfControl(ctrl) - 0) + "px";
	dd.style.display = "block";
	
	dropdownIdx = idx;
}

function startHideDropDown()
{
	dropdownTimer = setTimeout(hideDropDown, 100);
}

function hideDropDown()
{
	var dd = document.getElementById('dropdown' + dropdownIdx);
	var menu = document.getElementById('menu' + dropdownIdx);
	
	if(dd==null || menu==null)
		return;
		
	dd.style.display = "none";
	menu.className = "";
}