[jQuery] UI Dialog help with show dialog

[jQuery] UI Dialog help with show dialog


Hi, i have this function:
function showSendMessage(id){
$('#sendMessage').dialog({modal: true,overlay:{opacity:
0.5,background: "black"},title: 'Kontaktovat uživatele'});
//$('#sendMessage').dialog('open');
        $('#sendMessage').css({ display:"block"});
        $('#ClientsRecipientId').attr({ value: id});
    }
this function is use when i click on some buttons (onclick). If I
click on buttone once dialog will be show i close dialog, after second
click on button will be not show.
So i try correct function:
function showSendMessage(id){
$('#sendMessage').dialog({modal: true,overlay:{opacity:
0.5,background: "black"},title: 'Kontaktovat uživatele'});
$('#sendMessage').dialog('open');
        $('#sendMessage').css({ display:"block"});
        $('#ClientsRecipientId').attr({ value: id});
    }
Its quite ok, i can click on buttone how often i want and dialog will
show but when i click on cross icon (close dialog) overlay forever
show and i cant click anywhere.
THX for your advice. Sorry my english isn very good.