Prevent DIV from appearing partially outside of the window
<p>I have a DIV popping up at the bottom right of the cursor whenever a user right-clicks on a row in my table. The problem is, if a user right-clicks near the bottom of their browser window, the DIV will pop up  and get cut off where the window ends. </p>

<p>Is there a way to detect if this will happen and if it will, position the DIV above and to the right of my cursor instead?</p>

<p>Forgot to mention!! I'm using <a href="http://www.trendskitchens.co.nz/jquery/contextmenu/" rel="nofollow">this plugin</a>. I don't mind if I need to alter the plugin's source a bit.</p>
