var timer = null
var counter = 1
var maxPictures = 5
var subsetName = "defaultPic"
var pic = new Array();
var picName = new Array();
var slideName = "defaultPic"

if (navigator.appName.indexOf('Netscape') == "-1") 
{
	var ns = false;
}	
else
{
	if (document.layers)
		var ns = true;
	else
		var ns = false;	
}	

//var ns=true; //Added so that captions do not appear in the virtual tour

function slideshow() {
	timer=setTimeout("slideshow()", 4000);

	document.pictures.src = pic[counter].src;
	
	//if (!ns) 
	//	document.all.picName.innerText = picName[counter].valueOf;
		
	//document.frmMain.picName.value=picName[counter];
	counter=counter+1;

	if (counter >= (maxPictures+1)) 
		counter = 1;
}

function nextSlide() {
	if(counter == maxPictures)
		counter=1;
	else
		counter=counter+1;
	
	document.pictures.src = pic[counter].src;
	//if (!ns)
	//	document.all.picName.innerText = picName[counter].valueOf;
	
	//document.frmMain.picName.value=picName[counter];
	
}

function prevSlide() {
	if(counter == 1)
		counter=maxPictures;
	else
		counter=counter-1;

	document.pictures.src = pic[counter].src;
	//if (!ns)
	//	document.all.picName.innerText = picName[counter].valueOf;
		
	//document.frmMain.picName.value=picName[counter];
		
}

function stopSlideshow() {
	clearTimeout(timer);
	counter=1;
	document.pictures.src = pic[counter].src;

	//if (!ns)
	//	document.all.picName.innerText = picName[counter].valueOf;
	
	//document.frmMain.picName.value=picName[counter];	

}

function changeSlideshow() {
	clearTimeout(timer);
	counter=1;
	document.pictures.src = "images/3(b).JPG";
	//if (!ns)
	//	document.all.picName.innerText = "";

	//document.frmMain.picName.value="";

}
	
function changePic(objName,picName) {
  	objName.background=picName
}
  
function setFirstTitle(slideName) {

	subsetName=slideName;
	loadPicArray(subsetName);
		
	
	document.pictures.src = pic[counter].src;
	//if (!ns)
	//	document.all.picName.innerText = picName[counter].valueOf;
		
	//document.frmMain.picName.value=picName[counter];
		
}
	
// arial mt bold 12 -- adobe photoshop
	
function loadPicArray(subsetName){

  switch(subsetName){
	case "defaultPic": 

		maxPictures = 6

		pic[1] = new Image(300, 200);
		pic[1].src = "images/022_19A_title.JPG";
		picName[1] = new String();
		picName[1].valueOf = "Toddler loft";

		pic[2] = new Image(300, 200);
		pic[2].src = "images/005_2A_title.JPG";
		picName[2] = new String();
		picName[2].valueOf = "Mixed age group classroom";

		pic[3] = new Image(300, 200);
		pic[3].src = "images/p2_corner_horiz_title.JPG";
		picName[3] = new String();
		picName[3].valueOf = "Toddler classroom";

		pic[4] = new Image(300, 200);
		pic[4].src = "images/027_24A_title.JPG";
		picName[4] = new String();
		picName[4].valueOf = "Mixed age group classroom";

		pic[5] = new Image(300, 200);
		pic[5].src = "images/012_9A_title.JPG";
		picName[5] = new String();
		picName[5].valueOf = "Outside play area";

		pic[6] = new Image(300, 200);
		pic[6].src = "images/tw_mirrors_title.jpg";
		picName[6] = new String();
		picName[6].valueOf = "Infant classroom";

		break;
		
		
	case "children":
	
		maxPictures = 8
		
		pic[1] = new Image();
		pic[1].src = "images/baby_play_title.jpg";
		picName[1] = new String();
		picName[1].valueOf = "Baby play";

		pic[2] = new Image();
		pic[2].src = "images/toddler_play_title.jpg";
		picName[2] = new String();
		picName[2].valueOf = "Toddler play";

		pic[3] = new Image();
		pic[3].src = "images/toddlers_together_title.jpg";
		picName[3] = new String();
		picName[3].valueOf = "Toddlers together";	

		pic[4] = new Image();
		pic[4].src = "images/cooking_outside_title.jpg";
		picName[4] = new String();
		picName[4].valueOf = "Cooking outside";

		pic[5] = new Image();
		pic[5].src = "images/time_to_eat_title.jpg";
		picName[5] = new String();
		picName[5].valueOf = "Time to eat";

		pic[6] = new Image();
		pic[6].src = "images/lunchtime_title.jpg";
		picName[6] = new String();
		picName[6].valueOf = "Lunchtime";	
		
		pic[7] = new Image();
		pic[7].src = "images/washing_up_title.jpg";
		picName[7] = new String();
		picName[7].valueOf = "Washing up";

		pic[8] = new Image();
		pic[8].src = "images/naptime_title.jpg";
		picName[8] = new String();
		picName[8].valueOf = "Naptime";
						
		break;

	case "hatTea":
	
		maxPictures = 7
		
		pic[1] = new Image();
		pic[1].src = "images/hatTea1.jpg";
		picName[1] = new String();
		picName[1].valueOf = "";

		pic[2] = new Image();
		pic[2].src = "images/hatTea2.jpg";
		picName[2] = new String();
		picName[2].valueOf = "";

		pic[3] = new Image();
		pic[3].src = "images/hatTea3.jpg";
		picName[3] = new String();
		picName[3].valueOf = "";	

		pic[4] = new Image();
		pic[4].src = "images/hatTea4.jpg";
		picName[4] = new String();
		picName[4].valueOf = "";

		pic[5] = new Image();
		pic[5].src = "images/hatTea5.jpg";
		picName[5] = new String();
		picName[5].valueOf = "";

		pic[6] = new Image();
		pic[6].src = "images/hatTea6.jpg";
		picName[6] = new String();
		picName[6].valueOf = "";
		
		pic[7] = new Image();
		pic[7].src = "images/hatTea7.jpg";
		picName[7] = new String();
		picName[7].valueOf = "";

	//	pic[8] = new Image();
	//	pic[8].src = "images/hatTea8.jpg";
	//	picName[8] = new String();
	//	picName[8].valueOf = "";
		
	//	pic[9] = new Image();
	//	pic[9].src = "images/hatTea9.jpg";
	//	picName[9] = new String();
	//	picName[9].valueOf = "";
			

	//	pic[10] = new Image();
	//	pic[10].src = "images/hatTea10.jpg";
	//	picName[10] = new String();
	//	picName[10].valueOf = "";
	
	//	pic[11] = new Image();
	//	pic[11].src = "images/hatTea11.jpg";
	//	picName[11] = new String();
	//	picName[11].valueOf = "";

	//	pic[12] = new Image();
	//	pic[12].src = "images/hatTea12.jpg";
	//	picName[12] = new String();
	//	picName[12].valueOf = "";
	
		break;
  }
}

function loadAndStartShow(subsetName) {
	changeSlideshow();
	loadPicArray(subsetName);
	slideshow();

}



