1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function getPosition(e) {

e = e || window.event;

var cursor = {x:0, y:0};

if (e.pageX || e.pageY) {

cursor.x = e.pageX;

cursor.y = e.pageY;

}

else {

cursor.x = e.clientX +

(document.documentElement.scrollLeft ||

document.body.scrollLeft) -

document.documentElement.clientLeft;

cursor.y = e.clientY +

(document.documentElement.scrollTop ||

document.body.scrollTop) -

document.documentElement.clientTop;

}

return cursor;

}