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("invalid username or password");if(test==-1){//Not present so just reload the page as the user is logged in//location.replace(window.location);location.replace('http://www.fbn-i.org/fbn/memberintranet.nsf/doclu/home?OpenDocument')}else{//Got a login error so alert the user and reset the login formalert('Incorrect user name or password');this.resetLogin();return false;}},resetLogin:function(){Element.hide('processing');Form.reset('loginForm');Form.focusFirstElement('loginForm');}}
