﻿//Create a variable to keep track of array position 
var position = 0 

function GetImageSrc()
{
	document.images["image"].src=images[position].src
	
}

function StartStopSlideShow()
{			
	if(typeof bFlag == 'undefined')
	{
		StartSlideShow()
	}
	else if(bFlag)
	{
		StopSlideShow()
	}
	else
	{
		StartSlideShow()
	}			
}

function StartSlideShow()
{			
	document.getElementById("btnStartStop").value = "Stop"
	bFlag = true
	ContinueSlideShow()		
}

function ContinueSlideShow()
{			
	if(bFlag)
	{
		GetNext()
		t= setTimeout("ContinueSlideShow()", 2500)
	}
}

function StopSlideShow()
{			
	document.getElementById("btnStartStop").value = "Play"
	bFlag = false
}

function GetNext()
{			
	if ((position+1) < images.length )
	{
		position=position+1	
		document.images["image"].src= images[position].src
		
	}
	else
	{
		if(bFlag)
		{
			StopSlideShow()
		}
	}				
} 

function GetPrev()
{
	if (typeof bFlag != 'undefined')
	{
		if ( bFlag )
		{
			StopSlideShow()					
		}
	}
	if (position > 0)
	{
		position=position-1
		document.images["image"].src = images[position].src
	}
}

function GetHighRes()
{
	if (typeof bFlag != 'undefined')
	{
		if ( bFlag )
		{
			StopSlideShow()					
		}
	}
	url = images[position].src
	url = url.replace("lowres","highres")
	window.open(url,"Photo")
}
			
			

 