add jquery dialog
refactor code