function showTheHours(theHour) {
	if (theHour == 0) {
		return(12)
	}
	if (theHour < 13) {
		return(theHour)
	}
	return(theHour-12)
}

function showZeroFilled(inValue) {
	if (inValue > 9) {
		return ":" + inValue
	}
	return ":0" + inValue
}

function showAmPm(thatTime) {
	if (thatTime < 12) {
		return (" am")
	}
	return (" pm")
}

function showTheTime(tzOffset) {
	thatTZ = new Date
	dateStr = thatTZ.toGMTString()
	dateStr = dateStr.substr(0,dateStr.length - 3)
	thatTZ.setTime(Date.parse(dateStr))
	thatTZ.setHours(thatTZ.getHours() + tzOffset)
	
	return showTheHours(thatTZ.getHours()) + showZeroFilled(thatTZ.getMinutes()) + showAmPm(thatTZ.getHours())
}

function setStyle(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyle() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPrefStyle() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires=" + date.toGMTString();
  }
  else expires = "";
  document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPrefStyle();
  setStyle(title);
}

window.onunload = function(e) {
  var title = getActiveStyle();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPrefStyle();
setStyle(title);

disneyShow = new Array("images/disney06/start.jpg",
"images/disney06/airport1.jpg",
"images/disney06/airport2.jpg",
"images/disney06/airport3.jpg",
"images/disney06/condo01.jpg",
"images/disney06/condo02.jpg",
"images/disney06/condo03.jpg",
"images/disney06/condo04.jpg",
"images/disney06/condo05.jpg",
"images/disney06/condo06.jpg",
"images/disney06/condo07.jpg",
"images/disney06/condo08.jpg",
"images/disney06/condo09.jpg",
"images/disney06/condo10.jpg",
"images/disney06/condo11.jpg",
"images/disney06/josh_ryan1.jpg",
"images/disney06/josh_ryan2.jpg",
"images/disney06/ryan.jpg",
"images/disney06/tree_of_life1.jpg",
"images/disney06/tree_of_life2.jpg",
"images/disney06/tree_of_life3.jpg",
"images/disney06/tree_of_life4.jpg",
"images/disney06/animal_kingdom01.jpg",
"images/disney06/animal_kingdom02.jpg",
"images/disney06/animal_kingdom03.jpg",
"images/disney06/animal_kingdom04.jpg",
"images/disney06/animal_kingdom05.jpg",
"images/disney06/animal_kingdom06.jpg",
"images/disney06/animal_kingdom07.jpg",
"images/disney06/animal_kingdom08.jpg",
"images/disney06/animal_kingdom09.jpg",
"images/disney06/animal_kingdom10.jpg",
"images/disney06/animal_kingdom11.jpg",
"images/disney06/animal_kingdom12.jpg",
"images/disney06/animal_kingdom13.jpg",
"images/disney06/animal_kingdom14.jpg",
"images/disney06/animal_kingdom15.jpg",
"images/disney06/animal_kingdom16.jpg",
"images/disney06/animal_kingdom17.jpg",
"images/disney06/epcot01.jpg",
"images/disney06/epcot02.jpg",
"images/disney06/epcot03.jpg",
"images/disney06/epcot04.jpg",
"images/disney06/epcot05.jpg",
"images/disney06/epcot06.jpg",
"images/disney06/epcot07.jpg",
"images/disney06/epcot08.jpg",
"images/disney06/epcot09.jpg",
"images/disney06/epcot10.jpg",
"images/disney06/lagoon1.jpg",
"images/disney06/lagoon2.jpg",
"images/disney06/magic_kingdom01.jpg",
"images/disney06/magic_kingdom02.jpg",
"images/disney06/magic_kingdom03.jpg",
"images/disney06/magic_kingdom04.jpg",
"images/disney06/magic_kingdom05.jpg",
"images/disney06/magic_kingdom06.jpg",
"images/disney06/magic_kingdom07.jpg",
"images/disney06/magic_kingdom08.jpg",
"images/disney06/magic_kingdom09.jpg",
"images/disney06/magic_kingdom10.jpg",
"images/disney06/magic_kingdom11.jpg",
"images/disney06/magic_kingdom12.jpg",
"images/disney06/mgmstudios01.jpg",
"images/disney06/mgmstudios02.jpg",
"images/disney06/mgmstudios03.jpg",
"images/disney06/mgmstudios04.jpg",
"images/disney06/mgmstudios05.jpg",
"images/disney06/mgmstudios06.jpg",
"images/disney06/mgmstudios07.jpg",
"images/disney06/orange_grove.jpg",
"images/disney06/packed.jpg",
"images/disney06/plane01.jpg",
"images/disney06/plane02.jpg",
"images/disney06/plane03.jpg",
"images/disney06/plane04.jpg",
"images/disney06/plane05.jpg",
"images/disney06/plane06.jpg",
"images/disney06/plane07.jpg",
"images/disney06/plane08.jpg",
"images/disney06/plane09.jpg",
"images/disney06/plane10.jpg",
"images/disney06/plane11.jpg",
"images/disney06/plane12.jpg",
"images/disney06/plane13.jpg",
"images/disney06/plane14.jpg",
"images/disney06/plane15.jpg",
"images/disney06/end.jpg")

captionText = new Array("Hello and Welcome to a Slide Show about my vacation to Disney World",
"Palm Tree's I saw right outside the airport while waiting for the rental car",
"A simple water feature right at the airport",
"Another water feature outside the airport",
"Our view out of the back porch of the condo",
"If you turn around from that last picture, right behind you is this...",
"Turning your head up to the stairs (note the flash in the mirror)",
"The master bedroom with the built in bathroom, the toilet is hidden in this picture. Note the BIG bathtub with the shower right behind it",
"After walking around the master bed you can turn around and see right outside to the other entrance to the porch",
"Noting the TV's Location, only a 20 incher, we have bigger than that at home, of course TV isn't the main focus on this type of vacation...",
"KITCHEN VIEW! Note the towels in the bottom right hand side that are folded. This is just a sign that room service has cleaned.",
"The other bedroom. The bed on the right is the one I slept on",
"Oh the conveniences of modern day life, I can get up from bed and walk straight into the bathroom.",
"DUCK AND COVER! This is me trying to avoid my picture being taken",
"Josh to the right and his friend Ryan to the left, Ryan lives only like an hour away from the Condo we stayed at, so he ended up staying with us from Saturday to Wednesday",
"Josh and Ryan",
"Ryan and Josh",
"Just Ryan, I guess he had a good day... aside from the sunburn...",
"The Tree of Life at the Animal Kingdom. Photo's from here until I say so are from the Animal Kingdom. Got that?",
"The Tree of Life again with some birds toward the bottom",
"Once Again, the Tree of Life",
"Ooooo... Me and Josh at the Tree of Life! This is on Thursday when Ryan Left us",
"Chronologically before I got the previous picture taken, I was looking for my parents. Right here I was on the phone with my mom trying to find her location. I saw her, told her to turn around, and she snapped this picture. What the Heck is Josh Doing?",
"A vulture at the base of the Tree of Life trying to soak up the sun",
"I don't know what this bird's name is. All I know is he's not from around here!",
"Me and my mom were both shocked to see a Whitetail deer at the base of the Tree of Life",
"On the Safari ride we saw tons of animals. This is a Gazelle",
"There's a Giraffe in here somewhere...",
"There's another Giraffe.",
"Monkeys! Who doesn't like monkeys?",
"An Elephant",
"The same Elephant but at a better angle so you can see her baby elephant",
"Flamingos with not enough Shrimp in their diets",
"Sorry, the name of this animal slipped my mind",
"Already spoken for... (see previous caption)",
"Zebras... yay?",
"The King of the Jungle in the flesh, right here he's just soaking up the sun",
"Mount Everest, new this year, still in \"Beta\". I rode the ride 4 times",
"You can see the start of the ride, now with some scale to how small it really is...",
"Welcome to EPCOT: Experimental Prototype Community Of Tomorrow",
"Epcot at night with all the pretty lights :)",
"Mission Space. By HP, yes that's right, the crappiest computer company has a ride at Disney World, I know. But it really wasn't that bad. At least when I rode their crappy software didn't crash. :D But really, it was a good ride. It's a simulation of flying to Mars. A single shuttle holds 4 people, each has a role. You feel the Gforce and everything. The only thing is that the buttons and levers do Jack. This is still a must see ride!",
"Still at Epcot in the World Showcase here is Mexico",
"Now China",
"And now for the Fireworks, see the globe near the bottom center?",
"Lots of smoke and Fireworks at this one, but they used the smoke to laser project clouds. Very cool effect.",
"Here's a Close up of the Globe. You can't see in the picture but the continents were actually playing little video's to the music",
"They were full color Videos. Here you can kind of make out some images on the continents.",
"Still at Epcot, as we were exiting, LOOK AT ALL THE PEOPLE! It was crazy getting out of there.",
"Now we're at Typhoon Lagoon. I only got a few pics because swimming with a digital camera just didn't seem inviting...",
"The last picture at the Lagoon, you see that Damn type structure at the bottom? That's a Tidal pool, kinda cool. Every like 2 minutes it will send a 15ft. Wave. It was sweet. I met 2 Girls in that area. One was British, her name Was Lizzy and she had a younger brother named Owen. She looked 17 but she was actually 12! Then I met a Canadian Girl named Danielle, she had a brother named Seth. She was only 14, but I figured, so what. She was cool. She ended up spending practically the rest of the day with us, and I didn't catch her number! (I also didn't have my cell phone so I didn't even get a picture of either one!)",
"Now at the The Magic Kingdom, Note Walt and his Pal Mickey",
"The Castle at night during the fireworks. It was okay I guess. I liked the one at Epcot better. But they did have a sweet Tinker bell figure light up and \"fly\" across over to a building. She was actually on a cable suspended across the walkway.",
"Josh, Ryan, and Me in front of the Magic Kingdom",
"Zoomed in a little so you can see better",
"Minnie Mouse",
"Mickey Mouse with a friend",
"A nice view at the Magic Kingdom",
"Apparently at the entrance I saw these two. Some kind of anniversary for them",
"Don't be haten'. This is my Mom getting a hug from Tigger",
"Group Hug! My Mom's in the middle",
"Just saying Hi!",
"Mickey waving buy to the crowds as you leave the Magic Kingdom",
"Left to Right: Josh, Ryan, John (my step dad), Mom, and Me! We're at MGM Studio's and that's Mickey's Hat in the background",
"A Close up of Mickey's hat and the beautiful landscape",
"Me on a Star Wars Vehicle (does this spell \"Geek\" to you?)",
"I'm after some droids not shown in the picture. See the Clone behind me? (over my head I guess)",
"Me and A \"Walker\", I think, I'm not sure what it's called but it's a classic Star Wars Vehicle.",
"Just that Vehicle",
"Now this is Still at MGM Studio's, and they make EVERYTHING look like a Set here.",
"When I got the sand (People who got it better appreciate it), I saw this outside my window. It's and orange grove. I drove 250 miles to get that sand, and wasted practically a whole day!",
"Mickey's all packed and ready to go",
"This was a poor attempt in putting some photo's into a collage. This is from the plane on they way back. To the left are sand dunes by the coast. There's a little landing strip to the bottom right, and those white lines are ships! All these photo's of land were taken on the return flight.",
"Picture of the coast",
"Picture of the Clouds, this view was right out my window. See the plane wing?",
"This is a cool photo of clouds over... I think its South Carolina",
"This is over all a cool photo. Can you see the shadows the clouds project? Just look at this photo! It's sweet. Proof that there has to be a God.",
"Another cool photo of clouds and a shadow",
"I think the wing really gives perspective in this photo.",
"More coast and clouds",
"This is cool. It's a picture of the coast (duh) but you can see the river mouth, sweet!",
"I wish I had some sort of scale to go by on these pictures, because I'm really wondering how wide that river is...",
"Housing developments, see them?",
"Sand dunes in the ocean front. Cool huh?",
"The Skyline over the ocean, those are clouds, and to the left is the wing tip",
"Another Cool pic",
"This one's cool because it shows the river and it's tributaries",
"The End")
thisPic = 0
imgCt = disneyShow.length-1

function changePic(direction) {
	if(document.images) {
		thisPic += direction
		if (thisPic > imgCt){
			thisPic = 0
		}
		if (thisPic < 0){
			thisPic = imgCt
		}
		document.Pic.src=disneyShow[thisPic]
		document.showform.Caption.value = captionText[thisPic]
	}
}
