function Login()
{
	if(CheckManatoryFields('username', 'Benutzername', '') && CheckManatoryFields('password', 'Passwort', ''))
	{
		http_request.open('POST', "http://www.baanusers.ch/ajax/memberlogin/login.php", true);
		http_request.onreadystatechange = LoginOnStatusChange;
		http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http_request.send('username=' + document.getElementById("username").value + '&password=' + document.getElementById("password").value);
	}
}

function LoginOnStatusChange()
{
	if(4 == http_request.readyState)
	{
		  if(http_request.responseText == "login_ok")
		  {
		 	window.location.href="http://www.baanusers.ch/home";
		  }
		 else
		 {
		 	ShowHideLayer("divLoadingLI", "hidden", "none");
			ShowHideLayer("divFormLI", "hidden", "none");
			ShowHideLayer("divResultLI", "visible", "inline");
			document.getElementById("divResultLI").innerHTML = http_request.responseText;
		 }
	}
	if(1 == http_request.readyState)
	{
		ShowHideLayer("divFormLI", "hidden", "none");
		ShowHideLayer("divResultLI", "hidden", "none");
		ShowHideLayer("divLoadingLI", "visible", "inline");
	}
}