$(
	function() {
		/* Resources */
		if ($('#resource_tabs')) {
			$('#resources>div').each(
				function() {
					$('#' + this.id + '_tab').click(
						function() {
							/* Reset tabs and content */
							$('#resources>div').hide();
							$('#resource_tabs li').each(
								function () { this.id = this.id.replace(/_active$/, ''); }
							);
							/* Activate requested tab and content */
							$('#' + this.id.replace(/(.+)_tab/, '$1')).show();
							this.id = this.id + '_active';
						}
					);
				}
			);

			/* Activate the first tab */
			if (window.location.href.match(/#contract$/))
				$('#contract_tab a').click();
			else
				$('#no_annual_contract_tab a').click();
		}
	}
);
