How to make the menu pop-UP

How to make the menu pop-UP

I am using jquery ui menu, it works nice, pops down as supposed. Is there a way to tell it to pop up?

Bonus question: is there anyone who managed to do this: by default pop down, but if there's not enough place (the bottom of the list would be invisible) then pop up?