// Zmienne zależne od języka lc*, imgp itp. są zdefiniowane w show.php

$(function() {
var body = $(document.body);


// Galeria zdjęć
	var photos = $(".fotoGallerySmall");
	var photo = $(".show");
	if (photo.length) {
		var photoA = photo.find("a");
		var photoI = photo.find("img");

		pictures = [];
		if (photos.length) {
			photos.find("a")
				.each(function () { pictures.push($(this).attr("href")); })
				.click(function (e) {
					e.preventDefault();
					sl.trigger("loadStart");
					photoA.attr("href", $(this).attr("href"));
					slimg
						.one("load", function () {
							photoI.attr("src", $(this).attr("src"));
							sl.trigger("loadStop");	})
						.attr("src", $(this).attr("href").replace(/original/, "300x225"));
				});

			// AjaxLoader
			var slimg = $("<img/>");
			var sl = $("<div/>")
				.css({
					top: photoI.position().top+2,
					left: photoI.position().left+2,
					opacity: .5
				})
				.attr("id", "imgLoad")
				.bind("loadStart", function () { $(this).show(); })
				.bind("loadStop", function () { $(this).hide(); })
				.append(slimg);
			body.append(sl);
		} else {
			pictures.push(photoA.attr("href"));
		}
	}
});