//Author:Bryan Black 
//Notes: This is a portable Javascript slideShow all you have to do is load the initial array with the absolute directory path of the images and it does the work
//***** For you
//Installation info: 
//This script requires prototype to run. It depends heavily on the class creation tools as well as the event listeners. 
//Just to emphasis further you need to include the prototype script before the slideshow script for this to work. 
//The image size and aspect ration is contorl by css  
//Inside the xhtml include an <img> tag with an id. This will be used to produce the slideshow



//*********************************
//This class will build the slide show and export it to the img tag's src


var slideShow = Class.create({

	initialize: function(arySlides,imageID){
		//Here we will set up all the variables we will need 
		this.slides = arySlides; //Get the array of all the images in it 
		this.slideCount = this.slides.length; //Grab the array's index length 
		this.stage = 0; //Set our slide show stage to 0 
		this.imageID = imageID; //this is the ID of he <img> tag that you plan on using for the slide show. 
	},//End of the consturct method,

	rotate: function(){
		//In here we will rotate the images every so often. 
		if(this.stage != (this.slideCount - 1)){
			this.stage++;
			document.getElementById(this.imageID).src = this.slides[this.stage]; //Replace the image with a new one 
		}else {
			this.stage = 0 
			document.getElementById(this.imageID).src = this.slides[this.stage]; //Replace the image with the starting image once we reach the end of the line
		}

	}

});



function loadSlideShow(){

images = new Array(
	'http://151.141.90.97/images/slideshow/BMS Fall 2008 - Cadet Jered Collins.png',
	'http://151.141.90.97/images/slideshow/BN Run.png',
	'http://151.141.90.97/images/slideshow/Cadets.png',
	'http://151.141.90.97/images/slideshow/Color Guard.png',
	'http://151.141.90.97/images/slideshow/Commissioning Spring 2008.png',
	'http://151.141.90.97/images/slideshow/CWST - Cadet Jonathan Morgan.png',
	'http://151.141.90.97/images/slideshow/Halloween Run Fall 2007.png',
	'http://151.141.90.97/images/slideshow/Lowcrawl.png',
	'http://151.141.90.97/images/slideshow/LTC Campaign Pizza Party.png',
	'http://151.141.90.97/images/slideshow/Mens Soccer Game.png',
	'http://151.141.90.97/images/slideshow/Military Ball 2008.png',
	'http://151.141.90.97/images/slideshow/PT Awards.png',
	'http://151.141.90.97/images/slideshow/Stand To Awards.png',
	'http://151.141.90.97/images/slideshow/Stand To PT.png',
	'http://151.141.90.97/images/slideshow/215625862.jpg',
	'http://151.141.90.97/images/slideshow/215626250.jpg',
	'http://151.141.90.97/images/slideshow/215627439.jpg',
	'http://151.141.90.97/images/slideshow/215627709.jpg',
	'http://151.141.90.97/images/slideshow/215627840.jpg',
	'http://151.141.90.97/images/slideshow/215627884.jpg',
	'http://151.141.90.97/images/slideshow/215628239.jpg',
	'http://151.141.90.97/images/slideshow/215628473.jpg',
	'http://151.141.90.97/images/slideshow/215628852.jpg',
	'http://151.141.90.97/images/slideshow/220548912.jpg',
	'http://151.141.90.97/images/slideshow/220550444.jpg',
	'http://151.141.90.97/images/slideshow/220551221.jpg',
	'http://151.141.90.97/images/slideshow/220565616.jpg',
	'http://151.141.90.97/images/slideshow/220566632.jpg',
	'http://151.141.90.97/images/slideshow/220571156.jpg',
	'http://151.141.90.97/images/slideshow/220571976.jpg',
	'http://151.141.90.97/images/slideshow/221491759.jpg',
	'http://151.141.90.97/images/slideshow/221492070.jpg',
	'http://151.141.90.97/images/slideshow/221493108.jpg'
	); 
slideShow = new slideShow(images,'slideShow_images'); //Make sure you place the id of the image tag here so it knows where to place the images 
interval = setInterval("slideShow.rotate()", 5000);//Alter this value to speed up or slow down the slideshow 

}


//This is just an event from prototype to call the loadSlideShow function when everything is ready to go 

Event.observe(window, 'load', loadSlideShow);


