jQuery(function ($){
	// Popup links onclick handler
	$('a.popup').click(function (evt) {
		// Open new window
		window.open(this.href);

		// discard event
		return false;
	});

	// Activities popup
	$('a.act-popup, a.news-popup').click(function (evt) {
		var w = this.className.indexOf('act') !== -1 ? 650 : 665;

		// Open new window
		var win = window.open(this.href, '_blank', 'height=600, scrollbars=1, width=' + w);

		// win.focus();

		// discard event
		return false;
	});

	// Auto-numbering for rules
	setSubListNumber($('#rules'));

	if ($.browser.msie && $.browser.version < 7) {
		$('.section tbody tr').hover(
			function () {
				this.style.backgroundColor = '#E9E8D6';
			},
			function () {
				this.style.backgroundColor = 'transparent';
			}
		);
	}

	jQuery('.lightbox a').lightBox({
		fixedNavigation: true
	});
});

function setSubListNumber($ol, parentPrefix)
{
	$ol.children('li').each(function (i, v) {
		var n = i + 1;
		var prefix = parentPrefix ? parentPrefix + '.' + n : n;
		$(this).html(prefix + '. ' + $(this).html());
		setSubListNumber($(this).children('ol'), prefix);
	});
}
