function expandLoginComplete()
{
	// Set the focus to the username field.
	var userName = document.getElementById('username');
	userName.focus();
}

var expandLogin = function()
	{

		var effect;
		var f = function()
		{

			var loginFull = document.getElementById('login_full');
			var duration  = 300;
			
			if (!loginFull.expanded)
			{
			
				// Clear the error text.
				var errorMessage = document.getElementById('mod_login_error');
				
				if (errorMessage) {
					errorMessage.innerHTML = '';
				}
				
				if (effect) effect.stop();
				effect = new Fx.Styles(loginFull, {duration: duration, onComplete: expandLoginComplete});
				
				if (!loginFull.targetWidth)
				{
					loginFull.targetLeft	   = loginFull.offsetLeft;
					loginFull.targetWidth      = loginFull.clientWidth;
					loginFull.style.left       = loginFull.targetWidth + 'px';
					loginFull.style.width      = '0px';
					loginFull.style.visibility = 'visible';
				}
				
				if (loginFull.clientWidth == 0)
				{
					loginFull.style.left = (loginFull.targetWidth + loginFull.targetLeft) + 'px';
				}
				
				effect.start({ 'width': [loginFull.style.width, loginFull.targetWidth], 'left': [loginFull.style.left, loginFull.targetLeft] });
			
				loginFull.expanded = true;
				
			}
			else
			{
				if (effect) effect.stop();

				effect = new Fx.Styles(loginFull, {duration: duration});

				effect.start({ 'width': [loginFull.style.width, 0] });
			
				loginFull.expanded = false;
			}
		
		}
		
		return f;
		
	}();