
theimage = new Array();


// The dimensions of ALL the images should be the same (288 high by 384 wide)
// Format: theimage[...]=[image URL, link URL, name/description]
theimage[0]=["http://www.bplsonline.org/images/slideshow/svFiber.jpg", "http://www.bplsonline.org/programs/SV/fiber.html", ""];
theimage[1]=["http://www.bplsonline.org/images/slideshow/mvClub2.jpg", "http://www.bplsonline.org/programs/MV/mvbkclub.html", ""];
theimage[2]=["http://www.bplsonline.org/images/slideshow/mvStitchin.jpg", "http://www.bplsonline.org/programs/MV/stitchinchicks.html", ""];
theimage[3]=["http://www.bplsonline.org/images/slideshow/biClub2.jpg", "http://www.bplsonline.org/programs/BI/bibkclub.html", ""];
theimage[4]=["http://www.bplsonline.org/images/slideshow/compTu.jpg", "http://www.bplsonline.org/programs/SYS/computertutor.html", ""];
theimage[5]=["http://www.bplsonline.org/images/slideshow/TechChat.jpg", "http://bplstechchat.pbworks.com/BPLS%20TechChat%20Home%20Page", ""];
theimage[6]=["http://www.bplsonline.org/images/slideshow/bdClub2.jpg", "http://www.bplsonline.org/programs/BD/bdbkclub.html", ""];
theimage[7]=["http://www.bplsonline.org/images/slideshow/fobkclub.jpg", "http://www.bplsonline.org/programs/FO/fobkclub.html", ""];
theimage[8]=["http://www.bplsonline.org/images/slideshow/foKnit.jpg", "http://www.bplsonline.org/programs/FO/knit.html", ""];
theimage[9]=["http://www.bplsonline.org/images/slideshow/biCraft.jpg", "http://www.bplsonline.org/programs/BI/stitchin.html", ""];
theimage[10]=["http://www.bplsonline.org/images/slideshow/amazon.jpg", "http://www.bplsonline.org/foundation/projects/wishlist.html", ""];
theimage[11]=["http://www.bplsonline.org/images/slideshow/CompSkills101.jpg", "http://www.bplsonline.org/programs/SYS/computer101.html", ""]
theimage[12]=["http://www.bplsonline.org/images/slideshow/learningexpress.jpg", "http://www.learningexpresslibrary.com", ""]
theimage[13]=["http://www.bplsonline.org/images/slideshow/ebaylistings.jpg", "http://cgi6.ebay.com/ws/ebayISAPI.dll?ViewListedItemsLinkButtons&userid=bfplsystem", ""]
theimage[14]=["http://www.bplsonline.org/images/slideshow/Husted.jpg", "http://www.bplsonline.org/programs/MO/Husted.html", ""]
theimage[15]=["http://www.bplsonline.org/images/slideshow/snapshot_VA_logo.jpg", "http://mozart.radford.edu/snapshotvalib/?page_id=8", ""]
theimage[16]=["http://www.bplsonline.org/images/slideshow/ASRP10.jpg", "http://www.bplsonline.org/programs/SYS/ASRP2010.html", ""]
theimage[17]=["http://www.bplsonline.org/images/slideshow/2010QuiltShow.jpg", "http://www.bplsonline.org/programs/BD/quilt.html", ""]
theimage[18]=["http://www.bplsonline.org/images/slideshow/MOvec.jpg", "http://www.bplsonline.org/programs/MO/MOvec.html", ""]



/// Plugin variables

playspeed=10000;
// The playspeed determines the delay for the "Play" button. Convert is 10 secs = 10000.

//key that holds where in the array u currently are
i=0;


//function to create a random order
function SetRandom() {
	tempimage = new Array();
	for(p=0; p<theimage.length; p++) {
		for(p1=0; p1>-1; p1) {
			tempNum = Math.floor(Math.random()*theimage.length)
			if(!tempimage[tempNum]) {
				tempimage[tempNum]=theimage[p];
				break;
			}
		}
	}
	for(p=0;p<theimage.length;p++)theimage[p]=tempimage[p];
}


SetRandom()


//###########################################
window.onload=function() {

	//preload images into browser
	preloadSlide();

	//set the first slide
	SetSlide(0);

	//autoplay on
	PlaySlide();
}


function SetSlide(num) {
	//too big
	i=num%theimage.length;
	//too small
	if(i<0)i=theimage.length-1;

	//switch the image
	document.images.imgslide.src=theimage[i][0];

	//for current slide number and total
	document.getElementById('slidecount').innerHTML= "Image "+(i+1)+" of "+theimage.length;

}


//###########################################\
function PlaySlide() {
	if (!window.playing) {
		PlayingSlide(i+1);
		if(document.slideshow.play) {
			document.slideshow.play.value="   Stop   ";
		}
	}
	else {
		playing=clearTimeout(playing);
		if(document.slideshow.play) {
			document.slideshow.play.value="   Play   ";
		}
	}
	// if you have to change the image for the "playing" slide
	if(document.images.imgPlay) {
		setTimeout('document.images.imgPlay.src="'+imgStop+'"',1);
		imgStop=document.images.imgPlay.src
	}
}


//###########################################\
function PlayingSlide(num) {
	playing=setTimeout('PlayingSlide(i+1);SetSlide(i+1);', playspeed);
}


//###########################################\
function preloadSlide() {
	for(k=0;k<theimage.length;k++) {
		theimage[k][0]=new Image().src=theimage[k][0];
	}
}
