/***********************************************
* 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 l_seqslides=new Array()
//Set Path to Image plus optional URL ("" for no URL):
l_seqslides[0]=["ad\/ac.gif", "http://www.aircanada.com/uk/en/home.html"]
l_seqslides[1]=["ad\/cwg.jpg", "http://www.canarywharf.com"]
l_seqslides[2]=["ad\/cs.jpg", "http://www.canadashop.uk.com/index.html"]
l_seqslides[3]=["ad\/tds.jpg", "http://www.tdsecurities.com"]


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

//Set how many images to show at once (must be less than total # of images above):
var l_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 l_slideseparater="<br> <br>"

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

//Set image border width:
var l_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 l_opacityvalues=[1,1]

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

function l_processimgcode(theimg){
var l_imghtml=""
if (theimg[1]!="")
l_imghtml='<a href="'+theimg[1]+'" target="'+l_optlinktarget+'">'
l_imghtml+='<img src="'+theimg[0]+'" border="'+l_imgborderwidth+'" style="filter:alpha(opacity='+(l_opacityvalues[0]*100)+');-moz-opacity:'+l_opacityvalues[0]+'">'
if (theimg[1]!="")
l_imghtml+='</a>'
return l_imghtml
}

var l_curslide=1 //var to track current slide (total: l_slidestoreveal)
var l_curimgindex=0 //var to track current image (total: l_seqslides.length)
var l_isfirstcycle=1 //boolean to indicate whether this is the first cycle

if (document.getElementById){
for (i=0;i<l_slidestoreveal;i++)
document.write('<span id="l_seqslide'+i+'" class="l_seqslidestyle">'+l_processimgcode(l_seqslides[i])+'</span>'+l_slideseparater)
l_curimgindex=l_slidestoreveal
l_illuminateslide(0,l_opacityvalues[1])
}

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

function l_displayit(){
if (l_curslide<l_slidestoreveal){
if (!l_isfirstcycle)
l_changeimage(l_curslide)
l_illuminateslide(l_curslide, l_opacityvalues[1])
l_curslide++
}
else{
l_isfirstcycle=0
for (i=0;i<l_slidestoreveal;i++)
l_illuminateslide(i, l_opacityvalues[0])
l_changeimage(0)
l_illuminateslide(0, l_opacityvalues[1])
l_curslide=1
}
}

function l_changeimage(slideindex){
document.getElementById("l_seqslide"+slideindex).innerHTML=l_processimgcode(l_seqslides[l_curimgindex])
l_curimgindex++
if (l_curimgindex>=l_seqslides.length)
l_curimgindex=0
}

if (document.getElementById)
setInterval("l_displayit()",l_slidedelay)
