title: Conditional If statements within jQueryUI's options?
body: <p>I have a JavaScript function that I'm passing an argument to, that opens a jQueryUI Dialog. I want the dialog to have either one or two buttons, based on the value of the argument. How should I do this?</p>
  
  <p>So far I've tried:</p>
  
  <pre><code>function foo(hasFile) {
      $('#dialog').dialog({
          buttons: {
              Close: function() { $(this).dialog('close'); },
              if (hasFile)
                  "Download": // do something
      }
      });
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>function foo(hasFile) {
      $('#dialog').dialog({
          buttons: 
              if (hasFile)
              {
                  "Download": // do something
                  Close: function() { $(this).dialog('close'); }
              }
              else
              {
                  Close: function() { $(this).dialog('close'); }
              }
      });
  }
  </code></pre>
  
  <p>both of which have thoroughly broken my page.</p>