JQuery hide/show divs from accordion
<p>Hi i have a simple accordion set up with jQuery with the HTML structure of:</p>

<pre><code>&lt;div  class="accordion_headings"&gt;Title 1&lt;/div&gt;
&lt;div class="accordion_child"&gt;Accordion Content 1&lt;/div&gt;

&lt;div  class="accordion_headings"&gt;Title 2&lt;/div&gt;
&lt;div class="accordion_child"&gt;Accordion Content 2&lt;/div&gt;
</code></pre>

<p>and this script</p>

<pre><code>$('div.accordion_headings').click(function() {
 $('div.accordion_child').slideUp('normal'); 
 $(this).next().slideDown('normal');
});

$("div.accordion_child").hide();
</code></pre>

<p>Now I also want another div on the page to be swapped out when clicking on any of those accordion links so I added more classes to the links</p>

<pre><code>&lt;div  class="accordion_headings link1"&gt;Title 1&lt;/div&gt;
&lt;div class="accordion_child"&gt;Accordion Content 1&lt;/div&gt;

&lt;div  class="accordion_headings link2"&gt;Title 2&lt;/div&gt;
&lt;div class="accordion_child"&gt;Accordion Content 2&lt;/div&gt;
</code></pre>

<p>and added the div content that I wanted to swap out</p>

<pre><code>&lt;div id="content_1" class="swap"&gt;Content 1&lt;/div&gt;
&lt;div id="content_2" class="swap"&gt;Content 1&lt;/div&gt;
</code></pre>

<p>This is the script I came up with (after sniffing around Stack Oveflow)</p>

<pre><code>$(document).ready(function () {

    var clickHandler = function (link) {
         $('.swap').hide();
         $('#content_' + link.data.id).show();
         $('.selected').removeClass('selected');
         $(this).attr('class','selected');
   }

   $('.link1').bind('click', {id:'1'} ,clickHandler);
   $('.link2').bind('click', {id:'2'} ,clickHandler);

});
</code></pre>

<p>Almost works.. however on clicking on the accordion it now removes the accordion_headings class and destroys my styling... the weird thing is the accordion still works ?  Can someone please help me clean this up. Also how would I animate or use fade?  Would I replace the hide and show with fadeIn fadeOut? Thanks. </p>
