/*Slideshow Script */
/*Created by Ryan Frisch*/


//Slide Object
function slide(source, title, description)
{
this.source="images/slideshow/" + source;
this.caption=title + "<br /> &nbsp;&nbsp;" + description;
this.link = "http://www.mountainviewpublishing.biz/subscriptions.aspx";
}

//Initialize instances of the Slide object
slide1 = new slide("winter.jpg", "Colors of Winter", "Heavy frost on sub-alpine bunchberries");
slide2 = new slide("elixir.jpg", "Elixir", "For excellent food and live music");
slide3 = new slide("nature_calls.jpg", "Nature Calls", "and Customers Flock");
slide4 = new slide("ballet.jpg", "Cas de Deux", "Two dancers spend their summer at canada's national ballet school");
slide5 = new slide("chef.jpg", "Chef Roland Mesnier ", "Memories from inside the White House");
slide6 = new slide("dogsled.jpg", "Winter Doe Camp", "Women enjoy learning outdoor skills");
slide7 = new slide("table.jpg", "David Hurwitz", "Furniture making at its finest");
slide8 = new slide("theater.jpg", "Northern Stage", "The unique theater is thriving");
slide9 = new slide("reflections.jpg", "A Walking Labyrinth", "Finding my own spiritual pathway");

//Array of slide objects
var slides=new Array(slide1, slide2, slide3, slide4, slide5, slide6, slide7, slide8, slide9);   //Add or remove slides based on number of slides in array

//set duration for each image
var duration;
duration = 5;   //Seconds

//Sets number of images
var len;
len = slides.length;

//Initialize slideshow
var currentslide;
currentslide=0;

//Rotate slides
function changeSlide()
{
	
if (currentslide == len)
{
currentslide=0;
}

document.getElementById("changeImage").src=slides[currentslide].source;
document.getElementById("changeLink").href=slides[currentslide].link;
document.getElementById("changeCaption").innerHTML=slides[currentslide].caption;

currentslide = currentslide+1;

setTimeout("changeSlide()",duration*1000);
}

//Start slideshow
onload = function(){
changeSlide();
}