function ImgGallery()
{
	this.strFullSizeImgId = '';
	this.strGalleryContainerId = '';

	this.nodFullSizeImg = '';
	this.nodGalleryContainer = '';


	this.strLoadingImgPath = 'img/img_loading.gif';

	this.arrThumbnailImgs = Array();

		// arrays with the full size image properties
	this.arrPreloadedImgs = Array();
	this.arrImgAlt = Array();
	this.arrImgW = Array();
	this.arrImgH = Array();

	this.blnLoaded = false;



	ImgGallery.prototype.configure = function(strFullSizeImgId,strGalleryContainerId)
	{
		this.strFullSizeImgId = strFullSizeImgId;
		this.strGalleryContainerId = strGalleryContainerId;
	}



	ImgGallery.prototype.init = function()
	{
		this.load_images();
		this.set_mousedowns();

	}



	ImgGallery.prototype.load_images = function()
	{
		this.nodFullSizeImg = document.getElementById(this.strFullSizeImgId);
		this.nodGalleryContainer = document.getElementById(this.strGalleryContainerId);

		arrImgNodes = this.nodGalleryContainer.getElementsByTagName('img');

		for (var i=0;i<arrImgNodes.length;i++)
		{
			nodThisNode = arrImgNodes[i];

			strFsImgPath = nodThisNode.getAttribute('fs_src');

			if (strFsImgPath)
			{
				this.arrThumbnailImgs[this.arrThumbnailImgs.length] = nodThisNode;

					// configure the thumbnailnode
				intIndex = this.arrPreloadedImgs.length;

				nodThisNode.intIndex = intIndex;
				nodThisNode.pointer = this;

					// extract info and preload full-size images
				objImage = new Image();
				objImage.src = strFsImgPath;

				this.arrPreloadedImgs[intIndex] = objImage;
				this.arrImgAlt[intIndex] = nodThisNode.getAttribute('alt');
				this.arrImgW[intIndex] = nodThisNode.getAttribute('fs_width');
				this.arrImgH[intIndex] = nodThisNode.getAttribute('fs_height');
			}
		}
	}



	ImgGallery.prototype.set_mousedowns = function()
	{
		for (var i=0;i<this.arrThumbnailImgs.length;i++)
		{
			if (this.arrThumbnailImgs[i].getAttribute('fs_src'))
			{
				this.arrThumbnailImgs[i].onmousedown = function() { this.pointer.set_image(this.intIndex); };
			}
		}
	}



	ImgGallery.prototype.set_random_image = function()
	{
		var intMax = this.arrThumbnailImgs.length;
		var intRandom = Math.floor(Math.random()*intMax);

		this.set_image(intRandom);
	}



	ImgGallery.prototype.set_image = function(intIndex)
	{
		if (this.arrPreloadedImgs[intIndex])
		{
			this.nodFullSizeImg.src = this.arrPreloadedImgs[intIndex].src;
			this.nodFullSizeImg.setAttribute('width',this.arrImgW[intIndex]);
			this.nodFullSizeImg.setAttribute('height',this.arrImgH[intIndex]);
			this.nodFullSizeImg.setAttribute('alt',this.arrImgAlt[intIndex]);
		}

		for (var i=0;i<this.arrThumbnailImgs.length;i++)
		{
			if (i==intIndex)
			{
				this.arrThumbnailImgs[i].className += ' active ';
			}
			else
			{
				this.arrThumbnailImgs[i].className = this.arrThumbnailImgs[i].className.replace('active','');
			}
		}
	}
}