How to evade negative (-1) result jquery
<p>I'm developing a post slideshow for wordpress on jquery. I got to say I'm no expert and this is my first time working with jquery or javascript.
Everything works perfect the code works just fine the post rotate each x seconds, there is two div's which move post left(previous) or right(next) on click, it works fine but on the first post (0) when you click left (previous) it shows nothing since 0 - 1 = -1 there is no -1 post and what is supossed to show is the last post (4).
I tried if { } else if { } but as I said I'm no expert and I can't find a solution by myself.
Any help is apreciated.
The code...</p>

<pre><code>$("#switch-izquierda").click(
 function() {
 $("#lista-contenedor-rotatorio li:eq("+img_actual+")").fadeOut(1600);
 img_actual = (img_actual -1) % cuenta;
 $("#lista-contenedor-rotatorio li:eq("+img_actual+")").fadeIn(2000);
 });
</code></pre>

<p>The problem is here...</p>

<pre><code> img_actual = (img_actual -1) % cuenta;
</code></pre>

<p>When in first post (0) result is -1 what I need is to show last post(4)</p>

<p>If you got a solution I really appreciate it.</p>
