Conditional Toggle of Class using JQUERY
<pre><code>$('.showall').css("cursor","pointer").click(function() {

  $('.value-container').toggle();

  $('.dim-header').toggleClass($('.dim-header').toggleClass() == 'dim-header' ? 'dim-header active' : 'dim-header');

  $('.showall').html($('.showall').html() == '+ Expand All' ? '- Hide All' : '+ Expand All');

  return false;
});
</code></pre>

<p>I have a series of boxes that I let users expand and collapse at will.  The JQUERY for that works great and the box gets a class of 'active' added to it upon expand and has that class removed upon collapse.</p>

<p>I have a link that fires off the code above that toggles all the boxes to expand or collapse and changes the header image to switch from + to -.</p>

<p><strong>My problem is that if someone has a box or two expanded already before clicking the expand all or collapse all, the toggle won't force ALL the boxes to expand or collapse, the ones already expanded or collapsed do the opposite of the others.
I think I need to check to see if the 'active' class is present and if so, either add expand to all or remove from all so the toggle does not get the boxes out of sync...</strong></p>

<p>Can anyone help me with the logic to do this?  I think I am close...</p>

<p>Thanks!</p>
