var _key="83 66 65 39 37 40 38";
var _lookkey='';
var _maxkey=6;
function keyListener(e){
	if(e.shiftKey){
		_lookkey=e.keyCode+" "+_lookkey;
		var s=_lookkey;
		if(s.length>_key.length){
			s=s.substring(0,s.length-(s.length-_key.length));
		}
		if(s==_key){startIt(e);}
		//window.document.title=s;
	}
}
var _xss=0;
var _origcolor=null; 
var _triggered=false;
function startIt(e){
	if(_triggered==false){
		_triggered=true;
		$(document).click(
			function(e){
				if (typeof(e)=="undefined")e=event;
				if(_triggered)$("body").tmmc({firedEvent:e,duration:7000, animationSteps:10});
			}
		);
		//popmessage of what is going on
		sprpopMessage(e);
	}
	_xss++;
	if(_origcolor==null){_origcolor=$('input').css('background-color');}
	if(_xss<_maxkey){
		$('input').css({'background-color' : 'yellow'});
		if(_xss<2){
			setTimeout('continueIt();',100);
		}else{
			setTimeout('continueIt();',150);
		}
	}else{resetit(); _xss=0;}
}
function continueIt(){
	_xss++;
	if(_xss>0&&_xss<_maxkey){
		$('input').css({'background-color' : 'orange'});
		setTimeout('startIt();',150);
	}else{ resetit();_xss=-10; }
}
function resetit(){$('input').css({'background-color' : _origcolor});}

$(document).ready(function() {
	$(document).keyup(function(event) {
		keyListener(event);
		sprayKey(event);
	});
	$(document).mousedown(
		function(e){
			enableSpray=true;
		}
	);
	
	$(document).mouseup(
		function(e){
			enableSpray=false;
		}
	);
	$(document).mousemove(
		function(e){
			trySpray(e);
		}
	);
	$(document).click(
		function(e){
			if(_triggered){
				enableSpray=true;
				counter=0;
				trySpray(e);
				enableSpray=false;
			}
		}
	);
}); 

