$(document).ready(function()
{
	$("a[rel=external], a[rel=nofollow]").attr("target", "_blank");
	
	$("#nav a, #logo")
	.bind("mouseover focus", function()
	{
		var $this	= $(this);

		if (!$this.data("origBG")) {
			$this.data("origBG", $this.css("backgroundColor"));

		}

		if ($this.attr("id") === "logo" && $this.data("origBG") === "transparent") {
			$this.data("origBG", "#12142B");
		}
		
		$this.stop().animate({
			backgroundColor	: "#283050"
		}, 300);
	})
	.bind("mouseout blur", function()
	{
		$(this).stop().animate({
			backgroundColor	: $(this).data("origBG")
		}, 300);
	});
	
	General.initAccessKeys();
});

General	=
{
	initAccessKeys	: function()
	{
		$(window).bind("keydown keyup", this._handleAccessKeys);
	},
	
	_handleAccessKeys	: function(evt)
	{
		if (evt.type == "keydown" && evt.altKey)
		{
			toShowAccess	= setTimeout(function()
			{
				$("#access").fadeIn(600);
			}, 500);
			
			$(window).unbind("keydown", General._handleAccessKeys);
		}
		
		if (evt.type == "keyup" && !evt.altKey)
		{
			if (typeof toShowAccess != "undefined")
				clearTimeout(toShowAccess);
			
			$("#access").fadeOut(300);
			$(window).bind("keydown", General._handleAccessKeys);
		}

	}
};

function cout(sMsg)
{
	if (window.console)
		console.log(sMsg);
}