/*Controls the slideshow */
var i=0;
   var paused=false;
   var interval;
   function loadPics() //Pre-loads slideshow images.
   {
      var image1=new Image();
      image1.src="slideshow/image1.png";
      var image2=new Image();
      image2.src="slideshow/image2.png";
      var image3=new Image();
      image3.src="slideshow/image3.jpg";
      var image4=new Image();
      image4.src="slideshow/image4.jpg";
      var image5=new Image();
      image5.src="slideshow/image5.jpg";
      images=new Array();
      images[0]=image1.src;
      images[1]=image2.src;
      images[2]=image3.src;
      images[3]=image4.src;
      images[4]=image5.src;
   }
   function next() //Function for the "next arrow
   {
      if(i<images.length-1)
      {
         i++;
         document.getElementById('picture').src=images[i];
      }
      else
      {
         i=0;
         document.getElementById('picture').src=images[i];
      }
     
   }

   function prev() //Function for the previous arrow
   {
      if (i>0)
      {
         i--;
         document.getElementById('picture').src=images[i];
      }
      else
      {
         i=images.length-1;
         document.getElementById('picture').src=images[i];
      }
   }

   function slide() //Sets the interval based on the browser
   {
	if(navigator.appVersion.indexOf("MSIE") == -1)
      	{
         	interval = setInterval(FFSlideshow,6000);
      	}
      	else
      	{
         	interval = setInterval(slideshow,6000);
      	}
    }
  
   function slideshow() //Increments through the images.
   {
      if (i<images.length-1)
      {
         i++;
         document.getElementById('picture').src=images[i];
      }

      else
      {
         i=0;
         document.getElementById('picture').src=images[i];
      }
   }

function FFSlideshow() //Increments through the images in Firefox.
   {
      if (i<images.length-1)
      {
         i++
         document.getElementById('picture').src=images[i];
      }
  
      else
      {
         i=0;
         document.getElementById('picture').src=images[i];
      }
   }
   function pause() //Pauses the slideshow
   {
            clearInterval(interval);  
   }

   function resume() //Resumes the slideshow
   {
      interval = setInterval(slideshow,9000);   
   }
  
function slidelink(){  
if (i==0)
window.location="/html/visions.php"   
else if (i==1)
window.location="/html/web_res/genealogy.php"
else if (i==2)
window.location="http://lib2go.lib.overdrive.com/"
else if (i==3)
window.location="http://www.tumblebooks.com/library/auto_login.asp?U=springdalepl&P=libra"
else if (i==4)
window.location="http://libraries.mangolanguages.com/springdale/start"

} 

/*Controls the scrolling div*/
var xyz;
function Scroll(id,dis,pos)
{
 	var obj=document.getElementById(id)
 	obj.scrollTop=obj.scrollTop+dis;
 	if (pos){obj.scrollTop=pos; }
 	else {xyz=setTimeout( function(){ Scroll(id,dis); },10); }
}

