	var interval = 4000;  							//interval set between pictures
	var imageDir = "images/";  						//main directory of images
	var imageNum = 0;								//current image number
	imageArray = new Array();						//array of current images
	var totalImages = 0;							//total amount of images in the array
	var titleOfImages = "";							//title of the group of images
	var locationOfImages = "";						//location of the group of images
	var imageCount = "";							//counter for the images ex. 1 of 3
	var browserCanBlend = (false);					//used to determine if the transitional filter can be used (only in IE)
	var transition = "blendTrans(duration=2)";		//sets the type of transition and the duration
	var timerID = 0;								//sets the interval period
	var playPause = 0;								//sets the playPause var to 0; if even then play; if odd pause
	var autoRun = -1;								//autorun is used to determine if the user has changed the image being used.
	
	//Checks the browser for type
	//If IE then allow for filter to be used, otherwise it is set to false
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
	{
		browserCanBlend = (true);
	}	
	
	//sets the location of the image item that is in the array
	function imageItem(image_location) 
	{
		this.image_item = new Image();
		this.image_item.src = image_location;
	}
	
	function preloadImages(image_location)
	{
		this.image_item = new Image();
		this.image_item.src = image_location;
	}
	
	//gets the image objects source for viewing purposes
	function get_ImageItemLocation(imageObj) 
	{
		return(imageObj.image_item.src)
	}
	
	//gets the correct images number (adds 1 since it is originally in the array format(item 1 is actually 0))
	function get_ImageNum()
	{
		return(imageNum + 1);
	}
	
	//gets the total amount of images currently in the array
	function get_TotalImages()
	{
		return(totalImages);
	}
	
	function set_TotalImages(value)
	{
		totalImages = value;
	}
	
	//gets the current title of the group of images
	function get_TitleOfImages()
	{
		return(titleOfImages);
	}
	
	//sets the current title of the group of images
	function set_TitleOfImages(value)
	{
		titleOfImages = value;
	}
	
	function get_autoRun()
	{
		return(autoRun);
	}
	
	function set_autoRun(value)
	{
		autoRun = value;
	}
	
	//sets the span tags in the body of the HTML code to display the correct text for the title and the counter of the images
	function counterOutput(firstCheck)
	{
		if(firstCheck == 0)
		{
			imageCount = "image: " + 1 + " of " + get_TotalImages();
		}
		else
		{
			if(get_TotalImages()==0)
			{
				imageCount = "";
			}
			else
			{
				imageCount="image: " + get_ImageNum() + " of " + get_TotalImages();
			}
		}
		elementImage = document.getElementById('imageCountOutput');
		elementImage.innerHTML = imageCount;
		elementTitle = document.getElementById('imageTitleOutput');
		elementTitle.innerHTML = "Project: " + titleOfImages + " | Location: " + locationOfImages;
	}

	//gets the next image in the array and returns it
	function getNextImage() 
	{
		imageNum = (imageNum+1) % totalImages;
		var new_image = get_ImageItemLocation(imageArray[imageNum]);
		return(new_image);
	}
	
	//gets the previous image in the array and returns it
	function getPrevImage() 
	{
		if(imageNum == 0)
		{
			imageNum = totalImages;
		}
		imageNum = (imageNum-1) % totalImages;
		var new_image = get_ImageItemLocation(imageArray[imageNum]);
		return(new_image);
	}

	//calls to get the previous image and then updates the image tag in the document that is in its parameter
	function prevImage(place) 
	{
		var new_image = getPrevImage();
		document[place].src = new_image;
		playPause = 1;
		counterOutput('1');
		checkPlayPause();
	}

	//calls to get the next image and then updates the image tag in the document that is in its parameter
	function nextImage(place) 
	{
		var new_image = getNextImage();
		document[place].src = new_image;
		playPause = 1;
		counterOutput('1');
		checkPlayPause();
	}
	
	function setPlayPause(value)
	{
		playPause = value;
		checkPlayPause();
		setTimeout("switchImage('large','1', playPause)",4000);
	}
	
	function getPlayPause()
	{
		return(playPause);
	}
	
	//calls to get the next image for viewing the slideshow and then updates the image tag in the document that is in its parameter
	//Also takes in a second parameter to check if blend should be on
	function switchImage(place, blend, play) 
	{
		if(play == 0)
		{
			var new_image = getNextImage();
			if(blend == '1' && browserCanBlend)
			{	
				document[place].style.filter = transition;
				document[place].filters[0].Apply();
				document[place].filters[0].Play();
			}
			document[place].src = new_image;
			var recur_call = "switchImage('"+place+"','1','0')";
			timerID = setTimeout(recur_call, interval);
			counterOutput('1');
		}
		else if(play == 1)
		{
			clearTimeout(timerID);
		}
		checkPlayPause();
	}
	
	function toPlayPause()
	{
		playPause++;
		playPause = playPause % 2;
		checkPlayPause();
		switchImage('large','1', playPause);
		
	}
	function checkPlayPause()
	{
		if(playPause % 2 == 0)
		{
			document['playPauseButton'].src = "images/pause_button.gif";
		}
		else if(playPause % 2 == 1)
		{
			document['playPauseButton'].src= "images/play_button.gif";
		}
	}
	
	//parameter is a numerical value. This is used to set a timeout for the first initial loading of the page so that the first image stays up for a period of time before continuing to the next image
	function waitTime(interval) 
	{
		setTimeout(waitComplete,interval);
	} 
	
	//After the waitTime function completes this funtion is called to begin the main slideshow
	function waitComplete()
	{
		if(playPause % 2 == 1)
		{
			switchImage('large', '1', '1');
		}
		else if(autoRun == 0)
		{
			switchImage('large', '1', '0');
		}
		else
		{
			toPlayPause();
		}
	}
