/**
 * Javascript SlideShow helper
 */
function SlideShow(posId, pos, imageId, imageVect, descId, descVect)
{	
	this.posId = posId;
	this.pos = pos;
	this.imageId = imageId;
	this.imageVect = imageVect;
	this.descId = descId;
	this.descVect = descVect;
};

SlideShow.prototype.next = function()
{
	this.goto(this.pos + 1);
};

SlideShow.prototype.prev = function()
{
	this.goto(this.pos - 1);
};

SlideShow.prototype.goto = function(newPos)
{
	//starts from 1 not 0!
	var size = this.imageVect.length - 1;
	if (newPos >= 1 && newPos <= size)
	{
		this.pos = newPos;

		//decrement pos item if any
		var posItem = document.getElementById(this.posId);
		if (posItem)
			posItem.innerHTML = this.pos;
			
		//change pic if any
		var imageItem = document.getElementById(this.imageId);
		if (imageItem)
			//imageItem.src = this.imageVect[this.pos];
			blendimage(this.imageId, this.imageVect[this.pos])

		//change desc if any
		var descItem = document.getElementById(this.descId);
		if (descItem)
		{
			if (this.descVect[this.pos] == '')
				descItem.style.display = 'none';
			else
				descItem.style.display = 'block';
			descItem.innerHTML = this.descVect[this.pos];
		}
	}
	else
		return;
};