var x = -185;  
var y = -37;  
function getScrollTop() {
	var scrollTop = 0;
	if (document.documentElement && document.documentElement.scrollTop) {
		scrollTop = document.documentElement.scrollTop;
	} else if (parent.document.body) {
		scrollTop = document.body.scrollTop;
	}
	return scrollTop;
}
function findDimensions() {
	if (window.innerHeight)
		winHeight = window.innerHeight;
	else if ((document.body) && (document.body.clientHeight))
		winHeight = document.body.clientHeight;
	if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
		winHeight = document.documentElement.clientHeight;
	}
	return winHeight;
}

function mousePosition(ev, tall, width) {
	ev = ev || window.event;
	var _dimensions = findDimensions();
	var mainshow = parseInt(_dimensions + parseInt($(".jspPane").css("top")) - ev.pageY);
    var Top, Left;
    if (mainshow < tall) {
    	Top = parseInt(ev.pageY - tall) ;
    } else {
    	Top = parseInt(ev.pageY + 7);
    }
    var mainshow = document.body.scrollWidth + x;
    if (mainshow - ev.pageX < width) {
    	Left = parseInt(ev.pageX - width + 14);
	} else {
		Left = parseInt(ev.pageX + 27);
	}
    return {
        t: Top, l: Left
    }
}