Refactoring jQuery/JavaScript code for showing/hiding a large number of modal windows
<p>I have many of these functions at the moment:</p>

<pre><code>function show_foo() {
   $('.modal').hide(); // hide all modals
   $('#foo').show(); // show the foo modal
}

function show_bar() {
   $('.modal').hide();
   $('#bar').show();
}
</code></pre>

<p>The trouble is that I have about 10 of these functions and it looks clumsy.  Is there some more elegant way to do this sort of thing?</p>

<p>Many thanks.</p>
