Random Image script with default image shown first

Here’s what I usually use and have been using for years and it works great, just not for this particular purpose. I don’t have a clue when it comes to javascript.

<noscript><img src="no_script_quote.gif" width="406" height="94"/></noscript><script language="javascript">

var delay=6000
var curindex=0

var images=new Array()

	images[0]="quote1.gif"
	images[1]="quote2.gif"
	images[2]="quote3.gif"
	images[3]="quote4.gif"
	images[4]="quote5.gif"

var preload=new Array()

for (n=0;n<images.length;n++)
{
	preload[n]=new Image()
	preload[n].src=images[n]
}

document.write('<img name="defaultimage" src="'+images[Math.floor(Math.random()*(images.length))]+'">')

function rotateimage()
{

if (curindex==(tempindex=Math.floor(Math.random()*(images.length)))){
curindex=curindex==0? 1 : curindex-1
}
else
curindex=tempindex

	document.images.defaultimage.src=images[curindex]
}

setInterval("rotateimage()",delay)
</script>

But, now I want to be able to set a default picture to be shown first and have the random pics appear next. I also don’t want the default pic to show up again in the random array. So basically, every time the page was first visited, or refreshed it would show the default picture then move into the random pics.

Is there anyway to modify the code that I’m using to accomplish this? Or… Any help would be appreciated.

Thanks,
Dell

Thank you very much for your help maliker, you script does exactly what you say it will do, only it’s not quite what I meant.

I’ll try to re-phrase, my original post was a little confusing to me on read back.

What I’m looking for is just what you did in your script with one exception. I always want the first image to be the same image, on first visit and refresh. ie: I have a picture of an apple and five other pictures of fruit. I always want the apple picture to show first and then go through the other fruit images, randomly. Not showing the apple picture again in the random array and only show up again upon refreshing the page.

Again, I really appreciate your help and your time.

Dell