how to deal with an undefined query variable
<p>I have the following to launch dialogs in my app:</p>

<pre><code>$('.dialogDo').live('click', function() {

    // Do we have a custom width?
    var width = this.search.match(/width=(\d+)/)[1];
    if (width) {
        dialogDo(this.href, width);
    }
    else {
        dialogDo(this.href, 480);
    }

    return false;
});
</code></pre>

<p>This works fine if width is defined in the href which trigger the click function above. Problem is if width is not defined it breaks. How can I deal with an undefined width while still maintaining the functionality to use a width if provided?</p>

<p>Thanks</p>
