﻿var tempX = 0;
var tempY = 0;
var xPos = 0;
var yPos = 0;
function getMouseXY(e) {
    try {
        if (IE) { // grab the x-y pos.s if browser is IE
            tempX = event.clientX + document.body.scrollLeft;
            tempY = event.clientY + document.body.scrollTop;
        }
        else {  // grab the x-y pos.s if browser is NS
            tempX = e.pageX;
            tempY = e.pageY;
        }
        if (tempX < 0) { tempX = 0; }
        if (tempY < 0) { tempY = 0; }

        if (tempX > xPos && tempY == yPos) {
            position = "LR";
            document.getElementById("lbl").innerHTML = "Right";
        }
        else if (tempX < xPos && tempY == yPos) {
            position = "LR";
            document.getElementById("lbl").innerHTML = "Left";
        }
        else if (tempY > yPos && tempX == xPos) {
            position = "TB";
            document.getElementById("lbl").innerHTML = "Bottom";
        }
        else if (tempY < yPos && tempX == xPos) {
            position = "TB";
            document.getElementById("lbl").innerHTML = "Top";
        }
        xPos = tempX;
        yPos = tempY;
    } catch (err)
            { }
    return true;
}
