reworked jquery dialog code