I am trying to create a simple image slideshow type thing with the Javascript code below, but it is not displaying in my page.
The JavaScript:
Code:
var waiPics = [];
waiPics[0] = 'images/path.jpg';
waiPics[1] = 'images/gorse.jpg';
waiPics[2] = 'images/stream.jpg';
waiPics[3] = 'images/pines.jpg';
waiPics[4] = 'images/stump.jpg';

var picNum = 0;
var picDiv = document.getElementById("main_img");
var time;

function nextPic() {
	if (picNum === waiPics.length) {
		picNum = 0;
	} else {
		picNum += 1;
	}
	picDiv.innerHTML = '<img src="' + waiPics[picNum] + '" title="Waipahihi" alt="Waipahihi">';
    time = setTimeout(nextPic(), 5000);
}
The HTML:
Code:
<div id="main_image">
<script type="text/javascript">
<!-- Begin
nextPic();
//  End -->
</script>
<noscript>
<img src="images/stream.jpg" title="Waipahihi Stream" alt="Waipahihi Stream" />
</noscript>
</div>
Thanks in advance