/* This Javascript object is used to check to see if a user has entered there correct Domino credientialsRequires: Prototype.js being availableAssociated with: A login form - HTML ID loginFormThe code is formatted in the JSON format for object reuseThis code could break if the standard error message returned by Domino (session based authentication) changes in the future*/var loginObj={//Main functionlogin : function(){//Display busy animationElement.show('processing');//Get the field valuesusername = $F("Username");password = $F('Password');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("forkert");if(test==-1){//Not present so just reload the page as the user is logged intext1 = '<br />Du er allerede logget ind.';location.replace(window.location);}else{//Got a login error so alert the user and reset the login formalert('Du har indtastet forkert brugernavn eller password.');this.resetLogin();return false;}},resetLogin:function(){Element.hide('processing');Form.reset('loginForm');Form.focusFirstElement('loginForm');}}