// JavaScript Document
window.onload = initAll;

var currImg = 0;
var captionText = new Array(
	"This is Eva marie just over an hour old. She was 7 lbs 1 oz and 20 inches long. Isn't she a cutie? (1 OF 20)",
	"This is her mother. I'm so proud of you both. Thank you, Kristel! You are the best! (2 OF 20)",
	"Kristel holding our little princess. What beautifull girls! (3 OF 20)",
	"Here we are with the biggest challenge of our lives. Like they said, ugly people make cute babys. (4 OF 20)",
	"You are so beautiful. You look just like your dad. What a lucky girl! (5 OF 20)!",
	"Hi everybody, I hope you all are enjoying my first pictures! Don't stop now, there are lots more. (6 OF 20)",
	"I was born with lots of hair. I want a pony tail!  (7 OF 20)",
	"Her first night at the hospital. (8 OF 20)",
	"Eva arrives home and decides to take another nap.  (9 OF 20)",
	"She is definitely a little kristel. What a beautifull girl. (10 OF 20)",
	"Wake up little girl! (11 OF 20)",
	"And of course grandpa is ruining christmas again.  (12 OF 20)",
	"Grandma is holding Eva. (13 OF 20)",
	"Ti Ti Sara looks very exited. She better be. (14 OF 20)",
	"Is Uncle John giving her a lecture already? (15 OF 20)",
	"Baba joan. Did you bring any Oh No brownies? (16 OF 20)",
	"Like mother like daughter. (17 OF 20)",
	"I love my mom. She's very comfy. (18 OF 20)",
	"Sweet dreams little girl. (19 OF 20)",
	"Making sure you get your beauty sleep. (20 OF 20)"
)

function initAll() {
	document.getElementById("imgText").innerHTML = captionText[0];
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
}

function processPrevious() {
	newSlide(-1);
}

function processNext() {
	newSlide(1);
}

function newSlide(direction) {
	var imgCt = captionText.length;

	currImg = currImg + direction;
	if (currImg < 0) {
		currImg = imgCt-1;
	}
	if (currImg == imgCt) {
		currImg = 0;
	}
	document.getElementById("slideshow").src = "images/eva" + currImg + ".jpg"
	document.getElementById("imgText").innerHTML = captionText[currImg]
}

