JQ UI Dialog: How to Have Multiple Dialog Instances on a Single Page with Good Refactored JS

JQ UI Dialog: How to Have Multiple Dialog Instances on a Single Page with Good Refactored JS

Hi,

Please see my JS Fiddle example to get a better idea of what I'm trying to do.

Take a look at the Javascript section. You'll notice the code is very repetitive. How can I refactor this code so I can add additional dialog boxes to the HTML in the future, without having to change the javascript?

Thanks in advance for your help. And if you you know of another post with the same question, please let me know.