added conditional login and logout in CMapHeader