/*

*/
var login_text = "login is ok";
var alert_message = "Benutzername oder Passwort ist falsch!";
var loginObj={

//Main function
login : function(){



//Get the field values
username = document._DominoForm.Username.value;
password = document._DominoForm.Password.value;

if(username=="" || password==""){
this.resetLogin();
return false;
}
//Set the positng URL -the Names.nsf?login - uses a CGI Variable SERVER_NAME
var hostname=location.hostname;
var url = 'http://'+location.hostname +'/names.nsf?login';

//Encode the parameters
var pars="Username="+encodeURIComponent(username)+"&Password="+encodeURIComponent(password);
//Build the AJAX request	

var myAjax = new Ajax.Request(
url, 
{
method: 'post', 
parameters: pars, 
onComplete: this.processResponse.bindAsEventListener(this)
});
},

processResponse: function(originalRequest){
//Check response to see if the error message is in the string
test=originalRequest.responseText.indexOf(login_text);
if(test!=-1){
//present so just reload the page as the user is logged in
location.replace(window.location);
}else
{
//Got a login error so alert the user and reset the login form
alert(alert_message);
this.resetLogin();
return false;
}
},

resetLogin:function(){
Form.reset('_DominoForm');
Form.focusFirstElement('_DominoForm');
}

}

