var ProfileMenu = {
	hideTimer: null,
	visible: false,
	
	show: function() {
		var menu = $("profilemenu");
		var link = $("profilelink");
		if (menu) {
			if (this.hideTimer) {
				this.hideTimer.stop();
				this.hideTimer = null;
			}
			
			if (!this.visible) {
				var pos = link.cumulativeOffset();
				pos.left += link.getWidth() - menu.getWidth();
				pos.top += link.getHeight();
				menu.setStyle({left: pos.left + "px", top: pos.top + "px"});
				menu.show();
				ProfileMenu.visible = true;
			}
		}
	},
	
	hide: function() {
		var menu = $("profilemenu");
		if (menu && menu.visible) {
			this.hideTimer = new PeriodicalExecuter(function(pe) {
				pe.stop();
				menu.hide();
				ProfileMenu.visible = false;
			}, 0.1);
		}
	}
};