Replace Picture Source (Adding)
<p>What i wish to do is have a div containing a image, when a button/mini picture is pressed the image's source will change from 1-2 2-3, etc adding 1 each time. This needs to go both ways:
i.e Right Arrow: 1.jpg 2.jpg Left Arrow 3.jpg 2.jpg Now the script also needs to include a IF statement so if the picture doesn't exist the button will be visibility: hidden; in css. Something like IF picture source 5.jpg + 1 doesn't exist #mini img visibility: hidden;
Currently i had an idea i could use something not the same but similar to this (jQuery). I used this script previously to change a image on hover, i figure i could change it onclick and use something similar.</p>

<pre><code>$(function() { $('#buttons #right img').each(function() {
var originalSrc = this.src,
   hoverSrc = originalSrc.replace(/\.(gif|png|jpe?g)$/, '_over.$1'); 
   image = new Image();

image.src = hoverSrc;

$(this).hover(function() {
  image.onload = function() {
}
  this.src = hoverSrc;
}, function() {
   this.src = originalSrc;
});
});
})
</code></pre>
