var Galeria = Class.create({
	pos: -1,
	images: null,
	initialize: function(images) {
		this.images = images;
//		$("galeria_left").hide();
//		if (images.length < 2) $("galeria_right").hide();
		images.each(function(item) {
			var img = document.createElement("img");
			img.src = item.src;
			img.style.display = "none";
			$("galeria").appendChild(img);
			item.image = img;
		});
		this.show(0);
	},
	step: function(n) {
		this.show(this.pos + n);
	},
	show: function(x) {
		if (x < 0 || x >= this.images.length) return;
		
		if (x == 0) $("galeria_left").hide();
		else $("galeria_left").show();
		
		if (x >= this.images.length - 1) $("galeria_right").hide();
		else $("galeria_right").show();
		
		$("galeria_title").update(this.images[x].title);
		
		if (this.pos > -1) {
			Element.hide(this.images[this.pos].image);
		}
		Element.show(this.images[x].image);
		
		this.pos = x;
	}
});

var Level = {
	kiir: function(x, y) {
		document.write(x);
		document.write("@");
		document.write(y);
	},
	kuld: function(x, y) {
		document.location.href = "mai" + "lto:" + x + "@" + y;
	}
}