Make sub-menu open to the left at edge of screen

Added code that makes the sub-menus open to the right if the menu goes
past the left edge of the viewport.