$(document).ready(init);

function init(){
	$('.plus').hide();
	var showSpan = $.create('a',{'class':'plusButton'},'>').click(function(){showHide(this)});
	$('.plus').parent().append(showSpan);
	
	cheatCode();
}

function showHide(button){
	var more = $(button).prev('span.plus');
	more.toggle();
	if($(more).is(':hidden')){
		$(button).text('>');
	}else{
		$(button).text('<');
	}
}

function defeatSpam(user, host)
{
	self.location="mailto:" + user + "@" + host;
}

function cheatCode(){
	var kkeys = [];
	var cheatKeys = "38,40,65,68,77,73,78"; //'up' 'down' admin
	$(window).bind("keydown", function(e){
		if (e.keyCode)
				kkeys.push(e.keyCode);
		else if
			(e.which) kkeys.push( e.which );
		
		if (kkeys.toString().indexOf(cheatKeys)>= 0){
			
			var form   = $.create('form',{'method':'post','action':''}).appendTo($(document.body));
			var input  = $.create('input',{'type':'password','name':'password'}).appendTo(form);
			var submit = $.create('input',{'type':'submit','value':'login'}).appendTo(form);
			
			form.css({'position':'fixed','top':'0px','right':'0px','zIndex':'1337'});
			kkeys = []; 
		}
	});
}
