<xsl:stylesheet	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
		xmlns:msxsl="urn:schemas-microsoft-com:xslt"
		xmlns:user="http://mycompany.com/mynamespace">


	<xsl:param name="bDisplayStatus" />
	
	<xsl:template match="/Root">
    		<xsl:for-each select="ContentItem">
			<xsl:if test="@ContentWheelIcon[.='']">  <!-- Do not render leaf nodes (topics) for Premium Courses-->
    			<xsl:element name="div">
				<xsl:variable name="sParentID" select="@ParentID"/>
				
    				<xsl:attribute name="name">Node</xsl:attribute>
    				<xsl:attribute name="Href"><xsl:value-of select="@Href" /></xsl:attribute>
    				<xsl:attribute name="id"><xsl:value-of select="@ID" /></xsl:attribute>			
    				<xsl:attribute name="HasChildren"><xsl:value-of select="@HasChildren" /></xsl:attribute>
    				<xsl:attribute name="ParentID"><xsl:value-of select="$sParentID" /></xsl:attribute>
				<xsl:attribute name="class">ContentItem</xsl:attribute>

				<xsl:element name="div">
					<xsl:attribute name="name">Parent</xsl:attribute>
    					<xsl:attribute name="id">__idParent</xsl:attribute>
            <xsl:choose>
              <xsl:when test ="@HasChildren = 0">
                <xsl:attribute name="class">topicNode</xsl:attribute>
              </xsl:when>
              <xsl:otherwise >
					<xsl:attribute name="class">nodeParent</xsl:attribute>
              </xsl:otherwise>

            </xsl:choose>
  					<xsl:attribute name="title"><xsl:value-of select="@Name" /></xsl:attribute>

					<xsl:element name="table">
						<xsl:attribute name="id">__idTable</xsl:attribute>
              <xsl:attribute name ="width">100%</xsl:attribute>
						<xsl:attribute name="class">ItemLayoutTable</xsl:attribute>
						<xsl:attribute name="cellpadding">0</xsl:attribute>
						<xsl:attribute name="cellspacing">0</xsl:attribute>
            <xsl:choose>
              <xsl:when test="@HasChildren = 1">
                <xsl:choose>
                  <xsl:when test="$sParentID = ''">
                    <xsl:attribute name="onmouseover">this.oldClass=this.className; this.className='courseHover'; window.status=' '; return true</xsl:attribute>
                    <xsl:attribute name="onmouseout">this.oldClass=this.className; this.className='course'; window.status=' '; return true</xsl:attribute>
                  </xsl:when>
                </xsl:choose>
              </xsl:when>
            </xsl:choose>
					<xsl:element name="tr">
                <xsl:attribute name="valign">middle</xsl:attribute>
            <xsl:choose>
              <xsl:when test="@HasChildren = 1">
                <xsl:choose>
                  <xsl:when test="$sParentID = ''">
                    <xsl:choose>
                      <xsl:when test="@id != '__idItemStatusImg' and '__Divider'">
                    <xsl:attribute name="onmousedown">this.oldClass=this.className; this.className='courseSelected'; window.status=' '; return true</xsl:attribute>
                    <xsl:attribute name="onmouseup">this.oldClass=this.className; this.className='courseSelected'; window.status=' '; return true</xsl:attribute>
                      </xsl:when>
                    </xsl:choose>
                  </xsl:when>
                </xsl:choose>
              </xsl:when>
            </xsl:choose>

					<xsl:element name="td">
          <xsl:attribute name="style">cursor:default;</xsl:attribute>

					<xsl:element name="img">
    						<xsl:attribute name="name">__idItemStatusImg</xsl:attribute>
    						<xsl:attribute name="id">__idItemStatusImg</xsl:attribute>
    						<xsl:attribute name="align">absmiddle</xsl:attribute>
						
						<!-- Note: Use select="@LessonStatus" if using icons to denote status w/in TOC -->
						<xsl:variable name="lessonstatus" select="@LessonStatus"/>
    						<xsl:choose>
							<xsl:when test="$lessonstatus and $bDisplayStatus='true'">
                <xsl:attribute name="style">Visibility:Hidden</xsl:attribute>
                <xsl:attribute name="src">appart/<xsl:value-of select="translate($lessonstatus,' ','_')"/>.gif</xsl:attribute>
							</xsl:when>
    							<xsl:otherwise>
    								<xsl:attribute name="src">appart/block.gif</xsl:attribute>
                    <xsl:attribute name="style">Visibility:Hidden</xsl:attribute>
    							</xsl:otherwise>
    						</xsl:choose>
    					</xsl:element>
                  <xsl:choose>
                    <xsl:when test ="@HasChildren &gt; '0'">
                      <xsl:element name="img">
                        <xsl:attribute name="name">__Divider</xsl:attribute>
                        <xsl:attribute name="id">__Divider</xsl:attribute>
                        <xsl:attribute name="align">absmiddle</xsl:attribute>
                        <xsl:attribute name="vspace">4</xsl:attribute>
                        <xsl:attribute name="hspace">2</xsl:attribute>
                        <xsl:attribute name="src">appart/tabledivider.jpg</xsl:attribute>
                      </xsl:element>
                    </xsl:when>
                  </xsl:choose>
					</xsl:element>
					<xsl:element name="td">

  					<xsl:element name="img">
						<xsl:attribute name="name">Item_Img</xsl:attribute>
    						<xsl:attribute name="id">__idItem_Img</xsl:attribute>
    						<xsl:attribute name="align">absmiddle</xsl:attribute>
						<xsl:attribute name="class">nodeImg</xsl:attribute>

						<xsl:choose>
							<xsl:when test="@CloseIcon">
								<xsl:attribute name="src"><xsl:value-of select="@CloseIcon"/></xsl:attribute>
    								<xsl:attribute name="img_collapse"><xsl:value-of select="@CloseIcon"/></xsl:attribute>
    								<xsl:attribute name="img_expand"><xsl:value-of select="@OpenIcon"/></xsl:attribute>
							</xsl:when>
    							<xsl:otherwise>
    								<xsl:attribute name="src"><xsl:value-of select="@LeafIcon"/></xsl:attribute>
                        <xsl:attribute name="vspace">7</xsl:attribute>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:element>
				
					</xsl:element>
  					<xsl:element name="td">
                  <xsl:attribute name="width">100%</xsl:attribute>
						<xsl:variable name="available" select="@Available" />
						<xsl:choose>
							<xsl:when test="$available='true'">
								<xsl:choose>
  									<xsl:when test="$sParentID=''">
										<xsl:attribute name="class">course</xsl:attribute>
										<!--<xsl:attribute name="onmouseover">this.oldClass=this.className; this.className='courseHover'; window.status=' '; return true</xsl:attribute>-->
									</xsl:when>
    									<xsl:otherwise>
                            <xsl:choose>
                              <xsl:when test ="@HasChildren &gt; '0'">
                                <xsl:attribute name="class">node</xsl:attribute>
                                <xsl:attribute name="onmouseover">this.oldClass=this.className; this.className='nodeHover'; window.status=' '; return true</xsl:attribute>
                              </xsl:when>
                              <xsl:otherwise>
                                  <xsl:attribute name="class">topicNode</xsl:attribute>
                                  <xsl:attribute name="onmouseover">this.oldClass=this.className; this.className='topicNodeHover'; window.status=' '; return true</xsl:attribute>
                                  <xsl:attribute name="onmousedown">this.oldClass=this.className; this.className='topicNodeSelected'; window.status=' '; return true</xsl:attribute>
                                  <xsl:attribute name="onmouseup">this.oldClass=this.className; this.className='topicNodeSelected'; window.status=' '; return true</xsl:attribute>
                                  <xsl:attribute name="name">link</xsl:attribute>
                                 <xsl:attribute name="tabindex">0</xsl:attribute><!--added tabbing code-->
                              </xsl:otherwise>
                            </xsl:choose>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:when>
							<xsl:otherwise>
								<xsl:choose>
  									<xsl:when test="$sParentID=''">
										<xsl:attribute name="class">courseUnavailable</xsl:attribute>
										<xsl:attribute name="onmouseover">this.oldClass='courseUnavailable'; this.className='courseUnavailable'; window.status=' '; return true</xsl:attribute>
									</xsl:when>
    									<xsl:otherwise>
										<xsl:attribute name="class">nodeUnavailable</xsl:attribute>
										<xsl:attribute name="onmouseover">this.oldClass='nodeUnavailable'; this.className='nodeUnavailable'; window.status=' '; return true</xsl:attribute>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:otherwise>
						</xsl:choose>
						<xsl:attribute name="onmouseout">this.className=this.oldClass; window.status=' '; return true</xsl:attribute>
                  <xsl:element name='div'>
						<xsl:attribute name="onmouseup">window.status=' '; return true</xsl:attribute>
						<xsl:attribute name="onmousedown">window.status=' '; return true</xsl:attribute>
						<xsl:attribute name="name">link</xsl:attribute>
    						<xsl:attribute name="id">__idLinkCaption</xsl:attribute>
						<xsl:attribute name="href"></xsl:attribute>
                    <xsl:choose>
                      <xsl:when test="@HasChildren &gt; '0'">
                        <xsl:attribute name="style">height:100%;padding-top:7px;</xsl:attribute>
                                 <xsl:attribute name="tabindex">0</xsl:attribute><!--added tabbing code-->
                      </xsl:when>
                    </xsl:choose>
						<xsl:value-of select="@Name" />
    					</xsl:element>

					</xsl:element>
  					</xsl:element>
					</xsl:element>

				</xsl:element>

				<xsl:element name="div">
    					<xsl:attribute name="id">__idChildrenContainer</xsl:attribute>
					<xsl:attribute name="class">ChildrenContainer</xsl:attribute>
					<xsl:attribute name="style">display:none</xsl:attribute>
					<xsl:text> </xsl:text>
				</xsl:element>
			</xsl:element>	
			</xsl:if>	
    		</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>