var ModuleImage = Class.create (
{
	initialize : function ()
	{
		this.images = [];
		this.index = 0;

		this.container = 'imageContainer';
		this.previousContainer = 'previousContainer';
		this.nextContainer = 'nextContainer';
	},

	Register : function (index, type, url)
	{
		this.images[index] = { 'type' : type, 'url' : url };
	},

	Show : function (index)
	{
		this.index = index;

		switch (this.images[index].type)
		{
			case "youtube":
				this.ShowYoutube (this.images[index].url);

				break;
			case "image":
				this.ShowImage (this.images[index].url);

				break;
		}

		$(this.previousContainer).setStyle ({ 'display' : index > 0 ? 'block' : 'none' });
		$(this.nextContainer).setStyle ({ 'display' : index < this.images.length - 1 ? 'block' : 'none' });
	},

	ShowYoutube : function (code)
	{
		var url = 'http://www.youtube.com/v/' + code + '?rel=1&fs=1';

		var content = '<object width="501" height="375"><param name="movie" value="' + url + '"></param><param name="allowFullScreen" value="true"></param><embed src="' + url + '" type="application/x-shockwave-flash" width="501" height="375" allowfullscreen="true"></embed></object>';

		$(this.container).innerHTML = content;
	},

	ShowImage : function (url)
	{
		$(this.container).innerHTML = '<img src="' + url + '" alt="" />';
	},
});

var imageObject = new ModuleImage ();
