function doLogout() {
	var reqURL = fullPath("do_logout_js.php") +
		"?spud=trooper" +
		"";
	function processLogout(res) {

		if (res) {
			var info = res.getElementsByTagName('info')[0];
			var suc = info.getAttribute('success');		
			var error = info.getAttribute('error');		
			var username = info.getAttribute('username');		
			if (error) {
				alert(error);
			} else if (suc && suc == 'true') {
				logout();
				if (theTopright) {
					theTopright.hideTopRightLinks();
				}
				if (theNavleft.isShowing()) {
					hideLoggedInLinks();
					theNavleft.loadPage('main');
				}
			}
		}
		
	}
	ajax(reqURL, {f: processLogout, counter: 'navMsg', counterMsg: 'logging out'  });
}

function logout() {
	theUsername = '';
	loggedIn = false;
	//
	// invalidate all the html on the map
	//
	markAllDirty('logout');
}

