initialized the dialog
show and hide events on dialog