
/* popups.js */

//open menu with given ID
function openMenu(menuID,linkObj,themenutype)
{
    //if the menu code is ready
    if(um.ready)
    {

        //find co-ordinates of link object
        var coords = {
        'x' : um.getRealPosition(linkObj,'x'),
        'y' : um.getRealPosition(linkObj,'y')
        };
        
        // open to right
        if (themenutype == "right") {
            //increase y-position to place it below the link
            coords.y += (linkObj.offsetHeight + 5);
        
            //position to place it in the x offset of link
            coords.x += (linkObj.offsetWidth + 5);

        } else {
            //increase y-position to place it below the link
            coords.y += (linkObj.offsetHeight - 7);
        }
        
        // open below
        //activate menu at returned co-ordinates
        um.activateMenu(menuID, coords.x + 'px', coords.y + 'px');
    }
}

//close menu with given ID
function closeMenu(menuID)
{

    //if the menu code is ready
    if(um.ready)
    {
        //deactive menu
        um.deactivateMenu(menuID);
    }

}
