﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:import href="../GenericTemplates/LoginPopup.xslt"/>
    <xsl:import href="../CommunityContainer.xslt"/>

    <xsl:template name="LoadDiscussionAsynchronously">

        <xsl:param name="ItemID" select="'N/A'" />
        <xsl:param name ="TemplateURL" select ="'N/A'"/>
        <xsl:param name="ItemType" select="'N/A'" />
        <xsl:param name="PermissionID" select="'N/A'"/>
        <xsl:param name="ParentType" select="'N/A'"/>
        <xsl:param name="ParentID" select="'N/A'"/>
        <xsl:param name="ParentName" select="'N/A'"></xsl:param>
        <xsl:param name="Authenticated" select="'N/A'"></xsl:param>
        <xsl:param name="VolumeLevel" select="'N/A'"></xsl:param>
        <xsl:param name="CommunityPublishYN" select="'N/A'"></xsl:param>
        <xsl:param name="SocialSharePublishedYN" select="'N/A'"></xsl:param>
        <xsl:param name="HostName" select="'N/A'"></xsl:param>
        <xsl:param name="PromoteKey" select="'N/A'"></xsl:param>
        <xsl:param name="LoggedInUserID" select="'N/A'"></xsl:param>
        <xsl:param name="ItemName" select="'N/A'"></xsl:param>
        <xsl:param name="CommunityAdminUser" select="'N/A'"></xsl:param>
        <xsl:param name="CommunityAdmin" select="'N/A'"></xsl:param>
        <xsl:param name="MBrandItemID" select="'N/A'"></xsl:param>
        <xsl:param name="ParentItemPublishYN" select="'N/A'"></xsl:param>
        <xsl:param name="ParentItemPublicYN" select="'N/A'"></xsl:param>
        
        <xsl:choose>
            <xsl:when test ="$ParentType='Goal' and $PermissionID = -1">
                <div id="divAuthorizationMessage">
                    <span class="labelError">
                        You do not have sufficient rights to view this item
                    </span>
                </div>
            </xsl:when>
            <xsl:otherwise>
                <div class="marginTop10">
                    <table class="tableMaster" cellspacing="0" cellpadding="0">
                        <xsl:call-template name="CommunityHeader">
                            <xsl:with-param name="ItemName" select="$ParentName"></xsl:with-param>
                        </xsl:call-template>
                        <xsl:call-template name="CommunityFollowShareOptions">
                            <xsl:with-param name="Authenticated" select="$Authenticated"></xsl:with-param>
                            <xsl:with-param name="VolumeLevel" select="$VolumeLevel"></xsl:with-param>
                            <xsl:with-param name="ItemID" select="$ItemID"></xsl:with-param>
                            <xsl:with-param name="CommunityPublishYN" select="$CommunityPublishYN"></xsl:with-param>
                            <xsl:with-param name="SocialSharePublishedYN" select="$SocialSharePublishedYN"></xsl:with-param>
                            <xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
                            <xsl:with-param name="PromoteKey" select="$PromoteKey"></xsl:with-param>
                            <xsl:with-param name="LoggedInUserID" select="$LoggedInUserID"></xsl:with-param>
                            <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                            <xsl:with-param name="ItemName" select="$ParentName"></xsl:with-param>
                            <xsl:with-param name="CommunityAdminUser" select="$ParentItemPublishYN"></xsl:with-param>
                            <xsl:with-param name="CommunityAdmin" select="$CommunityAdmin"></xsl:with-param>
                            <xsl:with-param name="MBrandItemID" select="$MBrandItemID"></xsl:with-param>
                            <xsl:with-param name="ParentItemPublishYN" select="$ParentItemPublishYN"></xsl:with-param>
                            <xsl:with-param name="ParentItemPublicYN" select="$ParentItemPublicYN"></xsl:with-param>
                        </xsl:call-template>                        
                    </table>
                </div>

                <!-- Login Div -->
                <xsl:call-template name ="LoginPopup"></xsl:call-template>


                <div id='divGoal_Operations' style='margin-top:20px; display:none;' >
                </div>

                <div id='divOperations' style='margin-top:20px; display:none;' >
                </div>

                <div id='divDiscussionContent' style='margin-top:20px'>
                </div>
                <script language="javascript" type="text/javascript">
                    discussion_getContentBox("<xsl:value-of select='$ItemID'/>", "divDiscussionContent");
                </script>

                <!--<script language="javascript" type="text/javascript">
                    discussion_Load("<xsl:value-of select='normalize-space($ItemID)'/>", "divDiscussionContent");
                </script>-->

            </xsl:otherwise>
        </xsl:choose>



    </xsl:template>
</xsl:stylesheet>
