/*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 = "subscriptions.aspx";
}

//Initialize instances of the Slide object
slide1 = new slide("house.jpg", "My Vermont", "Reflecting on cherished annual visits");
slide2 = new slide("porch_group.jpg", "The Shackleton Way", "Connecting people with each other and the land");
slide3 = new slide("garden_supply.jpg", "The Spirit of the Season", "River Bend Home & Garden Supply");
slide4 = new slide("mentor.jpg", "It Takes an Individual", "The Shining Light Mentoring Program");
slide5 = new slide("breakfast.jpg", "A Bountiful Christmas Breakfast", "Enjoy time with family");
slide6 = new slide("clothing.jpg", "Elevation", "Your source for outdoor gear");
slide7 = new slide("sunset.jpg", "Ellison Lieberman", "Vermont's first lady of art");
slide8 = new slide("skier.jpg", "Masters of the Slopes", "Suicide Six has a reputation for competition");
slide9 = new slide("pharmacy.jpg", "The Woodstock Pharmacy", "A community fixture since 1845");

//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();
}