/**
 * @author monica
 */

var AlbumDB = 
{ 
	index: 0,
	images_db: null,
	size: 0,
	init: function(images_db)
	{
		this.images_db = images_db;
		this.size = images_db.length;
		this.index = 0;
	},
	next: function()
	{
		this.index++;
		if(this.index == this.size)
		{
			this.index = 0;
		}
	},	
	prev: function()
	{
		if(this.index == 0)
		{
			this.index = this.size - 1;
		}
		else
		{
			this.index = (this.index - 1);
		}
	},
	set: function(index)
	{
		this.index = index;
	},
	get: function()
	{
		return this.images_db[this.index];
	}
};

var AlbumDrawer = 
{
	image: null,
	image_title: null,
	init: function(images_db, image_title,image)
	{
		AlbumDB.init(images_db);
		this.image = image;
		this.image_title = image_title;
		this.show();
	},
	next: function()
	{
		AlbumDB.next();
		this.show();
	},
	prev: function()
	{
		AlbumDB.prev();
		this.show();
	},
	show: function()
	{
		var image = AlbumDB.get();
		$(this.image_title).innerHTML = image[0];
		$(this.image).src = image[1]; 
	}
};
