﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <xsl:call-template name="FollowDiscussion">
            <xsl:with-param name="Followed" select="Discussion/Followed"></xsl:with-param>
            <xsl:with-param name="DiscussionItemID" select="Discussion/DiscussItemID"></xsl:with-param>
            <xsl:with-param name="DiscussionName" select="Discussion/DiscussionName"></xsl:with-param>
        </xsl:call-template>
    </xsl:template>

    <xsl:template name="FollowDiscussion">
        <xsl:param name="Followed" select="'N/A'"></xsl:param>
        <xsl:param name="DiscussionItemID" select="'N/A'"></xsl:param>
        <xsl:param name="DiscussionName" select="'N/A'"></xsl:param>
        <div style="margin-left:10px;">
            <xsl:if test="$Followed = 0">
                <div id="div_NotFollowing_{$DiscussionItemID}">
                    <span style="font-family: Calibri, Verdana, Arial; font-size: 9pt; font-weight: bold; color: #003366; cursor: pointer;"
                          onmouseover="this.style.textDecoration='underline';"
                          onmouseout="this.style.textDecoration='none';"
                          onclick="discussion_Follow({$DiscussionItemID},'{$DiscussionName}',3,'divFollowCommunity_{$DiscussionItemID}')">
                        Follow It
                    </span>
                </div>
                <div id="div_Following_{$DiscussionItemID}" style="display:none;">
                    <xsl:choose>
                        <xsl:when test="$DiscussionName != ''">
                            <span class="labelSmall">
                                You are following this discussion
                            </span>
                        </xsl:when>
                        <xsl:otherwise>
                            <span class="labelSmall">
                                You are following this Publication
                            </span>
                        </xsl:otherwise>
                    </xsl:choose>
                    <span style="font-family: Calibri, Verdana, Arial; font-size: 9pt; font-weight: bold;	color: #003366; cursor: pointer;"
                          onmouseover="this.style.textDecoration='underline';"
                          onmouseout="this.style.textDecoration='none';"
                          onclick="discussion_Follow({$DiscussionItemID},'{$DiscussionName}',3,'divFollowCommunity_{$DiscussionItemID}')">
                        (Do not Follow)
                    </span>
                </div>
            </xsl:if>
            <xsl:if test="$Followed != 0">
                <xsl:choose>
                    <xsl:when test="$DiscussionName != ''">
                        <span class="labelSmall">
                            You are following this discussion
                        </span>
                    </xsl:when>
                    <xsl:otherwise>
                        <span class="labelSmall">
                            You are following this Publication
                        </span>
                    </xsl:otherwise>
                </xsl:choose>
                <span style="font-family: Calibri, Verdana, Arial; font-size: 9pt; font-weight: bold;	color: #003366; cursor: pointer;"
                      onmouseover="this.style.textDecoration='underline';"
                      onmouseout="this.style.textDecoration='none';"
                      onclick="discussion_Follow({$DiscussionItemID},'{$DiscussionName}',0,'divFollowCommunity_{$DiscussionItemID}')">
                    (Do not Follow)
                </span>
            </xsl:if>
        </div>

    </xsl:template>
</xsl:stylesheet>
