Bug 1077044 - Store previous cursor position when dialog pops up, and restore it when it is hidden. r=yzen