cycle through four list elements, applying an "active" class
<p>I would like to cycle through four li elements that all contain  tags, setting the appropriate  class to "active" and remove the  "active" class.  I'm having a bit of trouble figuring out how to achieve this via jQuery.
HTML:</p>

<pre><code>&lt;ul class="liveMenu"&gt;
 &lt;li id="leftScroll"&gt;&lt;/li&gt;
 &lt;li id="liveButton_1"&gt;&lt;a class="buttons" href="#featured_1"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li id="liveButton_2"&gt;&lt;a class="buttons" href="#featured_2"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li id="liveButton_3"&gt;&lt;a class="buttons" href="#featured_3"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li id="liveButton_4"&gt;&lt;a class="buttons" href="#featured_4"&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li id="rightScroll"&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>jquery:</p>

<pre><code>var index = 0;
$("#rightScroll").click(function(){

 if(index != 3){
  index++;
 } else {
  index = 0;
 }
    //this part is untested, it should work though
    $("a.active").removeClass("active");
 //this is where I am getting hung up
    //I need something like...

    $.each("li.buttons", function(i){
        if(i == index){
            $(this).addClass("active");
        }
    });

 });

$("#leftScroll").click(function(){
 if(index != 0){
  index--;
 } else {
  index = 3;
 }

    $.each("li.items", function(i){
        if(i == index){
            $(this).addClass("active");
        }
    });
 });
</code></pre>

<p>any help would be greatly appreciated.  Thankyou.</p>
