/**
 * @author Dudin Dima
 */
//------------------->   xpos и ypos содержит координаты мыши (+ добавка 15px к Y) в данный момент времени
var xpos;
var ypoz;
var d = document; 
var offsetfromcursorY=15 // y offset of tooltip
var ie=d.all && !window.opera;
var ns6=d.getElementById && !d.all;
function ietruebody()
{return (d.compatMode && d.compatMode!="BackCompat")? d.documentElement : d.body}
function mousePageXY(e){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20
var rightedge=ie&&!window.opera? winwidth-event.clientX : winwidth-e.clientX;
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY;
if (rightedge<d.getElementById('tooltip').offsetWidth)	x=curX-d.getElementById('tooltip').offsetWidth;
else x=curX;
if (bottomedge<d.getElementById('tooltip').offsetHeight) y=curY-d.getElementById('tooltip').offsetHeight-offsetfromcursorY;
else y=curY+offsetfromcursorY;	
return {"x":x, "y":y};}
document.onmousemove = function(e){xpos = mousePageXY(e).x;ypos = mousePageXY(e).y;}
//-------------------->
