/*  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 = 4;		//time interval for swapping images (in sec.)
var path = "../DSN/wwwinnovatechmfgcom/Content/Images/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("imgID");

//repImg = image array
var repImg = new Array("slide-1.jpg","slide-2.jpg","slide-3.jpg", "slide-4.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);