Anonymous classes in my javascript
<p>I have the following code:</p>

<pre><code>var modal = $.modal({
                        title: title,
                        closeButton: true,
                        content: content,
                        width: 1000,
                        maxHeight: 850,
                        resizeOnLoad: true,
                        buttons: {
                            'Submit': function (win) {
                                submitHandler($link, $('#main-form'));
                            },
                            'Submit &amp; Close': function (win) {
                                var rc = submitHandler($link, $('#main-form'));
                                if (rc == true) { win.closeModal(); }
                            },
                            'Close': function (win) {
                                win.closeModal();
                            }
                        }
                    });
</code></pre>

<p>What I would like to do is have a different set of buttons depending on the type of modal window that is being created. I tried to do this using the following code but I get an error:</p>

<pre><code>                    if (title.substr(0, 4) == "Crea") {
                        title += $('#RowKey').val();
                        var btns = btns1;
                    }
                    if (title.substr(0, 4) == "Edit") {
                        var btns = btns1;
                    }
                    if (title.substr(0, 4) == "Dele") {
                        var btns = btns2;
                    }
                    var btns1 = new {
                        'Submit': function (win) {
                            submitHandler($link, $('#main-form'));
                        },
                        'Submit &amp; Close': function (win) {
                            var rc = submitHandler($link, $('#main-form'));
                            if (rc == true) { win.closeModal(); }
                        },
                        'Close': function (win) {
                            win.closeModal();
                        }
                    }
                    var btns2 = new {
                        'Submit &amp; Close': function (win) {
                            var rc = submitHandler($link, $('#main-form'));
                            if (rc == true) { win.closeModal(); }
                        },
                        'Close': function (win) {
                            win.closeModal();
                        }
                    }
                    var modal = $.modal({
                        title: title,
                        closeButton: true,
                        content: content,
                        width: 1000,
                        maxHeight: 850,
                        resizeOnLoad: true,
                        buttons: btns
                    });
</code></pre>

<p>The error that I get is on the line:</p>

<pre><code>var btns1 = new {
</code></pre>

<p>Error message is:</p>

<pre><code>Object doesn't support this action
</code></pre>

<p>I guess there is something wrong with the way I make the assignment but I am not sure how to do this. I hope someone can help me out.</p>

<p>Can someone help me by telling me what I am doing wrong. </p>
