/*  slideshow.js

Creates an array of images to be rotated in place of a SINGLE image on a page but
it supports an unlimited number of images.

Place this script in the "Close HTML" of the page you wish to use it on.
*/

var timer = 3;		//time interval for swapping images (in sec.)
var path = "../DSN/wwwpuzzledinccom/Content/Image/Slideshow/";		//full path to directory with the images in them


//locates the specific image on the page
//change 'imgID' to the ID of the image to use
var showImg = GetTag("slideID");

//repImg = image array
var repImg = new Array("woodenToys_plane.jpg","woodenToys_dragon.jpg","woodenToys_ship.jpg","woodenToys_train.jpg", "woodenToys_1003.jpg","woodenToys_1004.jpg","woodenToys_1008.jpg","woodenToys_1015.jpg","woodenToys_1058.jpg","woodenToys_1102.jpg","woodenToys_1128.jpg","woodenToys_1212.jpg","woodenToys_1223.jpg","woodenToys_1228.jpg","woodenToys_1230.jpg","woodenToys_1278.jpg","woodenToys_1295.jpg","woodenToys_1420.jpg","woodenToys_1508.jpg","woodenToys_1801.jpg","woodenToys_2151.jpg","woodenToys_4424.jpg","woodenToys_4604.jpg","woodenToys_5301.jpg");


//no need to edit anything below this point
var nextImgNum;
var nextImg = new Image();
var imgNum = repImg.length - 1;
var curImg = 0;

function rotate() {
	curImg++;
	if(curImg > imgNum) {
		curImg = 0;
	} else if(nextImgNum > imgNum) {
		nextImgNum = 0;
	} else {
		nextImgNum = curImg + 1;
	}

	if(document.all) {
		showImg.style.filter="blendTrans(duration=1)";
		showImg.filters.blendTrans.Apply();
		showImg.filters.blendTrans.Play();
	}

	showImg.src = path + repImg[curImg];
	nextImg.src = path + repImg[nextImgNum];
}

setInterval("rotate()",timer*1000);