function init()
{
	var email   = string_GetURLValue("email");
	
	if (email != "")
	{
		document.frmLogin.emailLogin.value = email;
		document.frmLogin.pwdLogin.focus();
	}
	else
	{
		document.frmLogin.emailLogin.focus();
	}
		
	checkShowInvalid();	
	checkFromOtherLogin();
	checkShowAcctExists();
		
}	
function checkFromOtherLogin()
{
	var source = string_GetURLValue("source");
	
	if (source == "login")
	{
		document.frmLogin.source.value = "login";
	}	
}

function checkShowInvalid()
{
	var invalid = string_GetURLValue("invalid");	
	if (invalid == "true")
	{
		document.getElementById("showLoginFailed").style.display = "inline";
	}	 
}

function checkShowAcctExists()
{
	var acctExists = string_GetURLValue("acctExists");	
	if (acctExists == "true")
	{
		document.getElementById("showAcctExists").style.display = "inline";
	}	 
}

function getError()
{
	var sSearch = window.location.search;
	var iStart = sSearch.indexOf("err=already");
	if(iStart != -1)
	{
		var arrResult;
		arrResult = sSearch.split("=");
		email = arrResult[2];
		document.write ("<font color='red' size='1'>The e-mail address you entered is already associated with an account in our system.  Please log in using your password.  If you do not remember your password, please click the Forgot Your Password? link below.</font>");
	}
	else
		document.write ("<font color='white' size='1'>To access your account information please Login!</font>");
}

function login()
{
	var blGo;
	var objFrm = document.frmLogin;

	blGo = isBlank(objFrm.emailLogin, "Email");
	if (! blGo) return false;

	//Evaluate email for valid format
	//alert('about to go to basicEmailCheck');
	blGo = basicEmailCheck(objFrm.emailLogin.value);
	if (! blGo) return false;

	//Evaluate password
	blGo = isBlank(objFrm.pwdLogin, "Password");
	if (! blGo) return false;

	//Evaluate length of password
	blGo = objFrm.pwdLogin.value;
	if (blGo.length < 4)
	{
		alert("Make sure your password is at least 4 characters long");
		return false;
	}
	return true;
}

function validateLogin()
{
	if (login())
	{
		document.frmLogin.restore.value = "yes";
		document.frmLogin.loginPOP.value = "yes";
		document.frmLogin.submit();
	}
}

function goToEntry()
{
	window.location.href = secureURL("/entry/newentry.aspx");
}