
function doOnload() 
{
	theForm=document.forms[0];
	if (parent != self) 
		top.location.href=window.location.href;
		
	if (theForm.username.value.length==0)
	theForm.username.focus();
	else
	theForm.password.focus();
}
function handleEnter(event)
{
	var keyCode=event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13)
		submitLogin();
}
function submitLogin() 
{
	if (theForm.username.value.length > 2 && theForm.password.value.length > 5) 
	{
		theForm.x.value='cCore.lostPassword';
		theForm.submit();
	}
}
function doForgotPassword(controller) 
{
	if (trim(theForm.username.value) == '') 
	{
		alert("Fyll i ditt användarnamn");
	} 
	else 
	{
		theForm.x.value=controller + '.lostPassword';
		theForm.submit();
	}
}


var secondSpan=5;
function doOnLoadLogin() {
	failCounter = setInterval(doCounter,1000);
	document.loginForm.submitButton.disabled=true;
}
function doCounter() {
	secondSpan--;
	get_object('span_seconds').innerHTML=secondSpan;
	if (secondSpan <= 0) {
	document.loginForm.submitButton.disabled=false;
	document.getElementById('loginMsg').innerHTML   = '<font color="green">F&ouml;rs&ouml;k igen</font>';
	clearInterval(failCounter);
	}
}

