 isVisible = (element, vcoords)->
     return rectIntersect(innerRect(element), vcoords) and element.css('visibility') != 'hidden'
 
+xpath = (expr, document)->
+    elems = []
+    res = document.evaluate(expr, document, null, XPathResult.ANY_TYPE, null)
+    elems.push elem while elem = res.iterateNext()
+    return elems
+
 class UsHints
     constructor: (@document)->
         @container = null

        win = @document.defaultView
        vcoords = [win.pageYOffset, win.pageYOffset + win.innerHeight,
            win.pageXOffset, win.pageXOffset + win.innerWidth]
        elems = (elem for elem in $(expr, @document).filter(':visible') when isVisible($(elem), vcoords))

        # How many letters do we need ?
        curHint = [0]

config =
    defaultExpr: "//a[@href or @onclick or @oncommand] | //input[@type='button' or @type='submit' or @type='radio' or @type='checkbox']"
    formExpr: "//input[@type='text' or not(@type) or @type='password'] | //textarea | //select"
    keys: 'abcdefghijklmnopqrstuvwxyz'
    hintClass: 'ushints_hint'
    selectedHintClass: 'ushints_hint ushints_sel_hint'
