/***********************************************
* MultiFrame Image Slideshow script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var r_seqslides=new Array()
//Set Path to Image plus optional URL ("" for no URL):
r_seqslides[0]=["ad\/ctms.jpg", "http://www.ctmstravel.com"]
r_seqslides[1]=["ad\/ao.jpg", "http://www.allenovery.com"]
r_seqslides[2]=["ad\/rbcw.jpg", "http://www.rbc.com"]
r_seqslides[3]=["ad\/pc.jpg", "http://www.petro-canada.ca"]



//Set pause between each image display (2000=2 second):
var r_slidedelay=2000

//Set how many images to show at once (must be less than total # of images above):
var r_slidestoreveal=1

//Specify code to insert between each slide (ie: "<br>" to insert a line break and create a vertical layout)
//"" for none (or horizontal):
var r_slideseparater="<br> <br>"

//Set optional link target to be added to all images with a link:
var r_optlinktarget="secwindow"

//Set image border width:
var r_imgborderwidth=0

//Set opacity value of each image when it's "dimmed", and when it's not, respectively (1=100% opaque/normal).
//Change 0.2 to 0 to completely hide image when it's dimmed:
var r_opacityvalues=[1,1]

///No need to edit beyond here///////////

function r_processimgcode(theimg){
var r_imghtml=""
if (theimg[1]!="")
r_imghtml='<a href="'+theimg[1]+'" target="'+r_optlinktarget+'">'
r_imghtml+='<img src="'+theimg[0]+'" border="'+r_imgborderwidth+'" style="filter:alpha(opacity='+(r_opacityvalues[0]*100)+');-moz-opacity:'+r_opacityvalues[0]+'">'
if (theimg[1]!="")
r_imghtml+='</a>'
return r_imghtml
}

var r_curslide=1 //var to track current slide (total: r_slidestoreveal)
var r_curimgindex=0 //var to track current image (total: r_seqslides.length)
var r_isfirstcycle=1 //boolean to indicate whether this is the first cycle

if (document.getElementById){
for (i=0;i<r_slidestoreveal;i++)
document.write('<span id="r_seqslide'+i+'" class="r_seqslidestyle">'+r_processimgcode(r_seqslides[i])+'</span>'+r_slideseparater)
r_curimgindex=r_slidestoreveal
r_illuminateslide(0,r_opacityvalues[1])
}

function r_illuminateslide(slideindex, amt){
var slideobj=document.getElementById("r_seqslide"+slideindex).getElementsByTagName("IMG")[0]
if (slideobj.filters)
slideobj.filters.alpha.opacity=amt*100
else if (slideobj.style.MozOpacity)
slideobj.style.MozOpacity=amt
}

function r_displayit(){
if (r_curslide<r_slidestoreveal){
if (!r_isfirstcycle)
r_changeimage(r_curslide)
r_illuminateslide(r_curslide, r_opacityvalues[1])
r_curslide++
}
else{
r_isfirstcycle=0
for (i=0;i<r_slidestoreveal;i++)
r_illuminateslide(i, r_opacityvalues[0])
r_changeimage(0)
r_illuminateslide(0, r_opacityvalues[1])
r_curslide=1
}
}

function r_changeimage(slideindex){
document.getElementById("r_seqslide"+slideindex).innerHTML=r_processimgcode(r_seqslides[r_curimgindex])
r_curimgindex++
if (r_curimgindex>=r_seqslides.length)
r_curimgindex=0
}

if (document.getElementById)
setInterval("r_displayit()",r_slidedelay)
