var combination;

function checkITEH (s) {
	var i;
	var si, st,se,sh;
	si = sh = st = se = 0;
	for (i=0;i<s.length;i++) {
		if (s.charAt(i)=='I')
			si++;
		if (s.charAt(i)=='T')
			st++;
		if (s.charAt(i)=='E')
			se++;
		if (s.charAt(i)=='H')
			sh++;
	}
	if (si*st*se*sh==0) return false;
	return true;
}

$(document).ready(function(){	
	combination = '';
	$(document).keydown(function(event){		
		combination += String.fromCharCode(event.keyCode);
		if (checkITEH(combination)) {
			$("img").each(function(){
				if ($(this).attr("src")!='/egg.jpg')
					$(this).attr("old_src",$(this).attr("src"));
			});
			$("img").attr("src","/egg.jpg");
		}
	});
	$(document).keyup(function(event){
		if (checkITEH(combination)) {
			$("img").each(function(){
				$(this).attr("src",$(this).attr("old_src"));
			});
		}
		combination = '';		
	});
})
