/**
 * GalleryImage Class
 */

function GalleryImage(aId, aTitle, aDesc, aAlt, aPath)
{
	this.idSwsGalleryImage = aId;
    this.title = aTitle;
    this.description = aDesc;
    this.altText = aAlt;
	this.imagePath = aPath;
}

GalleryImage.currentIndex = 0;
GalleryImage.imageArray = new Array();

GalleryImage.getNextIndex = function()
{
	var index = GalleryImage.currentIndex;
	if(++index == GalleryImage.imageArray.length)
	{
		// back to the first
		GalleryImage.currentIndex = 0;
	}
	else
	{
		//return the incremented index
		GalleryImage.currentIndex = index;
	}

	return GalleryImage.currentIndex;
}

GalleryImage.getPrevIndex = function()
{
	var index = GalleryImage.currentIndex;
	if(--index < 0)
	{
		// back to the first
		GalleryImage.currentIndex = GalleryImage.imageArray.length - 1;
	}
	else
	{
		//return the decremented index
		GalleryImage.currentIndex = index;
	}

	return GalleryImage.currentIndex;
}

GalleryImage.swapImageToIndex = function(newIndex)
{
//	alert("Changing to index: " + newIndex);

	var image = GalleryImage.imageArray[newIndex];
	var d = window.document;

	d.getElementById("idGalleryImage").src = image.imagePath;
	d.getElementById("idGalleryImage").alt = image.altText;

	d.getElementById("idGalleryImageTitle").innerHTML = image.title;
	d.getElementById("idGalleryImageDesc").innerHTML = image.description;

}

