Dialog : id of the trigger element

Dialog : id of the trigger element

Hi,
I'm a new user of jquery and jqueryui.
How can i get the id of the element which fired the modal box when i
click on one of the box's button ?
$("#dialog").dialog({
            bgiframe: true,
            resizable: false,
            height:140,
            modal: true,
            buttons: {
                'Sure ?': function() {
                    // I would like to get the id of the element which open the modal
box
                },
                Cancel: function() {
                    $(this).dialog('close');
                }
            }
        });
$('.buttons').click(function(e){
e.preventDefault();
$('#dialog').dialog('open');
});
<img src='img1' id='i1' class=".buttons" alt="test" /> <img src='img1'
id='i2' class=".buttons" alt="test" /> <img src='img1' id='i3'
class=".buttons" alt="test" />
When i click on this image i would like to use the id of the element
in the abstract function wich define the action of the button.
Any idea ?
Thanks
--