var Foyer = Class.create();

Foyer.prototype.initialize = function() {
	
}

Foyer.setup = function() {
	Event.observe(
		document.getElementsByTagName('body')[0], 
		'keydown', 
		new Function('anEvent', 'return Foyer._handleKeyDown(anEvent);')
	);
}

Foyer._handleKeyDown = function(anEvent) {
	if (!anEvent) {
		return false;
	}
	if (anEvent.keyCode == Event.KEY_RETURN) {
		var theKeyEventSrcElement = Event.element(anEvent);
		if (theKeyEventSrcElement.id == 'heslo') {
			if (document.getElementById('heslo').value) {
				return document.getElementById('loginButton').onclick();
			}
		}
		
		return true;
	}
}