(Basics) goToPrev function according to goToNext?
<p>Hey guys I'm using this script to navigate between anchors with a next and a previous button.</p>

<p>I have this goToNext function and I want the same script for the goToPrev function. I'm pretty sure it's really easy but I tried and can't work it out properly...</p>

<pre><code>var max = 5;
function goToNext() {
    var hash = String(document.location.hash);
    if (hash &amp;&amp; hash.indexOf(/box/)) {
        var newh = Number(hash.replace("#box",""));
        (newh &gt; max-1) ? newh = 0 : void(null);
        document.location.hash = "#box" + String(newh+1); 
    } else {
        document.location.hash = "box1";        
    }
}
</code></pre>

<p>Box is the name of my anchors.
Thanks !</p>
