[jQuery] drag element w/o interface library

[jQuery] drag element w/o interface library


Hello,
I'm trying to drag an element without the use of any plugin or
library. The code below works - except when I invoke the mousedown on
an image element.
In that case, the browser seems to think I want to drag the image off
the page.
Is there a way to override that? Again, code below works fine on
elements that aren't images.
isMouseDown = false;
$('#popup').mousedown(function(e){
    isMouseDown = true;
    $(document).mousemove(function(e){
        if(isMouseDown == true){
            // ...moving it around
        }
    });
}).mouseup(function(e){
    isMouseDown = false;
});