How to optimize the jQuery code for click()
<p>How could i optimize the following jQuery Code?</p>

<pre><code>var $open = $('#open'),
        $panel = $('div#panel'),
        $close = $('#close'),
        $switch = $('#toggle');
$open.click(function(){
    $panel.slideDown('slow');
});
$close.click(function(){
    $panel.slideUp('slow');
});
$switch.children('p').click(function(){
    $switch.children('p').toggle();
});
$close.css({'display':'none'});
</code></pre>

<p>I think there is a much better way to write this.</p>

<p>This is the HTML-Code it belongs to.</p>

<pre><code>&lt;div class="tab"&gt;
  &lt;ul class="login"&gt;
    &lt;li class="left"&gt;&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;&amp;nbsp;&lt;/li&gt;
    &lt;li id="toggle"&gt;
      {if $smarty.session.customer_id}
      &lt;a id="open" class="open" href="{$logoff}" title="{#link_logoff#}"&gt;{#link_logoff#}&lt;/a&gt;{else}&lt;p id="open" class="open"&gt;{#link_login#}&lt;/p&gt;
      {/if}
      &lt;p id="close" class="close"&gt;Schließen&lt;/p&gt;         
    &lt;/li&gt;
    &lt;li class="right"&gt;&amp;nbsp;&lt;/li&gt;
  &lt;/ul&gt; 
&lt;/div&gt;
</code></pre>
