$(document).ready(function() {
	var boxes = ['contact', 'papers'];
	var z = 0;
	for (i in boxes) {
		var box = boxes[i];
		var a = $("a[href='#" + box + "']");
		var c = $('#' + box);
		c.css({ position: 'absolute', top: a.offset().top + a.outerHeight(), left: a.offset().left - c.outerWidth()/2 + a.outerWidth()/2 });
		//c.css({ position: 'absolute', bottom: a.offset().top - 10, left: a.offset().left });
		a.click(function(c) { return function(event) {
			event.preventDefault();
			c.css('zIndex', ++z);
			c.toggle('slow');
			return false;
		}}(c));

		// If accessing #contact, bring up the Contact menu immediately:
		if (window.location.hash == '#'+box) {
			c.css('zIndex', ++z);
			c.show();
		}
	}

	// Hopefully creating this via javascript will trick the spammers, at least a little:
	// (all the "\x61"s are "a"s)
	$('#contact .e-mail').append('<\x61 href="m\x61ilto:j\x61germ\x61n@j\x61germ\x61n.com">j\x61germ\x61n@j\x61germ\x61n.com</\x61>');
	$('#contact .e-mail').append('<br /><\x61 href="m\x61ilto:rhinel\x61j@econ.queensu.c\x61">rhinel\x61j@econ.queensu.c\x61</\x61>');
});

