// ======================================================================
// 		THE USER SHOULD CHANGE THIS PART TO CUSTOMIZE THE SCRIPT
// ======================================================================

// gSlideshowInterval - determines how often the slide show is
// refreshed (time given in seconds).

gSlideshowInterval = 5;

// gNumberOfImages - the total number of images available for display.
// This is used both to set up the image array and to manage the actual
// slideshow.

gNumberOfImages = 17;

// gImages - An array that holds the URLs identifying the images to be
// shown in the slide show.

gImages = new Array();

// Fill in the array to give the URLs for the images that you want to
// use.

gImages[0] = "/templates/rawlings.gif";
gImages[1] = "/templates/planteSports.gif";
gImages[2] = "/templates/CKAC.gif";
gImages[3] = "/templates/B45.jpg";
gImages[4] = "/templates/CanadianTire.jpg";
gImages[5] = "/templates/cage-aux-sports-fond-blanc.jpg";
gImages[6] = "/templates/rds.gif";
gImages[7] = "/templates/CSAD.jpg";
gImages[8] = "/templates/Telus.jpg";
gImages[9] = "/templates/CN.jpg";
gImages[10] = "/templates/Journal_de-Montreal.jpg";
gImages[11] = "/templates/coca_cola.gif";
gImages[12] = "/templates/team990.jpg";
gImages[13] = "/templates/Quebec800.jpg";
gImages[14] = "/templates/RBC.jpg";
gImages[15] = "/templates/molson.jpg";
gImages[16] = "/templates/LUSSIERJOSTENS.gif";

gLink = new Array();

gLink[0] = "http://www.rawlings.com";
gLink[1] = "http://www.plantesports.com";
gLink[2] = "http://www.ckac.com";
gLink[3] = "http://www.b45online.com";
gLink[4] = "http://www.canadiantire.ca";
gLink[5] = "http://www.cage.ca";
gLink[6] = "http://www.rds.ca";
gLink[7] = "http://www.csad.ca";
gLink[8] = "http://www.telus.com";
gLink[9] = "http://www.cn.ca/fr/index.htm";
gLink[10] = "http://lejournaldemontreal.canoe.ca/";
gLink[11] = "http://www.icoke.ca/home?locale=fr_CA";
gLink[12] = "http://www.team990.com/";
gLink[13] = "http://www.quebec800.com/";
gLink[14] = "http://www.rbcbanqueroyale.com/";
gLink[15] = "http://www.molson.ca/";
gLink[16] = "http://www.lussierjostens.com/";

// ======================================================================
// 			DON'T CHANGE THIS PART
// ======================================================================

// canManipulateImages - check if the browser we're using can do
// clever stuff with document images.

function canManipulateImages() {
	if (document.images)
		return true;
	else
		return false;
}

// loadSlide
//
// Load a given image into place by substituting its URL for the URL 
// currently loaded by the <IMG> object called 'slide'. 

function loadSlide(imageURL, imageLink) {
	if (gImageCapableBrowser) {
		document.slide.src = imageURL;
		document.slide.parentNode.href = imageLink;
		return false;
	}
	else {
		return true;
	}
}

// nextSlide
//
// Update the counter that shows which slide is being displayed, and
// load it into place. The modulo (%) is there to ensure that we roll
// over when we reach the end of the slideshow.

function nextSlide() {
	gCurrentImage = (gCurrentImage + 1) % gNumberOfImages;
	loadSlide(gImages[gCurrentImage], gLink[gCurrentImage]);
}

// gImageCapableBrowser - is this browser hip to images? Set up
// a global variable so that we don't have to keep calling a function
// (useful if the function becomes costly to compute).

gImageCapableBrowser = canManipulateImages();

// gCurrentImage - a variable used to keep track of the image
// currently being displayed to the user.

gCurrentImage = 0;

// Set up the timer. This will call the 'nextSlide()' function repeatedly at 
// the specified interval (and will continue to do so until the page is unloaded).

setInterval("nextSlide()",gSlideshowInterval * 1000);

