// This script and many more are available free online at 
// The JavaScript Source!! http://javascript.internet.com 
// Slideshow implementation credited to Denver Public Library 
// Begin
var ie=document.all
NewImg = new Array (
"slideshow/temp1.gif",
"slideshow/perm1.gif",
"slideshow/temp2.gif",
"slideshow/perm2.gif",
"slideshow/temp3.gif",
"slideshow/perm3.gif",
"slideshow/temp4.gif",
"slideshow/perm4.gif"
);

Links=new Array(
"http://www.aapld.org/evanced/lib/eventsignup.asp?ID=6679&rts=&disptype=info&ret=eventcalendar.asp&pointer=&returnToSearch=&SignupType=&num=0&ad=&dt=mo&mo=3/1/2010&df=calendar&EventType=ALL&Lib=&AgeGroup=&LangType=0&WindowMode=&noheader=&lad=&pub=1&nopub=&page=&pgdisp=",
"http://www.aapld.org/evanced/lib/eventcalendar.asp?df=list&kw=book+discussion",
"http://www.aapld.org/evanced/lib/eventsignup.asp?ID=6391&rts=&disptype=&ret=eventcalendar.asp&pointer=&returnToSearch=&SignupType=&num=0&ad=&dt=mo&mo=3/1/2010&df=calendar&EventType=ALL&Lib=&AgeGroup=&LangType=0&WindowMode=&noheader=&lad=&pub=1&nopub=&page=&pgdisp=",
"http://www.museumadventure.org/",
"http://www.aapld.org/evanced/lib/eventsignup.asp?ID=6393&rts=&disptype=&ret=eventcalendar.asp&pointer=&returnToSearch=&SignupType=&num=0&ad=&dt=mo&mo=3/1/2010&df=calendar&EventType=ALL&Lib=&AgeGroup=&LangType=0&WindowMode=&noheader=&lad=&pub=1&nopub=&page=&pgdisp=",
"http://www.aapld.org/youth/science_fair.asp",
"http://www.aapld.org/evanced/lib/eventsignup.asp?ID=6494&rts=&disptype=info&ret=eventcalendar.asp&pointer=&returnToSearch=&SignupType=&num=0&ad=&dt=mo&mo=3/1/2010&df=calendar&EventType=ALL&Lib=&AgeGroup=&LangType=0&WindowMode=&noheader=&lad=&pub=1&nopub=&page=&pgdisp=",
"https://www.aapld.org/eCommerceWebModule/Home"
)


var ImgNum = 0;
var ImgLength = NewImg.length - 1;

//Time delay between Slides in milliseconds
var delay = 8000;
//var lock = false;
var run;

function chgImgPlay(direction) {
pause();
chgImg(direction);
auto();
}

function chgImg(direction) {
if (document.images) {
ImgNum = ImgNum + direction;
if (ImgNum > ImgLength) {
ImgNum = 0;
}
if (ImgNum < 0) {
ImgNum = ImgLength;
}

if (!document.images) return
//if (ie) document.slideshow.style.filter="blendTrans(duration=2)";
//if (ie) document.slideshow.filters.blendTrans(duration=2).Apply();
document.slideshow.src = NewImg[ImgNum];
//if (ie) document.slideshow.filters.blendTrans.Play();
   }

}


function RandomChgImg() {
if (document.images) {
newNumber=(Math.ceil(Math.random() * NewImg.length)-1);
	if (ImgNum != newNumber) {
		ImgNum = newNumber;
	} else {
		ImgNum = ImgNum + 1;
	}

if (ImgNum > ImgLength) {
ImgNum = 0;
}
if (ImgNum < 0) {
ImgNum = ImgLength;
}

if (!document.images) return
//if (ie) document.slideshow.style.filter="blendTrans(duration=2)";
//if (ie) document.slideshow.filters.blendTrans(duration=2).Apply();
document.slideshow.src = NewImg[ImgNum];
//if (ie) document.slideshow.filters.blendTrans.Play();
   }

}
function auto() {
run = setInterval("RandomChgImg()", delay);
}

function play() {
RandomChgImg(1);
auto();
}
function pause() {
//lock = false;
window.clearInterval(run);
}

// toggle visibility of play and pause buttons 
function toggle( targetId_1, targetId_2 ){ 
  if (document.getElementById){ 
        target1 = document.getElementById( targetId_1 ); 
		target2 = document.getElementById( targetId_2 ); 
           if (target1.style.display == "none"){ 
              target1.style.display = "inline"; 
			  target2.style.display ="none";
           } else { 
              target1.style.display = "none"; 
			  target2.style.display= "inline";
           } 
     } 

} 
//function to create where ahref link will go based on image index value, ImgNum.
function gotoshow(){
window.location=Links[ImgNum];
}
//  End -->
