Add a more comprehensive mousePos method to solve positioning issues in Firefox