   var i=0;
   var finished=false;
   var paused=false;
   var running=false;

   function loadPics()
   {
	    document.bgColor='#c1ae49';
      pic1=new Image();
      pic1.src="picturesimages/v1.jpg";
      pic2=new Image();
      pic2.src="picturesimages/v2.jpg";
      pic3=new Image();
      pic3.src="picturesimages/v3.jpg";
      pic4=new Image();
      pic4.src="picturesimages/v4.jpg";
      pic5=new Image();
			pic5.src="picturesimages/v5.jpg";
			pic6=new Image();
			pic6.src="picturesimages/v6.jpg";
			pic7=new Image();
			pic7.src="picturesimages/tp1.jpg";
			pic8=new Image();
			pic8.src="picturesimages/tp2.jpg";
			pic9=new Image();
			pic9.src="picturesimages/un1.jpg";
			pic10=new Image();
			pic10.src="picturesimages/un2.jpg";
			pic11=new Image();
			pic11.src="picturesimages/un3.jpg";
			pic12=new Image();
			pic12.src="picturesimages/un4.jpg";
			pic13=new Image();
			pic13.src="picturesimages/un5.jpg";
			pic14=new Image();
			pic14.src="picturesimages/nsa1.jpg";
			pic15=new Image();
			pic15.src="picturesimages/nsa2.jpg";
			pic16=new Image();
			pic16.src="picturesimages/nsa3.jpg";
			pic17=new Image();
			pic17.src="picturesimages/nsa4.jpg";
			pic18=new Image();
			pic18.src="picturesimages/nsa5.jpg";
			pic19=new Image();
			pic19.src="picturesimages/nsa6.jpg";
			pic20=new Image();
			pic20.src="picturesimages/c1.jpg";
			pic21=new Image();
			pic21.src="picturesimages/c2.jpg";
			pic22=new Image();
			pic22.src="picturesimages/c3.jpg";
			pic23=new Image();
			pic23.src="picturesimages/c4.jpg";
			pic24=new Image();
			pic24.src="picturesimages/c5.jpg";
			pic25=new Image();
			pic25.src="picturesimages/c6.jpg";
			pic26=new Image();
			pic26.src="picturesimages/fb1.jpg";
			pic27=new Image();
			pic27.src="picturesimages/fb2.jpg";
			pic28=new Image();
			pic28.src="picturesimages/fb3.jpg";
			pic29=new Image();
			pic29.src="picturesimages/fb4.jpg";
			pic30=new Image();
			pic30.src="picturesimages/fb5.jpg";
			pic31=new Image();
			pic31.src="picturesimages/o1.jpg";
			pic32=new Image();
			pic32.src="picturesimages/o2.jpg";
			pic33=new Image();
			pic33.src="picturesimages/o3.jpg";
			pic34=new Image();
			pic34.src="picturesimages/o4.jpg";
			pic35=new Image();
			pic35.src="picturesimages/o5.jpg";
			pic36=new Image();
			pic36.src="picturesimages/nscot1.jpg";																		
			pic37=new Image();
			pic37.src="picturesimages/nscot2.jpg";																		
			pic38=new Image();
			pic38.src="picturesimages/nscot3.jpg";																		
			pic39=new Image();
			pic39.src="picturesimages/nscot4.jpg";																		
			pic40=new Image();
			pic40.src="picturesimages/nscot5.jpg";																		
			pic41=new Image();
			pic41.src="picturesimages/nscot6.jpg";																		
																					
			pict=new Array();
			wrd=new Array();
			ttl=new Array();
			
			wrd[0]= "Voorheesville Railroad Station was built in 1889 by two railroads: the Albany & Susquehanna and the Saratoga & Hudson River Railroads. The garden in the foreground was created by station agent, Franklin Vosburg. Photo c. 1910.";
			wrd[1]= "Tydol Station in Voorheesville, c. 1930, owned by Frank Smith, later Mac McCann and finally the Frohlich Family, until it closed in 1980.  A Stewart's Shop is on the site currently.";
			wrd[2]= "Empire Cider and Vinegar Works began operations in 1890. In 1917 it was purchased by Duffy Mott and continued operation until it closed in 1956.";
			wrd[3]= "Voorheesville Presbyterian Church, c. 1920, was erected on Main Street in 1886.  It disbanded in 1940.  The building was the home of the Voorheesville Public Library from 1950-1989.  Currently it is the home of the Old Songs Group.";
			wrd[4]= "Voorheesville School, District #10, built in 1867.  Two additional rooms were added in the back in 1892 and 1911.  The building was razed in 1930 after the present-day brick building was completed.";
      wrd[5]= "Looking south on Main Street in Voorheesville, c. 1920.  Harris House (hotel) on right, notice boardwalk on both sides of the street.";
      wrd[6]= "The old Indian Ladder Road passes through the Helderberg Escarpment, c. 1900.";
      wrd[7]= "Helderberg Castle, also called Federalburg, was built by Bouck White on a cliff overlooking New Salem.  Bouck White began the building in 1934.  He made pottery and sold it to the tourists.";
			wrd[8]= "Early view of the Unionville Reformed Church, built in 1825.";
			wrd[9]= "Old Unionville School, District # 13, c. 1898. It stood on the steep part of Unionville Hill.";
			wrd[10]= "Unionville Hotel, built c. 1810.  The Rensselaerville-Albany Stage kept a relief team there.  Once contained the post office, called Union Church.";
			wrd[11]= "4  Stony Hill School, built in 1884. Photo c. 1894.";
			wrd[12]= "View down Unionville Hill looking towards Albany, c. 1920.";
			wrd[13]= "This hotel in New Salem was often referred to as the 'Upper Hotel,' located on the southwest corner of the intersection in New Salem. Photo taken in the early 1880s. Building burned in 1899.";
			wrd[14]= "The Helderberg Garage Towing and Wrecking Service, c. 1925, With all the tourists going to Thacher Park at the time, it was a thriving business. New Salem hotel is to the right, with a dance hall overhead.";
			wrd[15]= "J.M. Erwin's new general store in New Salem as it looked in 1902. The original store was destroyed by fire in 1899.";
			wrd[16]= "This New Salem School was closed in 1903, when the current school building opened.  The building is currently used as a farm machine shed in New Salem, moved from its original site near the 4 corners.";
			wrd[17]= "Ted Kupke's New Salem Garage, built in 1909, operated until 1946.  In the center is the New Salem School, built in 1903, when it had only one room.";
			wrd[18]= "Indian Ladder Lodge, or 'Osterhouts,' was located above New Salem.  The Osterhout brothers ran it from the early 1930s until the late '50s. The building has since burned.";
	    wrd[19]= "The Methodist Society of Clarksville was organized in 1856, with the church being constructed in 1858.  It served the community until the 1960s. Photo c. 1953.";
			wrd[20]= "Clarksville Reformed Church, built 1912-1913, remained until the 1960s when it was torn down.  It replaced the original church built in 1854, which burned in 1912.";
			wrd[21]= "Clarksville Hotel, 1911.  This hotel was known as the Clark Tavern at the time of the anti-Rent Wars in the 1830s.  The state militia made the hotel its headquarters and it was nicknamed Fort Clark.";
			wrd[22]= "Myron Earl's Store, c. 1910.  The building still stands near the corner of Route 443 and Mill St. in Clarksville. Note the Killip's Laundry sign.";
			wrd[23]= "Old Clarksville School was located next to the Onesquethaw Creek on the corner of Bennett Hill Rd. and Clarksville South Rd. It closed when the present Clarksville Elementary School opened in the late 1940s.  Parts of the foundation can be seen along the creek.";
			wrd[24]= "This small Flatiron Building (Triangle Building) was located on the corner of Rte. 443 and Tarrytown Road. Over the years it was a butcher shop, offices and a store front.  It no longer exists.";
			wrd[25]= "This brick school in Feura Bush opened in 1929 for grades one through eight.  The school contained four classrooms although only two were used most of the time.  It closed c. 1950.  It has now been converted into apartments for senior citizens.";
			wrd[26]= "Feura Bush Hotel, c. 1925. This hotel was built in the early 19th Century.  Workers stayed here when quarrying stone for the Erie Canal. Currently, it has apartments in it.";
			wrd[27]= "The Jerusalem Reformed Church in Feura Bush was built in 1825.  At the time the church was built, Feura Bush was known as Jerusalem.";
			wrd[28]= "The Feura Bush railroad station, built c. 1870. In addition to handling agricultural products, mail, and regular passengers, the train carried students to Ravena for high school classes for many years.  It ceased to operate around 1940.";
			wrd[29]= "The Feura Bush Creamery, c. 1900, was operated by the Dairyman's League until 1930. It was located on Quarry Road and Rte. 32.  Dairy farmers delivered their milk here from miles around.  It was made into buttermilk, butter and cheese. Milk was also shipped from here to dairies in Albany for bottling.";
			wrd[30]= "Early view of the Onesquethaw Reformed Church, built in 1825 in Tarrytown. This beautiful church was built with stones that were rejected for use in the construction of the Erie Canal.";
			wrd[31]= "The DeLong-Vanderbilt House, built by David DeLong in 1807.  The land has been continuously farmed since that time.";
			wrd[32]= "Onesquethaw School, District #1, was built in 1869 and in use until the 1940s.  Behind the school were two outhouses, one for boys and one for girls.  It was located across from the Onesquethaw Reformed Church.";
			wrd[33]= "Latta's Blacksmith shop, c. 1900, located on Rt. 301 east of the Onesquethaw Reformed Church.  With changing times it became a gas station until it was destroyed by fire in the 1960s.";
			wrd[34]= "Old view of the Onsequethaw Cemetery located on Tarrytown Road.";
			wrd[35]= "The New Scotland School, district #8, was built in 1866.  The school closed in 1953.  It was renovated for use as a Town Hall in May of 1957.  Several additions have been added since that time.";
			wrd[36]= "Lauren Kisselburg with his new garage which opened in 1936.  Prior to this he operated a garage next to the New Scotland Schoolhouse. After his death, his wife operated the garage until 1998.";
			wrd[37]= "The New Scotland Presbyterian Church was organized in 1787, making it the oldest church in the Town of New Scotland.  This present-day church was built in 1849 with additions and renovations since.  There is an old cemetery beside the church.";
			wrd[38]= "This building just off Route 85 in New Scotland housed Crear's Store from 1926 until the 1950s when the new highway was built and the street the store was on became a dead end. Previous to Crear's, it was run by Jay Whitbeck and then was Pearl's Store. The building has been vacant for many years.";
			wrd[39]= "The original Stone Well, located at the corner of Route 85 and 85A, looked much different than it does today.  Opening around 1950, Herb and Dexter Davis ran a delicatessen and snack bar.  Later they expanded the building and ran a grocery store, until";
			wrd[40]= "This grand home on the corner of Route 85 and 85A in New Scotland was built in 1898.  The King family purchased it in 1927 and it was sold by son Richard King in 1996.  Because of the poor condition they had moved out of it in 1974. The house remained vacant until it was demolished in April 2003. The house had five bedrooms, a kitchen, dining room, parlor and reception room. The oval window is part of the NSHA collection.";
			
			pict[0]=pic1.src; 
      pict[1]=pic2.src;
      pict[2]=pic3.src;
      pict[3]=pic4.src;
			pict[4]=pic5.src;
			pict[5]=pic6.src;
			pict[6]=pic7.src;
			pict[7]=pic8.src;
			pict[8]=pic9.src;
			pict[9]=pic10.src;
			pict[10]=pic11.src;
			pict[11]=pic12.src;
			pict[12]=pic13.src;
			pict[13]=pic14.src;
			pict[14]=pic15.src;
			pict[15]=pic16.src;
			pict[16]=pic17.src;
			pict[17]=pic18.src;
			pict[18]=pic19.src;
			pict[19]=pic20.src;
			pict[20]=pic21.src;
			pict[21]=pic22.src;
			pict[22]=pic23.src;
			pict[23]=pic24.src;
			pict[24]=pic25.src;
			pict[25]=pic26.src;
			pict[26]=pic27.src;
			pict[27]=pic28.src;
			pict[28]=pic29.src;
			pict[29]=pic30.src;
			pict[30]=pic31.src;
			pict[31]=pic32.src;
			pict[32]=pic33.src;
			pict[33]=pic34.src;
			pict[34]=pic35.src;
			pict[35]=pic36.src;
			pict[36]=pic37.src;
			pict[37]=pic38.src;
			pict[38]=pic39.src;
			pict[39]=pic40.src;
			pict[40]=pic41.src;
			
			ttl[0]= "Voorheesville 1";
			ttl[1]= "Voorheesville 2";
			ttl[2]= "Voorheesville 3";
			ttl[3]= "Voorheesville 4";
			ttl[4]= "Voorheesville 5";
			ttl[5]= "Voorheesville 6";
			ttl[6]= "Thacher Park 1";
			ttl[7]= "Thacher Park 2";
			ttl[8]= "Unionville 1";
			ttl[9]= "Unionville 2";
			ttl[10]= "Unionville 3";
			ttl[11]= "Unionville 4";
			ttl[12]= "Unionville 5";
			ttl[13]= "New Salem 1";
			ttl[14]= "New Salem 2";
			ttl[15]= "New Salem 3";
			ttl[16]= "New Salem 4";
			ttl[17]= "New Salem 5";
			ttl[18]= "New Salem 6";
			ttl[19]= "Clarksville 1";
			ttl[20]= "Clarksville 2";
			ttl[21]= "Clarksville 3";
			ttl[22]= "Clarksville 4";
			ttl[23]= "Clarksville 5";
			ttl[24]= "Clarksville 6";
			ttl[25]= "Feura Bush 1";
			ttl[26]= "Feura Bush 2";
			ttl[27]= "Feura Bush 3";
			ttl[28]= "Feura Bush 4";
			ttl[29]= "Feura Bush 5";
			ttl[30]= "Onesquethaw 1";
			ttl[31]= "Onesquethaw 2";
			ttl[32]= "Onesquethaw 3";
   		ttl[33]= "Onesquethaw 4";
	 		ttl[34]= "Onesquethaw 5";
			ttl[35]= "New Scotland 1";
			ttl[36]= "New Scotland 2";
			ttl[37]= "New Scotland 3";
			ttl[38]= "New Scotland 4";
			ttl[39]= "New Scotland 5";
			ttl[40]= "New Scotland 6";					
			}
			
   function next()
   {
      finished=false;
      if(i<pict.length-1)
      {
      i++;
      document.getElementById('picture').src=pict[i];
      document.getElementById('caption').innerHTML=wrd[i];
			document.getElementById('slidecounter').innerHTML=ttl[i];
      }
      else
      {
      i=0;
      document.getElementById('picture').src=pict[i];
      document.getElementById('caption').innerHTML=wrd[i];
			document.getElementById('slidecounter').innerHTML=ttl[i];
      }
   }	 
	 
   function prev()
   {
      finished=false;
      if (i>0)
      {
         i--;
         document.getElementById('picture').src=pict[i];
         document.getElementById('caption').innerHTML=wrd[i];
				 document.getElementById('slidecounter').innerHTML=ttl[i];
      }
      else
      {
         i=pict.length-1;
         document.getElementById('picture').src=pict[i];
         document.getElementById('caption').innerHTML=wrd[i];
				 document.getElementById('slidecounter').innerHTML=ttl[i];
      }
   }	 
	 
   function startSlide()
   {
      running=true;
      if(navigator.appVersion.indexOf("MSIE") == -1)
      {
         interval = setInterval(FFSlideshow,5000);
      }
      else
      {
         interval = setInterval(slideshow,5000);
      }
      document.getElementById("slideshow").disabled=true;
      document.getElementById('caption').innerHTML=wrd[i];
			document.getElementById('slidecounter').innerHTML=ttl[i];
   }	 
	 

   function slideshow()
   {
      if (i<pict.length-1)
      {
         document.getElementById('pictureContainer').filters[0].Apply();
         document.getElementById("slideshow").disabled=true;
         i++;
         document.getElementById('picture').src=pict[i];
         document.getElementById('caption').innerHTML=wrd[i];
				 document.getElementById('slidecounter').innerHTML=ttl[i];
         document.getElementById('pictureContainer').filters[0].Play();
      }
      else if (i==pict.length-1 && finished==false)
      {
         document.getElementById("slideshow").disabled=false;
         document.getElementById('caption').innerHTML=wrd[i];
				 document.getElementById('slidecounter').innerHTML=ttl[i];
         finished=true;
         running=false;
         clearInterval(interval);
      }
      else
      {
         document.getElementById('pictureContainer').filters[0].Apply();
         i=0;
         finished=false;
         document.getElementById('picture').src=pict[i];
         document.getElementById('caption').innerHTML=wrd[i];
				 document.getElementById('slidecounter').innerHTML=ttl[i];
         document.getElementById('pictureContainer').filters[0].Play();
      }
   }
	 
   function FFSlideshow()
   {
      if (i<pict.length-1)
      {
         document.getElementById("slideshow").disabled=true;
         i++
         document.getElementById('picture').src=pict[i];
         document.getElementById('caption').innerHTML=wrd[i];
				 document.getElementById('slidecounter').innerHTML=ttl[i];
      }
      else if (i==pict.length-1 && finished==false)
      {
         document.getElementById("slideshow").disabled=false;
         document.getElementById('caption').innerHTML=wrd[i];
				 document.getElementById('slidecounter').innerHTML=ttl[i];
         finished=true;
         running=false
         clearInterval(interval);
      }
      else
      {
         i=0;
         finished=false;
         document.getElementById('picture').src=pict[i];
         document.getElementById('caption').innerHTML=wrd[i];
				 document.getElementById('slidecounter').innerHTML=ttl[i];
      }
   }
	 

   function pause()
   {
      if(running==true)
      {
         if(paused==false)
         {
            paused=true;
            document.getElementById("pause").value="resume";
            clearInterval(interval);
          }
         else
         {
            startSlide()
            paused=false;
            document.getElementById("pause").value="pause";
         }
      }
   }