function banner(elmImages, elmGallery, delayTime, fadeTime) {
	$("#" + elmImages + " img.thumbnail").each(function () {
		$("#" + elmGallery + " .thumbnail:last").clone().attr("src", $(this).attr("src")).insertBefore("#" + elmGallery + " .thumbnail:last").wrap("<a></a>").parent().attr("href", "").click(function () {
			$("#" + elmGallery + " img.full").stop(true);
			$("#" + elmGallery).stopTime(elmGallery + "Timer");
			$("#" + elmGallery + " img.full").fadeTo(100, 1);

			idx = $("#" + elmGallery + " img.thumbnail").parent("a").index(this);

			$("#" + elmGallery + " a.open").attr("href", $("#" + elmImages + " .imageElement:eq(" + idx + ") a.open").attr("href"));
			$("#" + elmGallery + " .title").html($("#" + elmImages + " .imageElement:eq(" + idx + ") h3").html());
			$("#" + elmGallery + " .description").html($("#" + elmImages + " .imageElement:eq(" + idx + ") p").html());
			$("#" + elmGallery + " img.full").attr("src", $("#" + elmImages + " .imageElement:eq(" + idx + ") img.full").attr("src"));

			$("#" + elmGallery).data("index", idx);

			$("#" + elmGallery + " a.selected img.thumbnail").parent("a").removeClass("selected");
			$("#" + elmGallery + " img.thumbnail:eq(" + idx + ")").parent("a").addClass("selected");

			banner_fade(elmImages, elmGallery)

			return false;
		});
	})

	$("#" + elmGallery + " img.thumbnail:eq(0)").parent("a").addClass("selected");

	$("#" + elmGallery + " .thumbnail:last").remove();

	$("#" + elmGallery + " img.full").hide();

	$("#" + elmGallery + " a.open").attr("href", $("#" + elmImages + " .imageElement:eq(0) a.open").attr("href"));
	$("#" + elmGallery + " .title").html($("#" + elmImages + " .imageElement:eq(0) h3").html());
	$("#" + elmGallery + " .description").html($("#" + elmImages + " .imageElement:eq(0) p").html());
	$("#" + elmGallery + " img.full").attr("src", $("#" + elmImages + " .imageElement:eq(0) img.full").attr("src"));

	$("#" + elmGallery).data("index", 0);
	$("#" + elmGallery).data("delay_time", delayTime);
	$("#" + elmGallery).data("fade_time", fadeTime);

	$("#" + elmGallery + " img.full").fadeIn(fadeTime, banner_fade(elmImages, elmGallery));
}

function banner_fade(elmImages, elmGallery) {
	var fadeTime = $("#" + elmGallery).data("fade_time");
	var delayTime = $("#" + elmGallery).data("delay_time");

	$("#" + elmGallery).oneTime(delayTime, elmGallery + "Timer", function () {
		$("#" + elmGallery + " img.full").fadeOut(fadeTime, function () {
			var idx = $("#" + elmGallery).data("index");
			var len = $("#" + elmImages + " .imageElement").length;

			var new_idx = (idx < len - 1) ? idx + 1 : 0;

			$("#" + elmGallery).data("index", new_idx);

			$("#" + elmGallery + " a.open").attr("href", $("#" + elmImages + " .imageElement:eq(" + new_idx + ") a.open").attr("href"));
			$("#" + elmGallery + " .title").html($("#" + elmImages + " .imageElement:eq(" + new_idx + ") h3").html());
			$("#" + elmGallery + " .description").html($("#" + elmImages + " .imageElement:eq(" + new_idx + ") p").html());
			$("#" + elmGallery + " img.full").attr("src", $("#" + elmImages + " .imageElement:eq(" + new_idx + ") img.full").attr("src"));

			$("#" + elmGallery + " a.selected img.thumbnail").parent("a").removeClass("selected");
			$("#" + elmGallery + " img.thumbnail:eq(" + new_idx + ")").parent("a").addClass("selected");

			$("#" + elmGallery + " img.full").fadeIn(fadeTime, banner_fade(elmImages, elmGallery));
		});
	});
}