QWaz 0 Junior Poster in Training

Hi,

I am very very new to JavaScript, and really am just starting to learn how it works.

I found some useful code that I have used on another site, however now I want to use it twice on the same page, but for a different image gallery. it obviously doesn't work, because I am just using the same variable names.

Can you please help me reproduce this code so that if it's used on the same page it won't conflict. As I have very little idea what can be changed and what can't be.

This is the code that goes into the head:

//specify interval between slide (in mili seconds)
var slidespeed=3000

//specify images
var slideimages=new Array("photos/image1.jpg","photos/image2.jpg","photos/image3.jpg","photos/image4.jpg")

//specify corresponding links
var slidelinks=new Array("gallery.php","gallery.php","gallery.php","gallery.php")

var newwindow=0 //open links in new window? 1=yes, 0=no

var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow(){
if (newwindow)
window.open(slidelinks[whichlink])
else
window.location=slidelinks[whichlink]
}

This is the code that goes into the body:

<a href="javascript:gotoshow()"><img src="image1.gif" name="slide" style="filter: blendTrans(duration=3); border: none;" width="260px" height="210px"></a>

	<script language="JavaScript1.1">
    <!--
    
    var whichlink=0
    var whichimage=0
    var blenddelay=(ie)? document.images.slide.filters[0].duration*1000 : 0
    function slideit(){
    if (!document.images) return
    if (ie) document.images.slide.filters[0].apply()
    document.images.slide.src=imageholder[whichimage].src
    if (ie) document.images.slide.filters[0].play()
    whichlink=whichimage
    whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
    setTimeout("slideit()",slidespeed+blenddelay)
    }
    slideit()
    
    //-->
    </script>

Thank you for your help,

Cheers,

QWaz