jQuery(
	function($)
	{
		var beforeShow = function()
		{
			$this = this;
			$this.parent("li").children("a").addClass("in");
		};


		var click = function(ev)
		{
			if (this.href === "#" || this.href === location.protocol + "//" + location.hostname + "/#")
			{
				ev.preventDefault();
				return false;
			}
		};


		var hide = function()
		{
			$this = this;
			$this.parent("li").children("a").removeClass("in");
		};


		var openExternalLink = function()
		{
			$(this).data("href", this.href);
			this.href = "#";

			$(this).click(
				function(ev)
				{
					window.open($(this).data("href"), "newWindow", "height=700,width=660");

					ev.preventDefault();
					return false;
				}
			);
		};


		var superfishSettings =
		{
			delay: 300,
			dropShadows: false,
			disableHI: true,
			onBeforeShow: beforeShow,
			onHide: hide
		};


		$("ul.sf-menu a").click(click);
		$("ul.sf-menu a[rel=external]").each(openExternalLink);
		$("ul.sf-menu").superfish(superfishSettings);
		$(".sf-sub-indicator").each(function() {this.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;";});
	}
);

