How can I position a Dialog based on the cursor's position?

How can I position a Dialog based on the cursor's position?

When I invoke a div with the "dialog" id like so:

  1. $( "#dialog" ).dialog();

...it displays in the middle of the page.

How can I get it to display elsewhere; specifically, with its NW corner at the tip of the cursor (in the case where I invoke the dialog on a right-click event)?