function detect_enter(event)
{ 
	if (event.keyCode == 13)
		login();
}

function check_remember()
{
	if ($("#username").val() == "")
	{
		$("#username").focus();
		return false;
	}
	
	document.getElementById('form_login').submit();
	return true;
}

function remember_password()
{
	var win = window.open('remember.php', 'remember_password', 'scrollbars=no,menubar=no,height=600,width=550,resizable=no,toolbar=no,location=no,status=no');
	
	if (!win)
		return false;
	
	common_center_window(win, 550, 600);
}

function common_center_window(_window, _width, _height)
{
	var top = 0;
	var left = 0;	
	var ancho_maximo = screen.availWidth;
	var alto_maximo = screen.availHeight;
	
	if (_width == undefined || !_width || _width <= 0 || _width > ancho_maximo)
	{
		_width = ancho_maximo;	
	}
	else
	{
		left = Math.round((ancho_maximo - _width) / 2);
	}
	
	if (_height == undefined || !_height || _height <= 0 || _height > alto_maximo)
	{
		_height = alto_maximo;	
	}
	else
	{
		top = Math.round((alto_maximo - _height) / 2);
	}
	
	_window.resizeTo(_width, _height);
	_window.moveTo(left, top);
	_window.focus();
}