title: swapping title for jQuery accordion if accordion is opened or closed
body: <p>I am 95% finished with this (I hope). I am working on an accordion function that changes the text in the head of the accordion depending if the accordion is opened or closed. (I've got a plus and minus image working). </p>
  
  <p>At present if the client clicks on the accordion to open and close it the title changes correctly, but if the client opens a different accordion the original accordion will slide up, but the title is not updated. I've tried a couple of options I thought would work, but no success as yet. </p>
  
  <p>I've made a jsfiddle <a href="http://jsfiddle.net/lharby/Jknxh/" rel="nofollow">here</a></p>
  
  <p>jquery is:</p>
  
  <pre><code> $(document).ready(function() {
  // accordion functionality 
  $('.accordion-head').click(function(e){
      var content = $(this).parent().find('.accordion-content');
      var head = $(this).parent().find('.accordion-head');
      var $showMore = "Show me more";
      var $hideContent = "Hide this offer";            
  
      content.addClass('actual');
  
      $('.accordion-content').not('.actual').each(function(){
          if ($(this).hasClass('accordion-opened')){
              $(this).slideUp(200,function(){
                  $(this).toggleClass('accordion-opened');
                  $(this).parent().find('.accordion-head').toggleClass('accordion-open');
              });
          }
      });
  
      $(this).toggleClass('accordion-open');
      content.removeClass('actual');               
  
      if($(this).hasClass('accordion-open')){
          content.slideDown(200,function(){
              content.toggleClass('accordion-opened');
              head.html($hideContent);
          });
      }else{
          content.slideUp(200,function(){
              content.toggleClass('accordion-opened');
              head.html($showMore);
          });
      }
      e.preventDefault();
     });
  
   });​
  </code></pre>
  
  <p>HTML looks like this:</p>
  
  <pre><code>  &lt;div class="accordion"&gt;
           &lt;div class="accordion-head"&gt;
                          &lt;a href="#"&gt;
                             &lt;span class="accordion-heading"&gt;Show me more&lt;/span&gt;
                          &lt;/a&gt;
                      &lt;/div&gt;
                      &lt;div class="accordion-content"&gt;
                          Including Thames Water, Severn Trent, Anglian Water, Yorkshire Water and many more, plus all council tax local authorities. Cashback on mortgage payments up to maximum monthly mortgage payment of £1,000.
                      &lt;/div&gt;
                  &lt;/div&gt;
  
  
                  &lt;span class="spacer"&gt;&lt;/span&gt;
  
                  &lt;div class="accordion"&gt;
                      &lt;div class="accordion-head"&gt;
                          &lt;a href="#"&gt;
                              &lt;span class="accordion-heading"&gt;Show me more&lt;/span&gt;
                          &lt;/a&gt;
                      &lt;/div&gt;
                      &lt;div class="accordion-content"&gt;
                          Including British Gas, SSE, EDF Energy, E.ON, npower and many more.
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;span class="spacer"&gt;&lt;/span&gt;
              etc.
  </code></pre>
  
  <p>Hope someone can help. </p>