Please see this test page:

The issue is that the co-ordinates do not change correctly on the stop dragging event 'mouse up'

I have offset the margin of the window so that the change in margin can change the margin can be used to change the x,y by the number of pixels that have been 'dragged' , and even if I modify the pixels by the reolution of the imagery displayed it still doesn't work, perhaps this is a rounding issue.

function up()
var oldx = x;
var sm = -250;
dragging = false;
var xm = parseFloat($('#viewerWindow').css('margin-left'));
var ym = parseFloat($('#viewerWindow').css('margin-top'));
var baseRes = parseFloat($(xml).find("layer").eq(d).attr("resolution"))/100;
var sizem = parseFloat($(xml).find("layer").eq(d).find("size").eq(s).attr("m"));

y = y + (ym-sm);
x = x - (xm+sm);

$("#q").val(x +","+ y +","+baseRes);