
var status;
var isMouseDown = false;
var beginX;
var beginY;

// Stop drag and drop operation.
function onMouseUp(sender, mouseEventArgs)
{
    isMouseDown = false;

    // Allow all objects to receive mouse events.
    sender.releaseMouseCapture();
}

// Start drag and drop operation.
function onMouseDown(sender, mouseEventArgs)
{
    // Set the beginning position of the mouse.
    beginX = mouseEventArgs.x;
    beginY = mouseEventArgs.y;

    isMouseDown = true;

    // Ensure this object is the only one receiving mouse events.
    sender.captureMouse();
}

// Reposition object during drag and drop operation.
function onMouseMove(sender, mouseEventArgs)
{
    // Determine whether the mouse button is down.
    // If so, move the object.
    if (isMouseDown == true)
    {
        // Retrieve the current position of the mouse.
        var currX = mouseEventArgs.x;
        var currY = mouseEventArgs.y;

        // Reset the location of the object.
        sender["Canvas.Left"] += currX - beginX;
        sender["Canvas.Top"] += currY - beginY;

        // Update the beginning position of the mouse.
        beginX = currX;
        beginY = currY;
    }
}

function handleParseError(line, col, hr, string)
{
	alert(string + " at: " + line + ", " + col);
}