function ank_Gallery(pictures, currPageLabelId, thumb1Id, thumb2Id, thumb3Id, thumb4Id, pictureId, captionId) {
  this.thumb = new Array(4);
  this.thumb[0] = document.getElementById(thumb1Id);
  this.thumb[1] = document.getElementById(thumb2Id);
  this.thumb[2] = document.getElementById(thumb3Id);
  this.thumb[3] = document.getElementById(thumb4Id);
  this.picture = document.getElementById(pictureId);
  this.caption = document.getElementById(captionId);
  this.currPageLabel = document.getElementById(currPageLabelId);
	this.pictures = pictures;
	this.currPage = 0;
	this.totalPages = Math.ceil(pictures.length	/ 4);
	
	this.update();
}

ank_Gallery.prototype.update = function() {
	this.currPageLabel.innerHTML = this.currPage + 1;
	
	for(var i = 0; i < 4; i++) {
		if((this.currPage * 4 + i) < this.pictures.length) {
			this.thumb[i].src = this.pictures[this.currPage * 4 + i][0];
			this.thumb[i].alt = this.pictures[this.currPage * 4 + i][2];
            this.thumb[i].style.display = '';
		} else {
            this.thumb[i].style.display = 'none';
        }
	}
	
}


ank_Gallery.prototype.nextPage = function() {
  if (this.currPage < this.totalPages - 1) {
  	this.currPage++;
		this.update();
  }
}

ank_Gallery.prototype.prevPage = function() {
  if (this.currPage > 0) {
  	this.currPage--;
		this.update();
  }
}

ank_Gallery.prototype.select = function(thumb) {
  this.picture.src = this.pictures[this.currPage * 4 + thumb][1];
  this.picture.alt = this.pictures[this.currPage * 4 + thumb][2];
  this.caption.innerHTML = this.pictures[this.currPage * 4 + thumb][2];
}