how to remove dragged element?

how to remove dragged element?


Hi all,
I have images created by such function:
function addImage(filename, width, left, top) {
    div = document.getElementById('ticket_canvas');
    var newImg = document.createElement('img');
    newImg.setAttribute('id', '_img_'+i);
    newImg.setAttribute('src', 'tmp/'+filename);
    div.appendChild(newImg);
    // http://aleembawany.com/2009/01/25/jquery-resizable-draggable-bug-workaround/
    //http://abeautifulsite.net/notebook/68
    $('#_img_'+i)
        .css('width', width)
        .resizable({aspectRatio: true})
        .parent('.ui-wrapper')
        .draggable({ containment: 'parent' })
        .css('position', 'absolute')
        .css('top', top)
        .css('left', left)
        .rightClick(function(e) {this.remove();}
        )
        ;
    i++;
}
My question is: how to remove image, that has been right-clicked?? The
above right-click-event code does not work... I also tried
this.parent.remove(), with no success either...
And a second question: images created this way have sometimes
disturbed aspect-ratio, i.e. they are getting "square" shape insted of
the original aspect ratio. Next time I load the same image, it works
OK. I'm using Firefox 3.0.7 on Windows.
TIA, md23128