function mnsLogin() {
	var ajaxVar = getAjaxRequestVariable(); 
	var query = createLoginQuery(); 
	var msgLoginErr = 'User name and password do not match.\nPlease try again.\nYou may have your user name and password emailed to you by clicking on the appropriate links.';

	ajaxVar.onreadystatechange = function() { 
		if(ajaxVar.readyState == 4) { 
			var loginID = ajaxVar.responseText;
			if  (loginID > 0) { 
  			var lGUID = mnsGUID();
  			storeLoginInfo(loginID,lGUID);
        setCookie("mnsVisitGuid",lGUID,0);
        setCookie("mnsStatic",loginID,0);
        var userName = getUserName();
        alert('Thank You, '+userName+'\nYou are now logged in to Compraiser.');
        //setMenuBar();
        //setLoginArea();
        
        if (getCookie("mnsPropertyGuid")) {
          window.location = "http://www.compraiser.com/view.php?GUID=" + getCookie("mnsPropertyGuid");
        } else {
          window.location = "http://www.compraiser.com/";
        }
//      } else {alert(msgLoginErr);}
      } else {alert(lGUID);}
		} 
  } 
	ajaxVar.open("POST", "cgi-bin/mnsLogin.cgi", true); 
	
	//Send the proper header information along with the request
	ajaxVar.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
	ajaxVar.setRequestHeader("Content-length", query.length);
	ajaxVar.setRequestHeader("Connection", "close");
 
	try       {ajaxVar.send(query);} 
	catch (e) {alert(e);} 
} 

function createLoginQuery() { 
	var pairs = new Array();
	var usernameID = document.getElementById("LGN_username");
	var passwordID = document.getElementById("LGN_password");

	pairs.push(usernameID.name + "=" + usernameID.value); 
	pairs.push(passwordID.name + "=" + passwordID.value); 
	return pairs.join("&"); 
}

function verifyLogin() {
	var userID = getCookie("mnsStatic");
	if (userID == null) {
		alert('Your are not logged in.\nEither log in using your username and password or set up an account.');
		window.location.href="http://www.compraiser.com";
  	//var userName = getCookie("mnsUserName");
  } 
} 

function isNumeric(input)
{
   return (input - 0) == input && input.length > 0;
}

