Updated findxy to find the current cursor position without using the document size

A fix for the firefox issue mentioned in #1