diff --git a/mailnews/base/prefs/resources/content/AccountManager.xul b/mailnews/base/prefs/resources/content/AccountManager.xul
index d12dcb7da71..de1de205721 100644
--- a/mailnews/base/prefs/resources/content/AccountManager.xul
+++ b/mailnews/base/prefs/resources/content/AccountManager.xul
@@ -17,6 +17,8 @@
+
+
@@ -70,6 +72,6 @@
-
+
diff --git a/mailnews/base/prefs/resources/content/am-help.js b/mailnews/base/prefs/resources/content/am-help.js
new file mode 100644
index 00000000000..a978bab611e
--- /dev/null
+++ b/mailnews/base/prefs/resources/content/am-help.js
@@ -0,0 +1,97 @@
+/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-1999 Netscape Communications Corporation. All
+ * Rights Reserved.
+ */
+
+/**
+ * Global help XUL document from which the URI corresponding to
+ * the help tag passed is extracted.
+ */
+var gHelpURL = 'chrome://help/content/help.xul';
+
+/**
+ * Key value pairs to derive the tag based on the page loaded.
+ * Each key is the page loaded when user clicks on one of the items on
+ * the accounttree of the AccountManager window.
+ * Value is a tag that is preset which will be used to display
+ * context sensitive help.
+ */
+var pageTagPairs = {
+ "chrome://messenger/content/am-main.xul": "?mail_account_identity",
+ "chrome://messenger/content/am-server.xul": "?mail",
+ "chrome://messenger/content/am-copies.xul": "?mail_copies",
+ "chrome://messenger/content/am-addressing.xul": "?mail_addressing_settings",
+ "chrome://messenger/content/am-offline.xul": "?mail",
+ "chrome://messenger/content/am-smtp.xul": "?mail_smtp"
+}
+
+function doHelpButton()
+{
+ // Get the URI of the page loaded in the AccountManager's content frame.
+ var pageSourceURI = document.getElementById("contentFrame").getAttribute("src");
+ // Get the help tag corresponding to the page loaded.
+ var helpTag = pageTagPairs[pageSourceURI];
+
+ // If the help tag is generic, check if there is a need to set tags per server type
+ if (helpTag == "?mail") {
+ // Get server type, as we may need to set help tags per server type for some pages
+ var serverType = GetServerType();
+
+ /**
+ * Check the page to be loaded. Following pages needed to be presented with the
+ * help content that is based on server type. For any pages with such requirement
+ * do add comments here about the page and a new case statement for pageSourceURI
+ * switch.
+ * - server settings ("chrome://messenger/content/am-server.xul")
+ * - offline/diskspace settings ("chrome://messenger/content/am-offline.xul")
+ */
+ switch (pageSourceURI) {
+ case "chrome://messenger/content/am-server.xul":
+ helpTag = "?mail_server_" + serverType;
+ break;
+
+ case "chrome://messenger/content/am-offline.xul":
+ helpTag = "?mail_offline_" + serverType;
+ break;
+
+ default :
+ break;
+ }
+ }
+
+ if ( helpTag )
+ openHelp(gHelpURL + helpTag);
+ else
+ openHelp(gHelpURL + '?mail');
+}
+
+/**
+ * Get server type of the seleted item
+ */
+function GetServerType()
+{
+ var serverType = null;
+ var idStruct = getServerIdAndPageIdFromTree(accounttree);
+ if (idStruct) {
+ var account = getAccountFromServerId(idStruct.serverId);
+ if (account) {
+ serverType = account.incomingServer.type;
+ }
+ }
+ return serverType;
+}
diff --git a/mailnews/jar.mn b/mailnews/jar.mn
index fec33d06bdf..3a3611f5695 100644
--- a/mailnews/jar.mn
+++ b/mailnews/jar.mn
@@ -31,6 +31,7 @@ messenger.jar:
content/messenger/AccountManager.js (base/prefs/resources/content/AccountManager.js)
content/messenger/am-main.xul (base/prefs/resources/content/am-main.xul)
content/messenger/am-main.js (base/prefs/resources/content/am-main.js)
+ content/messenger/am-help.js (base/prefs/resources/content/am-help.js)
content/messenger/am-identity-advanced.xul (base/prefs/resources/content/am-identity-advanced.xul)
content/messenger/am-identity-advanced.js (base/prefs/resources/content/am-identity-advanced.js)
content/messenger/am-server.xul (base/prefs/resources/content/am-server.xul)