Dialog buttons disabled

Dialog buttons disabled


Hi all,
I am using a dialog with some buttons in it.
How can I disable the buttons when the dialog appears and enable it
when the user do some needed actions?
Here is the code:
        $(dialog).dialog({
            draggable:false,
            modal:true,
            width:640,
            height:480,
            title:'Upload files',
            close: function(){
                swfu.cancelQueue();
                $('#currentFiles').empty();
            },
            buttons:{
                'Browse': function(){
                    swfu.selectFiles();
                },
                'Upload Files': function(){
                    swfu.startUpload();
                },
                'Cancel': function(){
                    swfu.cancelQueue();
                },
                'Close': function(){
                    $(dialog).dialog('close');
                    $(dialog).dialog('destroy');
                },
            }
        }).show();
Thanks in advice