title: toggle class when two elements have swapped places?
body: <p>Im using jquery to move divs either up or down, which is part of a ranking system, so I need the ranking classes to stay the same depending on whether the div is either first, second, third and so on...
  The top div should always have class first, second div class equals second etc etc...
  Any help much appr.</p>
  
  <p>html:</p>
  
  <pre><code>&lt;div class="top5 first"&gt;
      &lt;div class="voter"&gt;
          &lt;a class="up" href="#"&gt;up&lt;/a&gt;
          &lt;a class="down" href="#"&gt;down&lt;/a&gt;
      &lt;/div&gt;                    
  &lt;/div&gt;
  
  
  &lt;div class="top5 second"&gt;
      &lt;div class="voter"&gt;
          &lt;a class="up" href="#"&gt;up&lt;/a&gt;
          &lt;a class="down" href="#"&gt;down&lt;/a&gt;
      &lt;/div&gt;                    
  &lt;/div&gt;
  
  &lt;div class="top5 third"&gt;
      &lt;div class="voter"&gt;
          &lt;a class="up" href="#"&gt;up&lt;/a&gt;
          &lt;a class="down" href="#"&gt;down&lt;/a&gt;
      &lt;/div&gt;                    
  &lt;/div&gt;
  </code></pre>
  
  <p>jquery:</p>
  
  <pre><code> $('.up').click(function() {
          var parent = $(this).parent().parent();
          parent.insertBefore(parent.prev());
  
      });
      $('.down').click(function() {
          var parent = $(this).parent().parent();
          parent.insertAfter(parent.next());
  
      });
  </code></pre>