<script type="text/javascript">
var images = new Array();
var i = 0;
images[0] = 'images/1.jpg';
images[1] = 'images/2.jpg';
images[2] = 'images/3.jpg';
function lol() {
i = i-1;
if (i < 0) {
i = images.length-1;
}
document.getElementById("img_main").src = images[i];
};
function viewImages() {
i = i+1;
if (i == images.length) {
i = 0;
}
document.getElementById("img_main").src = images[i];
};
</script>
Вот так то что нужно... СПС Viral