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

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

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

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

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

			banner_fade(elmImages, elmGallery)

			return false;
		});
	})

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

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

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

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

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

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

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

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

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

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

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

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

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