$ (function () {
	adjustFooter = function () {
		if ($ ("body").hasClass ("popup") || $ ("body").hasClass ("popup-old")) {
			$ ("div#body").height ("auto");
			var height = $ ("div#header").height () + $ ("div#footer").height () + 87;
			if (($ ("div#body").height () + height) < $ (window).height ()) {
				$ ("div#body").height ($ (window).height () - height);
			}
		} else {
			$ ("div#wrapper").height ("auto");
			var height = $ ("div#topic-path").height () + $ ("div#footer").height () + 62;
			if (($ ("div#wrapper").height () + height) < $ (window).height ()) {
				$ ("div#wrapper").height ($ (window).height () - height);
			}
		}
	}
	$ (window).load (function () {
		adjustFooter ();
	}).resize (function () {
		adjustFooter ();
	});
});

/* [rollover] --------------------------------------------------------------- */
$ (function () {
	$ ("img.hover").each (function () {
		$ ("<img>").attr ("src", this.src.replace (/\.([^.]+)$/, "_hover." + "$1")).appendTo ("body").hide ();
	});
	$ ("a:has(img.hover)").hover (function () {
		$ ("img.hover", this).each (function () {
			this.src = this.src.replace (/\.([^.]+)$/, "_hover." + "$1");
		});
	}, function () {
		$ ("img.hover", this).each (function () {
			this.src = this.src.replace (/_hover\.([^.]+)$/, "." + "$1");
		});
	});
	$ ("input.hover").each (function () {
		$ ("<img>").attr ("src", this.src.replace (/\.([^.]+)$/, "_hover." + "$1")).appendTo ("body").hide ();
		$ (this).hover (function () {
			this.src = this.src.replace (/\.([^.]+)$/, "_hover." + "$1");
		}, function () {
			this.src = this.src.replace (/_hover\.([^.]+)$/, "." + "$1");
		});
	});
});

/* [opener] ---------------------------------------------------------------- */
$ (function () {
	$ ("[target='_opener']").click (function () {
		try {
			window.opener.location.href = this.href;
			window.opener.focus ();
		} catch (e) {
			window.open (this.href, "_opener").focus ();
		}
		return false;
	});
});