function timeline(elmImages, elmGallery, navGallery, delayTime, fadeTime) {
//	$("#" + elmImages + " img.thumbnail").each(function () {
//		$("#" + elmGallery + " .thumbnail:last").clone().attr("src", $(this).attr("src")).insertBefore("#" + elmGallery + " .thumbnail:last");
//	})

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

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

//	$("#" + 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("#" + elmImages).data("index", 0);
	jQuery("#" + elmImages).data("delay_time", delayTime);
	jQuery("#" + elmImages).data("fade_time", fadeTime);

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

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

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

			jQuery("#" + navGallery).removeClass();

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

			jQuery("#" + elmImages).data("index", new_idx);
			jQuery("#" + navGallery).addClass("m" + (new_idx + 1));			

			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 + " img.thumbnail.selected").removeClass("selected");
//			jQuery("#" + elmGallery + " img.thumbnail:eq( " + new_idx + ")").addClass("selected");

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

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

function timeline_set(elmImages, elmGallery, navGallery, idx) {
	jQuery("#" + elmGallery + " img.full").stop(true);
	jQuery("#" + elmImages).stopTime(elmGallery + "Timer");
	jQuery("#" + elmGallery + " img.full").fadeTo(100, 1);

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

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

	jQuery("#" + navGallery).removeClass();
	jQuery("#" + navGallery).addClass("m" + (idx));

//	jQuery("#" + elmGallery + " img.full").show();

	jQuery("#" + elmImages).data("index", idx - 1);

	timeline_fade(elmImages, elmGallery, navGallery);	
}
