<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxsl="urn:schemas-microsoft-com:xslt"
      xmlns:user="http://travelers.com/dynportal">

<msxsl:script language="csharp" implements-prefix="user">
  <msxsl:assembly name="System.Core" />
  <msxsl:using namespace="System.IO" />
  <msxsl:using namespace="System.Collections.Generic" />
    
    <![CDATA[
        int tabNumber = 0;
        string bannerIncludeUrl = string.Empty;
        string bannerIncludeMarginTop = string.Empty;
        string bannerIncludeMarginLeft = string.Empty;
        string bannerIncludeHeight = string.Empty;
        string bannerIncludeWidth = string.Empty;
        string bannerIncludeDisplay = string.Empty;
        string hidealltabs = string.Empty;

        public XmlElement GetXmlElement(XPathNodeIterator oNode, Boolean isMoveNext = true)
        {
            if (isMoveNext) oNode.MoveNext();
            var oDoc = new XmlDocument();
            oDoc.Load(new StringReader(oNode.Current.OuterXml));
            return oDoc.DocumentElement;
        }

        public string buildTabArray(XPathNodeIterator oNode1)
        {
            var root = GetXmlElement(oNode1);
            var resultstr = string.Empty;
            var arrInit = "\nvar g_Tabs = new Array;\nvar g_TabLength = new Array;\n";

            var domain = root.SelectSingleNode("/Portal/MultipleDomains/text()");
            if (domain != null)
            {
                resultstr += domain.InnerText == "true"
                    ? "var domainValue=getDomain(); \n document.domain = domainValue;\n " + arrInit
                    : arrInit;
            }
            else
            {
                resultstr += "var domainValue=getDomain(); \n document.domain = domainValue;\n " + arrInit;
            }

            hidealltabs = root.SelectSingleNode("/Portal/HideAllTabs/text()").InnerText;

            var tabList = "/Portal/Tab[Visible='true']";
            var tabNodeList = root.SelectNodes(tabList);

            var defaultTabStr = "defaultTab = ''";
            var bGotDefaultTab = "false";
            var i=0;
            if(tabNodeList != null )
            {
              foreach(XmlElement data in tabNodeList)
              {
                var thisTab = data;
                var tabId = thisTab.SelectSingleNode("Id/text()").InnerText;
                var tabName = thisTab.SelectSingleNode("Description/text()").InnerText;
                var tabNameLength = getTabNameLength(tabName);

                resultstr = string.Format("{0}g_Tabs[{1}] = \"{2}\";\n" + "g_TabLength[{1}] = \"{3}\";\n",
                resultstr, i, tabId, tabNameLength);

                if (bGotDefaultTab == "false")
                {
                    var thisDefault = thisTab.SelectSingleNode("Default/text()").InnerText;
                    if (i == 0 || thisDefault == "true")
                    {
                        defaultTabStr = string.Format("defaultTab = '{0}';\n", tabId);
                        if (thisDefault == "true") bGotDefaultTab = "true";
                    }
                }
                i++;               
              }
            }

            return resultstr + "\n" + defaultTabStr;
        }

        public string getTabValue(XPathNodeIterator oNode1, int lineNumber)
        {
            var root = GetXmlElement(oNode1);
            var tabName = root.SelectSingleNode("Description/text()").InnerText;

            if (tabName.Length > 0)
            {
                var tabValueArray = tabName.Split('~');
                if (tabValueArray.Length > lineNumber)
                {
                    return tabValueArray[lineNumber];
                }
                return string.Empty;
            }
            return string.Empty;
        }

        public int getTabNameLength(string TabName)
        {
            var blnTabNameLength = 0;
            var sSplitTabName = TabName.Split('~');
            if (sSplitTabName.Length == 1)
            {
                blnTabNameLength = TabName.Length;
            }
            else
            {
                var blnLengthZero = sSplitTabName[0].Length;
                var blnLengthOne = sSplitTabName[1].Length;
                blnTabNameLength = blnLengthZero > blnLengthOne ? blnLengthZero : blnLengthOne;
            }
            return blnTabNameLength;
        }

        public string writeClassLink(XPathNodeIterator oNode1)
        {
            var oNode = GetXmlElement(oNode1);
            var classStr = string.Empty;
            var enabledNode = getValue(oNode.SelectNodes("//Enabled/text()"));
            var defaultNode = getValue(oNode.SelectNodes("//Default/text()"));
            classStr = enabledNode == "true" ? "clsTabLinkActive" : "clsTabLinkInActive";

            if (defaultNode == "true")
            {
                classStr = "clsTabLinkActiveSelected";
            }

            return classStr;
        }

        public string writeClassStart(XPathNodeIterator oNode1)
        {
            var oNode = GetXmlElement(oNode1);
            var aDefault = oNode.SelectNodes("Default/text()");
            var classStr = string.Empty;

            if (hidealltabs == "false")
            {
                classStr = getValue(aDefault) == "true" ? "clsTabSelected" : "clsTab";
            }
            else
            {
                classStr = getValue(aDefault) == "true" ? "clsTabSelectedND" : "clsTabND";
            }
            return classStr;
        }

        public string writeClassEnd(XPathNodeIterator oNode1)
        {
            var oNode = GetXmlElement(oNode1);
            var aDefault = oNode.SelectNodes("Default/text()");
            var classStr = string.Empty;
            if (hidealltabs == "false")
            {
                classStr = getValue(aDefault) == "true" ? "clsTabEndSelected" : "clsTabEnd";
            }
            else
            {
                classStr = getValue(aDefault) == "true" ? "clsTabEndSelectedND" : "clsTabEndND";
            }
            return classStr;
        }

        public string incrementTabNumber()
        {
            tabNumber++;
            return string.Empty;
        }

        public string getStyleSheet()
        {
            return "StyleSheets/PortalFrameworkSystem.css";
        }

        public string getTabHref(XPathNodeIterator oNode1)
        {
            var oNode = GetXmlElement(oNode1);
            var tabId = oNode.SelectSingleNode("Id/text()").InnerText;

            var tempHref = string.Format("javascript:PFSTabClick('{0}','user')", tabId);
            var startPage = oNode.SelectSingleNode("StartPage/text()");
            if (startPage != null)
            {
                if (startPage.InnerText.Substring(0, 11) == "javascript:")
                {
                    tempHref = startPage.InnerText;
                }
            }
            return tempHref;
        }

        public string getValue(XmlNodeList oNode)
        {
            return oNode != null && oNode.Count > 0 ? oNode[0].InnerText : string.Empty;
        }

        public string setPortalIncludeData(XPathNodeIterator oNode1)
        {
            var oNode = GetXmlElement(oNode1);
            var urlNode = oNode.SelectNodes("/Portal/BannerIncludeFile/Url/text()");
            var HeightNode = oNode.SelectNodes("/Portal/BannerIncludeFile/Height/text()");
            var WidthNode = oNode.SelectNodes("/Portal/BannerIncludeFile/Width/text()");
            var marginTopNode = oNode.SelectNodes("/Portal/BannerIncludeFile/MarginTop/text()");
            var marginLeftNode = oNode.SelectNodes("/Portal/BannerIncludeFile/MarginLeft/text()");

            if (urlNode != null && urlNode.Count > 0)
            {
                bannerIncludeUrl = urlNode[0].InnerText;

                if (marginTopNode != null && marginTopNode.Count > 0)
                {
                    bannerIncludeMarginTop = marginTopNode[0].InnerText;
                }
                else
                {
                    bannerIncludeMarginTop = "0";
                }
                if (marginLeftNode !=null && marginLeftNode.Count > 0)
                {
                    bannerIncludeMarginLeft = marginLeftNode[0].InnerText;
                }
                else
                {
                    bannerIncludeMarginLeft = "0";
                }
                if (HeightNode != null && HeightNode.Count > 0)
                {
                    bannerIncludeHeight = HeightNode[0].InnerText;
                }
                else
                {
                    bannerIncludeHeight = "0";
                }
                if (WidthNode !=null && WidthNode.Count > 0)
                {
                    bannerIncludeWidth = WidthNode[0].InnerText;
                }
                else
                {
                    bannerIncludeWidth = "0";
                }
            }
            else
            {
                bannerIncludeMarginTop = "0";
                bannerIncludeMarginLeft = "0";
                bannerIncludeHeight = "0";
                bannerIncludeWidth = "0";
                bannerIncludeDisplay = "none";

            }
            return string.Empty;
        }

        public string getPortalIncludeStyle()
        {
            var display = "position: absolute;";
            display += "top: " + getPortalIncludeInfo("MARGINTOP") + ";";
            display += "left: " + getPortalIncludeInfo("MARGINLEFT") + ";";
            display += "width: " + getPortalIncludeInfo("WIDTH") + ";";
            display += "height: " + getPortalIncludeInfo("HEIGHT") + ";";
            display += "display: " + getPortalIncludeInfo("DISPLAY") + ";";
            display += "visibility:visible;";
            return display;
        }

        public string getPortalIncludeImageStyle()
        {
            var display = "position: absolute;";
            display += "left: " + getPortalIncludeInfo("MARGINLEFT") + ";";
            display += "top: " + getPortalIncludeInfo("MARGINTOP") + ";";
            display += "width: " + getPortalIncludeInfo("WIDTH") + ";";
            display += "height: " + getPortalIncludeInfo("HEIGHT") + ";";
            display += "display: " + getPortalIncludeInfo("DISPLAY") + ";";
            display += "visibility:visible;";
            return display;
        }

        public string getPortalIncludeInfo(string property)
        {
            switch (property)
            {
                case "URL":
                    return bannerIncludeUrl;
                case "MARGINTOP":
                    return bannerIncludeMarginTop;
                case "MARGINLEFT":
                    return bannerIncludeMarginLeft;
                case "HEIGHT":
                    return bannerIncludeHeight;
                case "WIDTH":
                    return bannerIncludeWidth;
                case "DISPLAY":
                    return bannerIncludeDisplay;
                default:
                    return string.Empty;
            }

        }

        public string getIncludeFile()
        {
            return " #include file='";
        }

        public string getIncludeFileEnd()
        {
            return "' ";
        }

        public string getIncludeVir()
        {
            return " #include virtual='";
        }

        public string getDDMenuInfo(XPathNodeIterator oNode1)
        {
            var oNode = GetXmlElement(oNode1);
            var tabId = oNode.SelectSingleNode("Description/text()").InnerText;
            var tabValue = removeSpaces(tabId);
            return string.Format("showDDMenu(event,'ddmnu{0}','tab{0}Main')", tabValue);
        }

        public string removeSpaces(string vName)
        {
            var re = "/\\W/";
            for (var i = 0; i < vName.Length; i++)
            {
                vName = vName.Replace(re, "");
            }
            return vName;
        }

        public string convertName(XPathNodeIterator oNode1)
        {
            var oNode = GetXmlElement(oNode1);
            var MenuId = oNode.SelectSingleNode("Id/text()").InnerText;
            return "ddmnu" + MenuId.Substring(3, MenuId.Length);
        }

        public string getPageHref(XPathNodeIterator oNode1)
        {
            var oNode = GetXmlElement(oNode1);
            var theHref = string.Empty;
            var checkForFunction = string.Empty;
            var urlList = oNode.SelectNodes("OnClick/text()");
            var newWindow = oNode.SelectSingleNode("NewWindow/text()");
            var newWindowHasToolbar = oNode.SelectSingleNode("NewWindowHasToolbar/text()");	
            var tmpNewWindowHasToolbar = newWindowHasToolbar == null ? "false" : newWindowHasToolbar.InnerText;


            if (urlList != null && urlList.Count > 0)
            {

                var thisPage = editPageUrl(urlList[0].InnerText);
                checkForFunction = thisPage.Substring(0, 11);
                if (checkForFunction == "javascript:")
                {
                    theHref = thisPage;
                }
                else
                {
                    
                    if (newWindow.InnerText == "true")
                    {
                        if (tmpNewWindowHasToolbar == "false")
                        {
                            theHref = "javascript:top.frames[1].PFSLaunchWindow4Themebar('" + thisPage + "','False')";
                        }
                        else
                        {
                            theHref = "javascript:top.frames[1].PFSLaunchWindow4Themebar('" + thisPage + "','True')";
                        }
                    }
                    else
                    {
                        theHref = "javascript:top.frames[1].PFSNavigateByPage('" + thisPage + "','" + thisPage + "')";
                    }
                }
            }
            else
            {
                theHref = "";
            }

            return theHref;
        }

        public string editPageUrl(string oNode)
        {
            // made by sully to ignore the code;
            return oNode;
        }

        public string getSubMenuName(XPathNodeIterator oNode1)
        {
            return string.Format("parent.PFSDDMenuItemOver('ddmnu{0}',this);", getMenuName(oNode1));
        }

        public string getMenuName(XPathNodeIterator oNode1)
        {
            var oNode = GetXmlElement(oNode1);
            var oNodeName = oNode.SelectSingleNode("Name/text()");
            return removeSpaces(oNodeName.InnerText);
        }

        public string getParentMenuName(XPathNodeIterator oNode1)
        {
            oNode1.Current.MoveToParent();
            var oNodeParentName = oNode1.Current.SelectSingleNode("Name");
            return "ddmnu" + oNodeParentName.Value;
        }

        public string getLogoffURL(XPathNodeIterator oNode1)
        {
            if (oNode1.CurrentPosition == 0) oNode1.MoveNext();
            var oNodeName = oNode1.Current.SelectSingleNode("Logoff");
            var oNodeAttrib = oNodeName.GetAttribute("url", "");
            return string.Format("javascript:TabFrame.PFSKillFormsAuthCookie('{0}')", oNodeAttrib);
        }

        public string lineBreak()
        {
            return "\n";
        }

        public string blankSpace()
        {
            return "&nbsp;";
        }
        
        ]]>

  </msxsl:script>

  <xsl:output method="html" indent="yes"/>
  <xsl:template match="/">
    <xsl:value-of select="user:lineBreak()"/><xsl:comment>Travelers.BI.PortalFramework.Web.PortalXSLT.PortalBanner.xsl</xsl:comment><xsl:value-of select="user:lineBreak()"/>
    <HTML>
      <HEAD>
        <SCRIPT Language="JavaScript">
          <xsl:value-of select="user:lineBreak()"  />
          <xsl:value-of select="user:buildTabArray(.)"/>
          <xsl:value-of select="user:setPortalIncludeData(.)"/>

          var banIframeSrc="<xsl:value-of select="user:getPortalIncludeInfo('URL')"/>"

         function PFSWindowClose() {
         // does not work on ns
          if (top) {
          var MainPortal = parent.opener
          if (MainPortal) {
              MainPortal.focus()
              parent.close();
            }
          }
       } 

        function getDomain() {
            var docname = document.domain
            var tmpDocName = docname.split(".")
            if (tmpDocName[1]) {
                var strDocName = tmpDocName[tmpDocName.length - 2] + "." + tmpDocName[tmpDocName.length - 1]
                return strDocName;
            } else { return docname; }
        }

        function showDDMenu(event, ddmnuid, tabID) {
            var bodyFrame = top.frames[2]
            var eSrc = document.getElementById(tabID)
            var x = eSrc.offsetLeft - 168
            eDDMenu = bodyFrame.document.getElementById(ddmnuid)
            if (eDDMenu) {
                PFSDDMenuTabOver(event, ddmnuid, x, tabID);
            }
        }

        function hideDDMenu() {
            if (PFSBannerOnBlur) {
                PFSBannerOnBlur()
            }
        }
          var g_Style= "<xsl:value-of select="Portal/StyleSheet" />"

        </SCRIPT>
        <Script Language='JavaScript' src='scripts/PortalFrameworkSystem.js'><xsl:comment></xsl:comment></Script>
        <link rel="stylesheet" TYPE="text/css" href="StyleSheets/PortalFrameworkSystem.css"></link>
      </HEAD>

      <BODY>
        <xsl:attribute name="bgcolor">white</xsl:attribute>
        <xsl:attribute name="LEFTMARGIN">0</xsl:attribute>
        <xsl:attribute name="TOPMARGIN">0</xsl:attribute>
        <xsl:attribute name="MARGINWIDTH">0</xsl:attribute>
        <xsl:attribute name="MARGINHEIGHT">0</xsl:attribute>


        <!-- Page Banner -->

        <div id="divBannerTable">
          <table border="0" cellPadding="0" cellSpacing="0" WIDTH="1025px">
            <xsl:attribute name="id">BannerTable</xsl:attribute>
            <xsl:attribute name="class">clsBannerTable</xsl:attribute>
            <tr>
              <TD>
                <xsl:attribute name="id">ThemeBar</xsl:attribute>
                <xsl:attribute name="class">clsThemeBar</xsl:attribute>
                <span>
                  <xsl:attribute name="id">ThemeBar</xsl:attribute>
                  <xsl:attribute name="class">clsThemeBarText</xsl:attribute>
                  <xsl:choose>
                    <xsl:when test="//ThemeTitle[. !='']">
                      <xsl:value-of select="//ThemeTitle" />
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="user:blankSpace()" disable-output-escaping = "yes" />
                    </xsl:otherwise>
                  </xsl:choose>
                </span>
                <xsl:value-of select="user:lineBreak()"  />
                <span id="ToolBar">
                  <xsl:apply-templates select="//ToolBar" />
                  <xsl:value-of select="user:lineBreak()"  />
                </span>
              </TD>
            </tr>
            <xsl:choose>
              <xsl:when test="//LogoHyperlink[. !='']">
                <a>
                  <xsl:attribute name="href">
                    javascript:PFSNavigateBanner('<xsl:value-of select="//LogoHyperlink" />')
                  </xsl:attribute>
                  <tr>
                    <TD>
                      <xsl:attribute name="id">PageBanner</xsl:attribute>
                      <xsl:attribute name="class">clsPageBanner</xsl:attribute>
                      <xsl:if test="//Portal/BannerLogoURL[. !='']">
                        <xsl:attribute name="style">background-image:url(<xsl:value-of select="Portal/BannerLogoURL" />)</xsl:attribute>
                      </xsl:if>
                      <span>
                        <xsl:attribute name="id">PageTitle</xsl:attribute>
                        <xsl:attribute name="class">clsPageBannerText</xsl:attribute>
                        <xsl:apply-templates select="//Portal/Description" />
                      </span>
                    </TD>
                    <TD>
                      <xsl:apply-templates select="//BannerIncludeFile" />
                    </TD>
                  </tr>
                </a>
              </xsl:when>
              <xsl:otherwise>
                <tr>
                  <TD>
                    <xsl:attribute name="id">PageBanner</xsl:attribute>
                    <xsl:attribute name="class">clsPageBanner</xsl:attribute>
                    <xsl:if test="//Portal/BannerLogoURL[. !='']">
                      <xsl:attribute name="style">background-image:url(<xsl:value-of select="Portal/BannerLogoURL" />)</xsl:attribute>
                    </xsl:if>
                    <span>
                      <xsl:attribute name="id">PageTitle</xsl:attribute>
                      <xsl:attribute name="class">clsPageBannerText</xsl:attribute>
                      <xsl:apply-templates select="//Portal/Description" />
                    </span>
                  </TD>
                  <TD>
                    <xsl:apply-templates select="//BannerIncludeFile" />
                  </TD>
                </tr>
              </xsl:otherwise>
            </xsl:choose>
          </table>
        </div>

        <!-- Page tab System -->

        <div>
          <xsl:attribute name="id">divTabTable</xsl:attribute>
          <xsl:if test="Portal/DropDownMenu[. != 'none']">
            <xsl:attribute name="onMouseOut">hideDDMenu()</xsl:attribute>
          </xsl:if>
          <TABLE border="0" cellPadding="0" cellSpacing="0"   >
            <xsl:attribute name="id">TabTable</xsl:attribute>
            <xsl:attribute name="class">clsTabTable</xsl:attribute>
            <TR>
              <td id="FirstTab"  class="clsFirstTab"  width="168" >
                <img id="FirstTab_img" src="images\TabStartSpacer.gif" width="168" height="1"></img>
                <!-- width of menu - 5 -->
                <xsl:if test="//ToggleMenu[. ='true']">
                  <xsl:apply-templates select="//ToggleMenu" />
                </xsl:if>
              </td>

              <xsl:apply-templates select="//Portal/Tab" />

              <TD id="LastTab" width="1025" background="images\MenuEnd.gif">
                <xsl:value-of select="user:blankSpace()" disable-output-escaping = "yes" />
              </TD>
            </TR>
          </TABLE>
        </div>

      </BODY>
    </HTML>

  </xsl:template>

  <xsl:template match="//Portal/Tab" >

    <!-- Tabs -->
    <xsl:value-of select="user:lineBreak()"  />
    <xsl:comment>Tab Starts Here</xsl:comment>
    <xsl:value-of select="user:lineBreak()"  />
    <xsl:if test="Visible[. ='true']">

      <TD>
        <xsl:attribute name="class">
          <xsl:value-of select="user:writeClassStart(.)"/>
        </xsl:attribute>
        <xsl:attribute name="id"><xsl:value-of select="Id" />Main</xsl:attribute>
        <xsl:if test="DropDownMenu[. ='true']">
          <xsl:attribute name="onMouseOver">
            <xsl:value-of select="user:getDDMenuInfo(.)"/>
          </xsl:attribute>
        </xsl:if>
        <A>
          <xsl:attribute name="HREF">
            <xsl:value-of select="user:getTabHref(.)"/>
          </xsl:attribute>
          <xsl:attribute name="id">
            <xsl:value-of select="Id" />
          </xsl:attribute>
          <xsl:attribute name="name">
            <xsl:value-of select="Id" />
          </xsl:attribute>
          <xsl:attribute name="value">
            <xsl:value-of select="Name" />
          </xsl:attribute>
          <xsl:attribute name="class">
            <xsl:value-of select="user:writeClassLink(.)"/>
          </xsl:attribute>
          <xsl:value-of select="user:getTabValue(.,0)"/>
          <BR/>
          <xsl:value-of select="user:getTabValue(.,1)"/>
        </A>
      </TD>


      <TD>
        <xsl:attribute name="CLASS">
          <xsl:value-of select="user:writeClassEnd(.)"/>
        </xsl:attribute>
        <xsl:attribute name="id"><xsl:value-of select="Id" />End</xsl:attribute>
        <xsl:value-of select="user:blankSpace()" disable-output-escaping = "yes" />
      </TD>

      <xsl:value-of select="user:incrementTabNumber()"/>
    </xsl:if>
  </xsl:template>

  <xsl:template match="BannerIncludeFile">
    <xsl:if test="//Portal/BannerIncludeFile/Url[@image='false']">
      <iframe>
        <xsl:attribute name="src"></xsl:attribute>
        <xsl:attribute name="allowTransparency">true</xsl:attribute>
        <xsl:attribute name="style">
          <xsl:value-of select="user:getPortalIncludeImageStyle()"/>
        </xsl:attribute>
        <xsl:attribute name="marginwidth">0px</xsl:attribute>
        <xsl:attribute name="marginheight">0px</xsl:attribute>
        <xsl:attribute name="id">bannerIFrame</xsl:attribute>
        <xsl:attribute name="name">bannerIFrame</xsl:attribute>
        <xsl:attribute name="scrolling">no</xsl:attribute>
        <xsl:attribute name="frameborder">0</xsl:attribute>
        <xsl:value-of select="user:blankSpace()" disable-output-escaping = "yes" />
      </iframe>
    </xsl:if>

    <xsl:if test="//Portal/BannerIncludeFile/Url[@image='true']">
      <span class="clsPageBannerIFrame">
        <img>
          <xsl:attribute name="src">
            <xsl:value-of select="user:getPortalIncludeInfo('URL')"/>
          </xsl:attribute>
          <xsl:attribute name="style">
            <xsl:value-of select="user:getPortalIncludeImageStyle()"/>
          </xsl:attribute>
          <xsl:attribute name="id">bannerIFrame</xsl:attribute>
          <xsl:attribute name="name">bannerIFrame</xsl:attribute>
          <xsl:attribute name="scrolling">no</xsl:attribute>
          <xsl:attribute name="frameborder">0</xsl:attribute>
        </img>
      </span>
    </xsl:if>
  </xsl:template>

  <xsl:template match="ToggleMenu">
    <img>
      <xsl:attribute name="id">tab_MenuOnOff_img</xsl:attribute>
      <xsl:attribute name="OnClick">PFSMenuOnOff()</xsl:attribute>
      <xsl:if test="//Portal/ToggleMenu[@onStart='on']">
        <xsl:attribute name="src">images/menuon.gif</xsl:attribute>
        <xsl:attribute name="class">clsTabMenuOn</xsl:attribute>
      </xsl:if>
      <xsl:if test="//Portal/ToggleMenu[@onStart='off']">
        <xsl:attribute name="src">images/menuoff.gif</xsl:attribute>
        <xsl:attribute name="class">clsTabMenuOff</xsl:attribute>
      </xsl:if>
    </img>
  </xsl:template>

  <xsl:template match="Portal/Description">

    <xsl:if test="//Portal/Description[@image='false']">
      <xsl:value-of select="//Description" />
    </xsl:if>
    <xsl:if test="//Portal/Description[@image='true']">
      <img>
        <xsl:attribute name="src">
          <xsl:value-of select="//Description" />
        </xsl:attribute>
      </img>
    </xsl:if>
    <xsl:if test="//Portal/Description[@include='file']">
      <xsl:comment>
        <xsl:value-of select="user:getIncludeVir()"/>
        <xsl:value-of select="//Description" />
        <xsl:value-of select="user:getIncludeFileEnd()"/>
      </xsl:comment>
    </xsl:if>
    <xsl:if test="//Portal/Description[@include='virtual']">
      <xsl:comment>
        <xsl:value-of select="user:getIncludeVir()"/>
        <xsl:value-of select="//Description" />
        <xsl:value-of select="user:getIncludeFileEnd()"/>
      </xsl:comment>
    </xsl:if>

  </xsl:template>

  <xsl:template match="Portal/ToolBar">

    <xsl:if test="//Portal/ToolBar/Logoff[. ='True']">
      <a>
        <xsl:if test="//Portal/ToolBar/Logoff[@url!='']">
          <xsl:attribute name="href">
            <xsl:value-of select="user:getLogoffURL(.)"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:if test="//Portal/ToolBar/Logoff[@url='']">
          <xsl:attribute name="href">javascript:TabFrame.PFSKillFormsAuthCookie()</xsl:attribute>
        </xsl:if>
        <img id="ToolBar_img_Logoff" style="LEFT: 931px; POSITION: absolute;" class="clsToolbar" alt="Logoff" src="images/logoff.gif" ></img>
      </a>
      <xsl:value-of select="user:lineBreak()"  />
    </xsl:if>

    <xsl:if test="//Portal/ToolBar/Print[. ='True']">
      <xsl:value-of select="user:lineBreak()"  />
      <a>
        <xsl:attribute name="href">javascript:TabFrame.PFSPrintFromWhiteSpace()</xsl:attribute>
        <img id="ToolBar_img_Print" style="LEFT: 871px;" class="clsToolbar" alt="Print" src="images/print.gif" ></img>
      </a>
    </xsl:if>

    <xsl:if test="//Portal/ToolBar/Bookmark[. ='True']">
      <xsl:value-of select="user:lineBreak()"  />
      <a>
        <xsl:attribute name="href">javascript:TabFrame.PFSAddToFavs()</xsl:attribute>
        <img id="ToolBar_img_Bookmark" style="LEFT: 776px;" class="clsToolbar" alt="Bookmark this Page" src="images/bookmark.gif" ></img>
      </a>
    </xsl:if>

    <xsl:apply-templates select="//Icon" />

  </xsl:template>

  <xsl:template match="Portal/ToolBar/Icon">
    <xsl:if test="Visible[. ='true']">
      <xsl:value-of select="user:lineBreak()"  />
      <a>
        <xsl:attribute name="href">
          <xsl:value-of select="user:getPageHref(.)"/>
        </xsl:attribute>
        <img>
          <xsl:attribute name="id">
            ToolBar_img_<xsl:value-of select="./Name" />
          </xsl:attribute>
          <xsl:attribute name="class">clsToolbar</xsl:attribute>
          <xsl:attribute name="alt">
            <xsl:value-of select="./Tooltip" />
          </xsl:attribute>
          <xsl:attribute name="src">
            <xsl:value-of select="./Url" />
          </xsl:attribute>
        </img>
      </a>
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>