fixed dialog problem, the context was wrong, moved onlclick listeners to their own functions and into the onreasum