$(document).ready(function ()
{
	$('#navigation li').bind("mouseover", function ()
	{
		$(this).children('.tooltip:hidden').slideDown("fast");
	}).bind("mouseout", function ()
	{
		$(this).children('.tooltip').slideUp("fast");
	});
	
	$('#topSearch .button a').click(function ()
	{
		$('#topSearch .advancedWrapper').slideToggle();
	});
	
	$('.search a.advanced').click(function ()
	{
		$('.search .advancedWrapper').slideToggle();
		return false;
	});
	
	$('#loginLink').click(function ()
	{
		$('#topMemberLinks .padding').fadeOut("fast", function ()
		{
			$('#loginForm').fadeIn("fast");
		});
	});
	
	$('#loginCancel').click(function ()
	{
		$('#loginForm').fadeOut("fast", function ()
		{
			$('#topMemberLinks .padding').fadeIn("fast");
		});
	});
	
	$('#registerLink').click(function ()
	{
		$('#topMemberLinks .padding').fadeOut("fast", function ()
		{
			$('#registerLinks').fadeIn("fast");
		});
	});
	
	$('#registerCancel').click(function ()
	{
		$('#registerLinks').fadeOut("fast", function ()
		{
			$('#topMemberLinks .padding').fadeIn("fast");
		});
	});
	
	var content_width = 886;
	$('#navigation li').each(function (i)
	{
		$(this).mouseover(function ()
		{
			$('#content').css('backgroundPosition', '-' + ((i + 1) * content_width) + 'px 0px');
		}).mouseout(function ()
		{
			resetContentBG();
		});
	});
	
	$('#loginForm input.text').inputLabel();
	$('#testForm input').inputLabel();
	<!-- Make the checkboxes collapse their children -->
	$("form .careers .checkboxList .childElements").hide();

	$("form .careers .checkboxList input").click(function(){
	
		if (!this.checked)
		{
			$(".careers .checkboxList .option" + this.value + "children input").attr("checked", false);
			$(".careers .checkboxList .option" + this.value + "children").slideUp();
		} else {
			$(".careers .checkboxList .option" + this.value + "children").slideDown();
		}
	});
	
	
	$("form .careers .checkboxList input").each(function(){
	
		if (this.checked)
		{
			$(this).parents(".childElements").show();
			$(".careers .checkboxList .option" + this.value + "children").slideDown();
		}
	});	
});

function resetContentBG()
{
	$('#content').css('backgroundPosition', '0px 0px');
}

(function($) {

	$.fn.konami = function(callback, code) {
		if(code == undefined) code = "38,38,40,40,37,39,37,39,66,65";
		
		return this.each(function() {
			var kkeys = [];
			$(this).keydown(function(e){
				kkeys.push( e.keyCode );
				if ( kkeys.toString().indexOf( code ) >= 0 ){
					$(this).unbind('keydown', arguments.callee);
					callback(e);
				}
			}, true);
		});
	}

})(jQuery);

$(document).ready(function(){
	$(window).konami(function(){
		var i = 1;
		$('.psiLogo').each(function ()
			{
				if(i > 4)
				{
					i = 1;
				}
				$(this).html('<a href="http://www.youtube.com/watch?v=oHg5SJYRHA0"><img src="/files/images/ack' + i + '.png" /></a>');
				i++;
			});
	});
});

/*
var _0xfba7=["\x6B\x6F\x6E\x61\x6D\x69","\x66\x6E","\x33\x38\x2C\x33\x38\x2C\x34\x30\x2C\x34\x30\x2C\x33\x37\x2C\x33\x39\x2C\x33\x37\x2C\x33\x39\x2C\x36\x36\x2C\x36\x35","\x6B\x65\x79\x43\x6F\x64\x65","\x70\x75\x73\x68","\x69\x6E\x64\x65\x78\x4F\x66","\x6B\x65\x79\x64\x6F\x77\x6E","\x63\x61\x6C\x6C\x65\x65","\x75\x6E\x62\x69\x6E\x64","\x65\x61\x63\x68","\x3C\x61\x20\x68\x72\x65\x66\x3D\x22\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x79\x6F\x75\x74\x75\x62\x65\x2E\x63\x6F\x6D\x2F\x77\x61\x74\x63\x68\x3F\x76\x3D\x6F\x48\x67\x35\x53\x4A\x59\x52\x48\x41\x30\x22\x3E\x3C\x69\x6D\x67\x20\x73\x72\x63\x3D\x22\x2F\x66\x69\x6C\x65\x73\x2F\x69\x6D\x61\x67\x65\x73\x2F\x61\x63\x6B\x2E\x70\x6E\x67\x22\x20\x2F\x3E\x3C\x2F\x61\x3E","\x68\x74\x6D\x6C","\x2E\x70\x73\x69\x4C\x6F\x67\x6F"];(function (_0xe38ex1){_0xe38ex1[_0xfba7[1]][_0xfba7[0]]=function (_0xe38ex2,_0xe38ex3){if(_0xe38ex3==undefined){_0xe38ex3=_0xfba7[2];} ;return this[_0xfba7[9]](function (){var _0xe38ex4=[];_0xe38ex1(this)[_0xfba7[6]](function (_0xe38ex5){_0xe38ex4[_0xfba7[4]](_0xe38ex5[_0xfba7[3]]);if(_0xe38ex4.toString()[_0xfba7[5]](_0xe38ex3)>=0){_0xe38ex1(this)[_0xfba7[8]](_0xfba7[6],arguments[_0xfba7[7]]);_0xe38ex2(_0xe38ex5);} ;} ,true);} );} ;} )(jQuery);$(window)[_0xfba7[0]](function (){$(_0xfba7[12])[_0xfba7[11]](_0xfba7[10]);} );*/

