<!-- Begin
// Specify the image files
var Pic = new Array();

var protocol = window.location.protocol;

Pic[0] = protocol + '//www.nysfirechiefs.com/images/J-Final-a.jpg';
Pic[1] = protocol + '//www.nysfirechiefs.com/images/J-Final-b.jpg';
Pic[2] = protocol + '//www.nysfirechiefs.com/images/J-Final-c.jpg';

var t;
var j = 0;
var i = 0;
var p = Pic.length;
var preLoad = new Array();
var imageDuration = new Array();
var fadeDuration = new Array();
for(i = 0; i < p; i++) {
	imageDuration[i] = -1;
	fadeDuration[i] = -1;

	preLoad[i] = new Image();
	preLoad[i].src = Pic[i];
}

// This is the image number that the loop restart will go through
// Set to zero if you want everything to loop
// Otherwise set to an image number (1, 2, 3, ...)
var loopRestart = 0;
// These are the default duration values (in milliseconds)
// These defaults are used in case that a particular image does not have
// a specified duration value
var defaultImageDuration = 5000;
var defaultFadeDuration = 5000;

// Here is where you can set image-specific duration values
// For example, imageDuration[3] = 2000; would set Pic[3]'s image duration value to 2000
//imageDuration[0] = 2000;
// Same as above with fadeDuration
//fadeDuration[0] = 2000;

var blendSpeed;
function runSlideShow() {
	window.clearTimeout(t);
	
	var crossFadeDuration;
	var showSpeed;

	if(fadeDuration[j] == -1)
		crossFadeDuration = defaultFadeDuration;
	else
		crossFadeDuration = fadeDuration[j];

	if(imageDuration[j] == -1)
		showSpeed = defaultImageDuration;
	else
		showSpeed = imageDuration[j];

	// First, set the current image as background of div
	document.getElementById("divSlideShow").style.backgroundImage = "url(" + preLoad[j].src + ")";
//	document.getElementById("SlideShow").style.visibility = "hidden";
	changeOpacity("SlideShow", 0);
	t = window.setTimeout("finishSlideShow('" + crossFadeDuration + "', '" + showSpeed + "');", 500);
}

function finishSlideShow(crossFadeDuration, showSpeed)
{
	window.clearTimeout(t);
	
	// Now set the opacity of the current image to 0
	document.getElementById("SlideShow").src = preLoad[getNextImage()].src;
//	document.getElementById("SlideShow").style.visibility = "visible";

	blendSpeed = Math.round(crossFadeDuration/100);
	t = window.setTimeout("blendInImage(0);", showSpeed);
}

function blendInImage(opacVal)
{
	window.clearTimeout(t);

	opacVal++;
	if(opacVal <= 100) {
		changeOpacity("SlideShow", opacVal);
		t = window.setTimeout("blendInImage(" + opacVal + ");", blendSpeed);
	}
	else {
		j = getNextImage();
		runSlideShow();
	}
}

function getNextImage()
{
	var nextImg = j + 1;
	if (nextImg > (p-1)) nextImg = loopRestart;
	return nextImg;
}

function changeOpacity(id, opacity) 
{
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}
//  End -->
