
/* funClass informer (need funClass.js)
 * @param id
 */
var informerClass = funClass( {
	create : function ($, spec) {
		$.private.id        = spec.id;
		$.private.rootNode  = document.getElementById(spec.id);
		if (spec.emphasize)
			$.private.emphasize = spec.emphasize.curry($);
		else
			$.private.emphasize = function () { return true; };
		if (spec.onUpdated)
			$.private.onUpdated = spec.onUpdated.curry($);
		$.private.span      = spec.span || $.private.span;
		$.private.today     = new Date();
	},
	public : {
		span   : 14 * 24 * 60 * 60 * 1000, // two weeks
		update : function ($) {
			var collection = $.private.rootNode.getElementsByTagName("ins");
			var i, l = collection.length;
			for (i=0; i<l; i++)
				if ($.private.isRecent(collection[i].dateTime))
					$.private.emphasize(collection[i]);
			delete collection;

			if ($.private.onUpdated && ("function" === typeof $.private.onUpdated))
				$.private.onUpdated();
		},
		onUpdated : null
	},
	private : {
		id : "",
		rootNode : null,
		isRecent : function ($, dateTime) {
			var d  = parseDateTime(dateTime);
			var dt = new Date(d.year, d.month-1, d.date, d.hours, d.minutes, d.seconds, d.timeZoneOffset);
			return ($.private.today - dt) < $.public.span;
		}
	}
} );

