/*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("Hanover-Inn.jpg", "The Hanover Inn", "More than wining & dining");
slide2 = new slide("Ford-Sayre.jpg", "Ford Sayre Ski Club", "Race day from a parent-coach's perspective");
slide3 = new slide("Systems-Plus.jpg", "Systems Plus Computers", "Serving the community for 20 years");
slide4 = new slide("merry-and-bright.jpg", "Merry & Bright", "Simple ingrediants from around town");
slide5 = new slide("green.jpg", "SERG", "A resource for sustainability");
slide6 = new slide("africa.jpg", "Off the beaten path", "Lebanon resident plans African Safaris");
slide7 = new slide("girls.jpg", "Girls Night Out", "Have more than just fun");
slide8 = new slide("roth-ira.jpg", "Conversions and distributions", "Should it be part of your investment strategy?");

//Array of slide objects
var slides=new Array(slide1, slide2, slide3, slide4, slide5, slide6, slide7);   //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();
}