// vim:ft=javascript

var getId = function(id) {
	var arrId = id.split("_");
	return arrId[arrId.length - 1];
}

Behaviour.register( {

	// nifty auto-scrolling intrapage navigation links
	'a.goto' : function(el) {
		el.onclick = function() {
			var classes = Element.classNames(el);
			if ($A(classes).length == 2) {
				if ($A(classes)[0] != 'goto') {
					new Effect.ScrollTo($A(classes)[0]);
				} else {
					new Effect.ScrollTo($A(classes)[1]);
				}
				return false;
			}
		}
	},

	// popup javascript date chooser
	'.datechooserbutton' : function(el) {
		var id = getId(el.id);
		el.onclick = function() {
			showChooser(this, id, 'dc_' + id, 1900, 2020, Date.patterns.ShortDatePattern, false);
		}
	}
});

