// Scripts for Paula Creamer Slideshow


//============================= new javascript =====================//

var counter=0;
var counterC=0;
var counterD=0;
var interval = 4000;
var imageDir = "/GRAPHICS/gcFirstTeePaula_";

var image_array = new Array();

//Add image filenames to the array
//image_array[0] = "screen_usinfo_homemock.gif"

//Sports Academy
image_array[counter++] = new imageItem(imageDir + "033.jpg"); 
image_array[counter++] = new imageItem(imageDir + "010.jpg"); 
image_array[counter++] = new imageItem(imageDir + "007.jpg"); 
image_array[counter++] = new imageItem(imageDir + "006.jpg"); 
image_array[counter++] = new imageItem(imageDir + "017.jpg");

var totalImages = image_array.length;

function imageItem(image_location) {
	this.image_item = new Image();
	this.image_item.src = image_location;
	
}

function get_ImageItemLocation(imageObj) {
	return(imageObj.image_item.src)
}


var caption_array = new Array();

//Add image filenames to the array
//image_array[0] = "screen_usinfo_homemock.gif"

caption_array[counterC++] = "Paula Creamer at the Golf Club"
caption_array[counterC++] = "Paula Creamer at the Golf Club"
caption_array[counterC++] = "Paula Creamer at the Golf Club"
caption_array[counterC++] = "Paula Creamer at the Golf Club"
caption_array[counterC++] = "Paula Creamer at the Golf Club"



var desc_array = new Array();

//Add image filenames to the array
//image_array[0] = "screen_usinfo_homemock.gif"


//Sports Academy
desc_array[counterD++] = "Posing for a shot before the game."; 
desc_array[counterD++] = "Getting instruction from our soccer coach."; 
desc_array[counterD++] = "Practicing dribbling on the baseline."; 
desc_array[counterD++] = "Ready to hit a home run!"; 
desc_array[counterD++] = "Getting ready for a climb."; 
desc_array[counterD++] = "Rock climbing."; 
desc_array[counterD++] = "Full camp game of capture the flag."; 
desc_array[counterD++] = "Everyone line up."; 

// new hockey
//Hockey
desc_array[counterD++] = "Working on our skating skills."; 
desc_array[counterD++] = "Going for a goal!"; 
desc_array[counterD++] = "Eyeing my opponent."; 
desc_array[counterD++] = "Taking a knee to learn a new move."; 
desc_array[counterD++] = "Working on stick skills through the cones."; 
desc_array[counterD++] = "Strategizing with teammates."; 

//Free Time
desc_array[counterD++] = "Campers mingling over a game of SORRY! during free time."; 
desc_array[counterD++] = "Doubles ping pong during free time."; 

//Golf
desc_array[counterD++] = "On the hitting range at golf camp."; 
desc_array[counterD++] = "Getting some helpful instruction."; 
desc_array[counterD++] = "Hanging out with my golf buddy."; 
desc_array[counterD++] = "Morning instructional session."; 
desc_array[counterD++] = "Every other Friday we get to take our game to a real course!"; 
desc_array[counterD++] = "High fives for lady golfers!"; 
desc_array[counterD++] = "Lining up the putt."; 
desc_array[counterD++] = "Relaxing by the picnic tables after the golf outing."; 
desc_array[counterD++] = "Golfers take a break and hit the gym!"; 

//Figure Skating
desc_array[counterD++] = "Warming up on the side of the ice rink."; 
desc_array[counterD++] = "Practicing spirals on the ice."; 
desc_array[counterD++] = "Best friends!"; 
desc_array[counterD++] = "Learning together."; 
desc_array[counterD++] = "Ice skating show."; 
desc_array[counterD++] = "Look what I can do!"; 
desc_array[counterD++] = "Best buds getting ready to perform."; 
desc_array[counterD++] = "Brrr!  I can't wait to get on the ice!"; 
desc_array[counterD++] = "Skating around the rink."; 
desc_array[counterD++] = "Steady…"; 

//new preschool sr
//Preschool Ice Skating
desc_array[counterD++] = "Watching our counselor show us a new way to stay on our feet."; 
desc_array[counterD++] = "Ready to skate!"; 
desc_array[counterD++] = "Here we go!"; 
desc_array[counterD++] = "I think I've got it now…"; 

//Lunch
desc_array[counterD++] = "Lunch with friends."; 
desc_array[counterD++] = "Big smiles in the lunch line."; 
desc_array[counterD++] = "What a group!"; 
desc_array[counterD++] = "Striking a pose after lunch."; 
desc_array[counterD++] = "At lunch with my buds!"; 
desc_array[counterD++] = "Ladies lunch."; 
desc_array[counterD++] = "A little lunch with the boys."; 

//Preschool Gynmastics
desc_array[counterD++] = "Getting a little help from our counselor."; 
desc_array[counterD++] = "Duck…duck…goose!"; 
desc_array[counterD++] = "Look at me, way up here!"; 
desc_array[counterD++] = "Making our props."; 
desc_array[counterD++] = "Hard at work."; 
desc_array[counterD++] = "Working together."; 
desc_array[counterD++] = "Creating the scenery for our Peter Pan gymnastics show."; 
desc_array[counterD++] = "Painting away!"; 
desc_array[counterD++] = "Gymnastics show."; 

//Bowling
desc_array[counterD++] = "Lining up a strike."; 
desc_array[counterD++] = "Bowling camp is awesome!"; 
desc_array[counterD++] = "Nice follow through."; 
desc_array[counterD++] = "C'mon, give me a strike!"; 
desc_array[counterD++] = "Selecting the right ball is key to throwing a strike."; 

//Urban Adventures
desc_array[counterD++] = "Pushing off!"; 
desc_array[counterD++] = "Morning meditation session by the rock wall."; 
desc_array[counterD++] = "We've got our paddles, we're ready to kayak!";  
desc_array[counterD++] = "Ready dude!"; 
desc_array[counterD++] = "A few last minute instructions, and then we're off!"; 

//Gymnastics
desc_array[counterD++] = "The girls hanging out during gymnastics instruction."; 
desc_array[counterD++] = "Working hard on the rings."; 
desc_array[counterD++] = "Thanks for spotting me!"; 
desc_array[counterD++] = "Warming up with the class."; 
desc_array[counterD++] = "Learning how to flip."; 
desc_array[counterD++] = "Fun in the foam pit."; 
desc_array[counterD++] = "Gymnastics show."; 
desc_array[counterD++] = "Gymnastics show."; 
desc_array[counterD++] = "What a great performance!"; 

//Bus
desc_array[counterD++] = "Waiting for the bus."; 
desc_array[counterD++] = "Ready to go home."; 
desc_array[counterD++] = "All smiles on the bus!"; 

//End
desc_array[counterD++] = "See you this summer!"; 


//var counter = 0;

function setStat() {
	//document.all["stat"].innerText = image_index+1 + " of " + image_array.length + " images"
}

function removeStat() {
	var statdiv = document.getElementById("stat");
	if (statdiv.childNodes.length > 0) {
		for (link_counter = statdiv.childNodes.length - 1;link_counter >=0;link_counter--) {
			// Get the row element to be deleted
			var remove_node = statdiv.childNodes[link_counter];
			statdiv.removeChild(remove_node);
		}
	}
}

function removeCaption() {
	var capdiv = document.getElementById("caption");
	if (capdiv.childNodes.length > 0) {
		for (link_counter = capdiv.childNodes.length - 1;link_counter >=0;link_counter--) {
			// Get the row element to be deleted
			var remove_node = capdiv.childNodes[link_counter];
			capdiv.removeChild(remove_node);
		}
	}
}

function removeDesc() {
	var descdiv = document.getElementById("desc");
	if (descdiv.childNodes.length > 0) {
		for (link_counter = descdiv.childNodes.length - 1;link_counter >=0;link_counter--) {
			// Get the row element to be deleted
			var remove_node = descdiv.childNodes[link_counter];
			descdiv.removeChild(remove_node);
		}
	}
}

function showStat() {
	var statdiv = document.getElementById("stat");
	var text_node = document.createTextNode("Photo "+(counter+1)+" of "+image_array.length);
	statdiv.appendChild(text_node);
}

function showCaption() {
	var capdiv = document.getElementById("caption");
	var cap_node = document.createTextNode(caption_array[counter]);
	capdiv.appendChild(cap_node);
	
}

function showDesc() {
	var descdiv = document.getElementById("desc");
	var desc_node = document.createTextNode(desc_array[counter]);
	descdiv.appendChild(desc_node);
	
}

function getNextImage() {
	if (counter>image_array.length) {
		counter==0
	}
	else {
	counter = (counter+1) % totalImages;
	}
	var new_image = get_ImageItemLocation(image_array[counter]);
	return(new_image);

}

function getFirstImage() {
	counter = 0;
	var new_image = get_ImageItemLocation(image_array[counter]);
	return(new_image);
}

function firstImage(place) {
	
	//Clear the status bar before updating
	var statdiv = document.getElementById("stat");
	var capdiv = document.getElementById("caption");
	var descdiv = document.getElementById("desc");
	//Clear the status bar before updating
	removeStat();
	removeCaption();
	//removeDesc();
	
	//Set to the first image in the array
	counter= 0
	
	// Add text node to the div tag
	showStat();
	showCaption();
	//showDesc();
	
	//Display the new image
	var new_image = getFirstImage();
	document[place].src = new_image;
			
}

function getPrevImage() {
	
	if (counter<1) {
		
		counter= image_array.length-1;
	}
	else {
		counter = (counter-1) % totalImages;
	}
		
	var new_image = get_ImageItemLocation(image_array[counter]);
	
	return(new_image);
}

function prevImage(place) {
	removeStat();
	removeCaption();
	//removeDesc();
	
	var new_image = getPrevImage();
	document[place].src = new_image;
	showStat();
	showCaption();
	//showDesc();
}

function switchImage(place) {
	
	
	removeStat();
	removeCaption();
	//removeDesc();
	
	
	
	var new_image = getNextImage();
	document[place].src = new_image;
	
	
	
	var recur_call = "switchImage('"+place+"')";
	timerID = setTimeout(recur_call, interval);
	showStat();
	showCaption();
	//showDesc();
	
}

function startImages(place) {
	firstImage(place);
	
	var recur_call = "switchImage('"+place+"')";
	timerID = setTimeout(recur_call, interval);
	
	
	
}

function getLastImage() {
	counter = image_array.length-1;
	var new_image = get_ImageItemLocation(image_array[counter]);
	return(new_image);
}

function lastImage(place) {
	//Clear the status bar before updating
	
	var statdiv = document.getElementById("stat");
	var capdiv = document.getElementById("caption");
	var descdiv = document.getElementById("desc");
	//Clear the status bar before updating
	removeStat();
	removeCaption();
	//removeDesc();
	
	//Set it to the last image in the array
	counter= image_array.length - 1
	
	// Add text node to the div tag
	showStat();
	showCaption();
	//showDesc();
	
	//Display the new image
	var new_image = getLastImage();
	document[place].src = new_image;
	
	
	
}



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

