<!--

//arrays for slideshows
var picArray = new Array();
var slideshowPics = new Array();
var numItems;
var thisItem = 0;
var timeoutId;
var playSpeed = 3;
var autoPlayFlag = false;
var currentlyLoaded = -1;
var currentlyLoading = 0;
// var slideshowPics = new Array();


function slideshow(delta) {
	prevItem = thisItem;
	thisItem = thisItem + delta;
	if (thisItem==numItems) {thisItem = 0;}

	var newVis;
	var obj = null;

	if(thisItem==0) { //hide previous button
		setVis('prev_on','hidden');
	} else { //show previous button
		setVis('prev_on','visible');
	}

	if(thisItem==numItems-1) { //hide next button
		setVis('next_on','hidden');
	} else { //show next button
		setVis('next_on','visible');
	}

	if(autoPlayFlag==true) {
		setVis('auto_on','visible');
	} else {
		setVis('auto_off','visible');
	}

	if (isIE5==true){
        	obj = eval('document.all.slideShowItem' + (thisItem+1));
		obj.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=1)";
		obj.filters[0].Apply();
        	obj.style.visibility = 'visible';
		obj.filters[0].Play();
		if(delta!=0){
			obj = eval('document.all.slideShowItem' + (prevItem+1));
			obj.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=1)";
			obj.filters[0].Apply();
			obj.style.visibility = 'hidden';
			obj.filters[0].Play();
		}
   	} else if (isNS6==true){
        	obj = document.getElementById('slideShowItem' + (thisItem+1));
        	obj.style.visibility = 'visible';
		if(delta!=0){
        		obj = document.getElementById('slideShowItem' + (prevItem+1));
        		obj.style.visibility = 'hidden';
        	}
    	}

	picArray[thisItem].src = '../images/'+slideshowPics[thisItem];
	document['slideshowPic'+(thisItem+1)].src = picArray[thisItem].src;
	
	if(autoPlayFlag==true) {
		clearTimeout(timeoutId);
		timeoutId = setTimeout("slideshowPlay()",playSpeed*1000);
	}
}


function setVis(which,theVis) {
	if(isIE5==true){
		obj = eval('document.all.'+which);
		if(obj==null) return;
		obj.style.visibility = theVis;
   	} else if (isNS6==true){
        	obj = document.getElementById(which);
		if(obj==null) return;
        	obj.style.visibility = theVis;
   	}
}

function slideshowPlay() {
	autoPlayFlag = true;
	setVis('auto_off','hidden');
	setVis('auto_on','visible');
	//alert('slideshowPic'+thisItem);
	if(document['slideshowPic'+(thisItem+1)].complete) {
		slideshow(1);
	} else {
		timeoutId = setTimeout("slideshowPlay()",playSpeed*1000);
	}
}

function slideshowStop() {
	autoPlayFlag = false;
	clearTimeout(timeoutId);
	setVis('auto_off','visible');
	setVis('auto_on','hidden');
}

function initSlideShow(autoPlay, delay) {
	autoPlayFlag = autoPlay;
	playSpeed = delay;
	if (document.images){
		for (i=0;i<slideshowPics.length;i++){
			picArray[picArray.length] = new Image();
		}
	}
	picArray[0] = document.images['slideshowPic1'];
	picArray[0].src = '../images/'+slideshowPics[0];
	numItems = picArray.length;
	slideshow(0);
	loadPics();
	//alert(picArray.toString());
}

function loadPics() {
	if(picArray[currentlyLoading].complete) {
		currentlyLoaded = currentlyLoading;
		currentlyLoading++;
		picArray[currentlyLoading] = new Image();
		picArray[currentlyLoading].src = '../images/'+slideshowPics[currentlyLoading];
	}
	if(currentlyLoading < numItems-1) {
		setTimeout("loadPics()",200);
	}
}

//-->
