Hi,

I currently have a image button that does a dropmenu onclick. However, I need to be able to close the menu when user click on outside of the image (so i use document.onmousedown to capture the event). Everything went well, except now that when the user click on the image itself "again" when the menu is open, i'd want it to close the menu but instead, once you click on the image, the document.onmousedown event will close the menu first and then reopen the menu. The simpler sense, it is currently conflicting with document.onmousedown event.

The full code is here (Hope someone have any ideas?):

PHP Code:
function showuserinputObj )
{
    if( $(
'usermenu').style.display == 'none' )
    {
        $(
'usermenu').style.position 'absolute';
        $(
'usermenu').style.display 'block';
        
        var 
leftPos = (getLeftPos(inputObj) - 38);
        var 
topPos  =  getTopPos(inputObj) + 30;
        
        $(
'usermenu').style.left leftPos 'px';
        $(
'usermenu').style.top  topPos  'px';
    }
    
    
document.onmousedown = function( )
    {
        
hideUserMenu( );
        return;
    }
}

function 
hideUserMenu( )
{
    $(
'usermenu').style.display 'none';