/**
 * modified behaviour library
 * works with prototype 1.5.1.1
 */

var Behaviour = {
	list: new Array(),

	register: function (sheet)
	{
		Behaviour.list.push(sheet);
	},

	apply: function ()
	{
		var selector;
		var element;
		var sheet;
		var list;
		var h;
		var i;

		for (h = 0; sheet = Behaviour.list[h]; h++)
		{
			for (selector in sheet)
			{
				list = $(document.body).getElementsBySelector(selector);

				if (!list) continue;

				for (i = 0; element = list[i]; i++)
				{
					sheet[selector](element);
				}
			}
		}
	}
}

/**
 * init behaviours on document load
 */

Event.observe(window, 'load', Behaviour.apply);