Chaned the cD.js file to return a contructor rather than create an objec...

...t.

Now the DialogManger is responsible for creating a CwrcDialog object and
passing it on to the dialogs that need a reference to it.

Also some code formatting.