var canHideDropDown = false; var activeDropDown = null; function showCollDropDown() { if (activeDropDown) return; activeDropDown = document.getElementById('collections_dropdown'); with (activeDropDown) { style.left = document.images.topbar8_pos.offsetLeft + 'px'; style.top = document.images.topbar8_pos.offsetTop + 'px'; style.visibility = 'visible'; } activeDropDown.timer = setInterval(checkHideDropDown, 1000); } function checkHideDropDown() { if (canHideDropDown && activeDropDown) { activeDropDown.style.visibility = 'hidden'; clearInterval(activeDropDown.timer); activeDropDown.timer = null; activeDropDown = null; } }