﻿<?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/ItemDropDown.xslt"/>

    <xsl:template match="/">
        <xsl:variable name="TemplateURL" select="normalize-space(ActionPlan/AjaxRequest/TemplateURL)" />
        <xsl:variable name="HostName" select="normalize-space(ActionPlan/AjaxRequest/HostName)" />
        <xsl:variable name="Mode" select="normalize-space(ActionPlan/AjaxRequest/Params/Mode)"/>
        <xsl:variable name="lsItemID" select="normalize-space(ActionPlan/AjaxRequest/Params/ItemID)"/>
        <xsl:variable name="ModeSwitch" select="normalize-space(ActionPlan/AjaxRequest/Params/ModeSwitch)"/>

        <!--<xsl:variable name="ItemCollection" select="normalize-space(ActionPlan/ItemStatusCollection/Items/.)" />-->
        <div id="divActionPlanContainerControl">
            <!--<xsl:if test="ActionPlan/UserRoles/Role[RoleName = 'Community Admin']">-->
            <xsl:choose>
                <xsl:when test="$ModeSwitch = '0'">
                    <div style="width:100%; text-align:right;margin-top:-40px;margin-bottom:20px;margin-left:20px;" id="divFullScreenModeIcon">
                        <img border="0" onclick="workout_ExpandToFullScreen('-99','ActionPlan');" class="link"
                             title="Full Screen" src="{$TemplateURL}/Web/Images/full_screen.png" width="20" height="20"></img>
                    </div>
                    <input type="hidden" id="txtWorkoutDisplayMode" value="Min"></input>
                </xsl:when>
            </xsl:choose>
            <!--</xsl:if>-->
            <xsl:choose>
                <xsl:when test="$ModeSwitch = '0'">
                    <div style="text-align:left;">
                        <table class="tableMaster" cellpadding="2" cellspacing ="2" >
                            <tr style="background-color:#C6C4C4;">
                                <!--<td class="labelFormFields" width="5%">
                                    <span class="labelSize11">Display:&#xa0;</span>
                                </td>-->
                                <xsl:choose>
                                    <xsl:when test="$Mode = '99' or $Mode = '1'">
                                        <td class="labelFormFields" style="background-color:#376092;text-align:center;" width="25%"
                                            id="td_1_Display_Menu" onClick="displaySelectedAction('1');">
                                            <input id="rdbActionPlan_MyGoals" type="radio" checked="true" name="ActionPlanMode"
                                                   style="display:none;">
                                                <a style="font-family: Calibri, Verdana, Arial;
	                                        font-size: 12pt;cursor:pointer;color:#FFFFFF;"
                                                onclick="return GetActionPlan(
                                                'ActionPlanItemsContainer',
                                                '{normalize-space(ActionPlan/AjaxRequest/Params/ItemID)}',
                                                '1','1');">My Goals List</a>
                                            </input>
                                        </td>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <td class="labelFormFields" style="text-align:center;" width="25%" id="td_1_Display_Menu"
                                            onClick="displaySelectedAction('1');">
                                            <input id="rdbActionPlan_MyGoals" type="radio" name="ActionPlanMode"
                                                   style="display:none;">
                                                <a style="font-family: Calibri, Verdana, Arial;
	                                        font-size: 12pt;cursor:pointer;color:#FFFFFF;"
                                                onclick="return GetActionPlan(
                                                'ActionPlanItemsContainer',
                                                '{normalize-space(ActionPlan/AjaxRequest/Params/ItemID)}',
                                                '1','1');">My Goals List</a>
                                            </input> 
                                        </td>
                                    </xsl:otherwise>
                                </xsl:choose>
                                <xsl:choose>
                                    <xsl:when test="$Mode = '2'">
                                        <td class="labelFormFields" style="background-color:#376092;text-align:center;" width="25%"
                                            id="td_3_Display_Menu" onClick="displaySelectedAction('3');">
                                            <input id="rdbActionPlan_ThisWeek" type="radio" checked="true" name="ActionPlanMode"
                                                   style="display:none;">
                                                <a style="font-family: Calibri, Verdana, Arial;
	                                        font-size: 12pt;cursor:pointer;color:#FFFFFF;"
                                                onclick="return GetDoITData(
                                                   'ActionPlanItemsContainer', 
                                                   '{normalize-space(ActionPlan/AjaxRequest/Params/ItemID)}', 
                                                   'ActionPlan', 
                                                   '1.1', 
                                                   '1')">This Week</a>
                                            </input>
                                        </td>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <td class="labelFormFields" style="text-align:center;" width="25%"
                                            id="td_3_Display_Menu" onClick="displaySelectedAction('3');">
                                            <input id="rdbActionPlan_ThisWeek" type="radio" name="ActionPlanMode"
                                                   style="display:none;">
                                                <a style="font-family: Calibri, Verdana, Arial;
	                                        font-size: 12pt;cursor:pointer;color:#FFFFFF;"
                                                onclick="return GetDoITData(
                                                   'ActionPlanItemsContainer', 
                                                   '{normalize-space(ActionPlan/AjaxRequest/Params/ItemID)}', 
                                                   'ActionPlan', 
                                                   '1.1', 
                                                   '1')">This Week</a>
                                            </input>
                                        </td>
                                    </xsl:otherwise>
                                </xsl:choose>
                                <xsl:choose>
                                    <xsl:when test="$Mode = '4'">
                                        <td class="labelFormFields" style="background-color:#376092;text-align:center;" width="25%"
                                            id="td_2_Display_Menu" onClick="displaySelectedAction('2');">
                                            <input id="rdbActionPlan_ThisMonth" type="radio" checked="true" name="ActionPlanMode"
                                                   style="display:none;">
                                                <a style="font-family: Calibri, Verdana, Arial;
	                                        font-size: 12pt;cursor:pointer;color:#FFFFFF;"
                                                onclick="return planner_LoadCalendar('',
                                            'ActionPlanItemsContainer','4', '{normalize-space(ActionPlan/AjaxRequest/Params/ItemID)}','-99','-99','ActionPlan'
                                            );">Monthly Calendar</a>
                                            </input>
                                        </td>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <td class="labelFormFields" style="text-align:center;" width="25%"
                                            id="td_2_Display_Menu" onClick="displaySelectedAction('2');">
                                            <input id="rdbActionPlan_ThisMonth" type="radio" name="ActionPlanMode"
                                                   style="display:none;">
                                                <a style="font-family: Calibri, Verdana, Arial;
	                                        font-size: 12pt;cursor:pointer;color:#FFFFFF;"
                                                onclick="return planner_LoadCalendar('',
                                            'ActionPlanItemsContainer','4', '{normalize-space(ActionPlan/AjaxRequest/Params/ItemID)}','-99','-99','ActionPlan'
                                            );">Monthly Calendar</a>
                                            </input>
                                        </td>
                                    </xsl:otherwise>
                                </xsl:choose>
                               
                                <!--<td class="labelFormFields">
                                    <xsl:choose>
                                        <xsl:when test="$Mode = '2'">
                                            <input id="rdbActionPlan_ThisWeek" type="radio" checked="true" name="ActionPlanMode"
                                                   >This Week</input>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <input id="rdbActionPlan_ThisWeek" type="radio" name="ActionPlanMode"
                                                   onclick="return GetDoITData(
                                                   'ActionPlanItemsContainer', 
                                                   '{normalize-space(ActionPlan/AjaxRequest/Params/ItemID)}', 
                                                   'ActionPlan', 
                                                   '1.1', 
                                                   '1')">This Week</input>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </td>-->
                                <xsl:choose>
                                    <xsl:when test="$Mode = '3'">
                                        <td class="labelFormFields" style="background-color:#376092;text-align:center;" width="25%"
                                            id="td_4_Display_Menu" onClick="displaySelectedAction('4');">
                                            <input id="rdbActionPlan_CompletedGoals" type="radio" checked="true" name="ActionPlanMode"
                                                   style="display:none;">
                                                <a style="font-family: Calibri, Verdana, Arial;
	                                        font-size: 12pt;cursor:pointer;color:#FFFFFF;"
                                                onclick="return GetActionPlan(
                                            'ActionPlanItemsContainer',
                                            '{normalize-space(ActionPlan/AjaxRequest/Params/ItemID)}',
                                            '3','1');">Completed Goals</a>
                                            </input>
                                        </td>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <td class="labelFormFields" style="text-align:center;" width="25%"
                                            id="td_4_Display_Menu" onClick="displaySelectedAction('4');">
                                            <input id="rdbActionPlan_CompletedGoals" type="radio" name="ActionPlanMode"
                                                   style="display:none;">
                                                <a style="font-family: Calibri, Verdana, Arial;
	                                        font-size: 12pt;cursor:pointer;color:#FFFFFF;"
                                               onclick="return GetActionPlan(
                                            'ActionPlanItemsContainer',
                                            '{normalize-space(ActionPlan/AjaxRequest/Params/ItemID)}',
                                            '3','1');">Completed Goals</a>
                                            </input>
                                        </td>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </tr>
                        </table>
                    </div>
                    <div id="ActionPlanItemsContainer" style="width: 95%; margin-top: 20px;text-align:left;padding-left:10px;">
                        <xsl:choose>
                            <xsl:when test="$Mode = '2'">
                                <xsl:value-of select="normalize-space(ActionPlan/ActionPlanThisWeekHtml)" disable-output-escaping="yes"/>
                            </xsl:when>
                            <xsl:when test="$Mode = '4'">
                                <xsl:value-of select="normalize-space(ActionPlan/PlannerHtml)" disable-output-escaping="yes"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:for-each select="ActionPlan/GoalItems/LifeSpaces/LifeSpace[$lsItemID &lt;=1 or ItemID = $lsItemID]">
                                    <!--<xsl:for-each select="ActionPlan/LifeSpaces/LifeSpace">-->
                                    <xsl:variable name="LifeSpaceItemID" select="ItemID"></xsl:variable>

                                    <xsl:if test="ItemPermissionID &gt; 0 or TypeID =2 or count(../../GoalItem[LifeSpaceID = $LifeSpaceItemID]) &gt; 0">
                                        <table width="100%">
                                            <tr>
                                                <td style="vertical-align: top; text-align: center; width: 100px; 
                                            padding-top: 10px; padding-bottom: 10px;" align="center">
                                                    <div>
                                                        <div>
                                                            <a href="http://{$HostName}/LifeSpace.aspx?ID={normalize-space(ItemID)}" target="_blank" class="link">
                                                                <xsl:choose>
                                                                    <xsl:when test="ItemID > 6">
                                                                        <img src="{$TemplateURL}Web/Images/LifeSpace LLC.jpg"
                                                                                height="70px" width="52px"></img>
                                                                    </xsl:when>
                                                                    <xsl:otherwise>
                                                                        <img src="{$TemplateURL}Web/Images/{normalize-space(Item)}.jpg"
                                                                             height="70px" width="52px"></img>
                                                                    </xsl:otherwise>
                                                                </xsl:choose>
                                                            </a>
                                                        </div>
                                                        <div>
                                                            <a href="http://{$HostName}/LifeSpace.aspx?ID={normalize-space(ItemID)}" target="_blank" class="link">
                                                                <xsl:value-of select="Item"/>
                                                            </a>
                                                        </div>
                                                        <xsl:if test="count(../../GoalItem[LifeSpaceID = $LifeSpaceItemID]) &gt;= 1 and (ItemPermissionID &gt; 0 or TypeID =2)">
                                                            <div style="margin-top:10px;">
                                                                <a href="http://{$HostName}/CreateGoal.aspx?ID={normalize-space(ItemID)}"
                                                                   class="anchorButton"
                                                                   style="color: white; text-decoration: none;font-size: 8pt;">Add New Goal</a>
                                                            </div>
                                                        </xsl:if>
                                                    </div>
                                                </td>
                                                <td style="vertical-align: top; padding-top: 10px; padding-bottom: 10px;">
                                                    <xsl:if test="count(../../GoalItem[LifeSpaceID = $LifeSpaceItemID]) = 0">
                                                        <div style="margin-top: 10px; margin-bottom: 10px; width: 100%; text-align: center">You have no goals in this area.</div>
                                                        <div align="center">
                                                            <a href="http://{$HostName}/CreateGoal.aspx?ID={normalize-space(ItemID)}" class="anchorButton"
                                                               style="color: white; text-decoration: none; font-size:8pt;">Add New Goal</a>
                                                        </div>
                                                    </xsl:if>
                                                    <xsl:for-each select="../../GoalItem[LifeSpaceID = $LifeSpaceItemID]">
                                                        <xsl:variable name="actionText">
                                                            <xsl:choose>
                                                                <xsl:when test="TotalActions=1">
                                                                    <xsl:text>Action</xsl:text>
                                                                </xsl:when>
                                                                <xsl:when test="TotalActions &gt; 1 or TotalActions=0">
                                                                    <xsl:text>Actions</xsl:text>
                                                                </xsl:when>
                                                            </xsl:choose>
                                                        </xsl:variable>
                                                        <xsl:variable name="workoutText">
                                                            <xsl:choose>
                                                                <xsl:when test="TotalWorkouts = 1">
                                                                    <xsl:text>Workout</xsl:text>
                                                                </xsl:when>
                                                                <xsl:when test="TotalWorkouts &gt; 1 or TotalWorkouts = 0">
                                                                    <xsl:text>Workouts</xsl:text>
                                                                </xsl:when>
                                                            </xsl:choose>
                                                        </xsl:variable>
                                                        <div style="width: 100%;">
                                                            <div id="div_actionPlan_{GoalID}">
                                                                <table class="tableMaster">
                                                                    <!--<table class="tableMaster" border="1">-->
                                                                    <tr>
                                                                        <td aligm="left" style="vertical-align: bottom;">
                                                                            <xsl:choose>
                                                                                <xsl:when test="$Mode = '3'">
                                                                                    <span class="link" style="text-align: left;"
                                                                                          onmouseover="this.style.textDecoration='underline';"
                                                                                          onmouseout="this.style.textDecoration='none';">
                                                                                        <xsl:value-of select="GoalName"/>
                                                                                    </span>
                                                                                </xsl:when>
                                                                                <xsl:when test="TotalActions = 0 and TotalWorkouts=0">
                                                                                    <span class="link" style="text-align: left;"
                                                                                          onmouseover="this.style.textDecoration='underline';"
                                                                                          onmouseout="this.style.textDecoration='none';"
                                                                                          onClick="return DoIt_DisplayNoActionText('div_actionPlan_{GoalID}_NoAction_Content');">
                                                                                        <xsl:value-of select="GoalName"/>
                                                                                    </span> (<xsl:value-of select="TotalActions"/>&#xa0;Actions,&#xa0;<xsl:value-of select="TotalWorkouts"/>&#xa0;
                                                                                    <xsl:choose>
                                                                                        <xsl:when test="TotalWorkouts=0 or TotalWorkouts &gt;1">
                                                                                            <xsl:text>Workouts</xsl:text>
                                                                                        </xsl:when>
                                                                                        <xsl:when test="TotalWorkouts=1">
                                                                                            <xsl:text>Workout</xsl:text>
                                                                                        </xsl:when>
                                                                                    </xsl:choose>
                                                                                    )
                                                                                </xsl:when>
                                                                                <xsl:otherwise>
                                                                                    <span class="link"
                                                                                          onmouseover="this.style.textDecoration='underline';"
                                                                                          onmouseout="this.style.textDecoration='none';"
                                                                                          onclick="return DoIt_getDoItForSelectedOrder(
                                                                                    'div_actionPlan_{GoalID}_content'
                                                                                    , '{GoalID}', 'Day/Goal'
                                                                                    , '2', '{$lsItemID}');"
                                                                                          style="text-align: left;">
                                                                                        <xsl:value-of select="GoalName"/>
                                                                                    </span> (<xsl:value-of select="TotalActions"/>&#xa0;<xsl:value-of select="$actionText"/>,&#xa0;<xsl:value-of select="TotalWorkouts"/>&#xa0;<xsl:value-of select="$workoutText"/>)
                                                                                </xsl:otherwise>
                                                                            </xsl:choose>
                                                                        </td>
                                                                        <td style="width:100px;	margin-left: 5px;text-align:left;vertical-align: bottom;">
                                                                            <!--<xsl:value-of select="$ItemCollection"/>-->
                                                                            <xsl:call-template name="ItemDropDown">
                                                                                <xsl:with-param name="ItemID" select="GoalID"/>
                                                                                <xsl:with-param name="Action" select="'ActionPlan_UpdateGoalStatus'"/>
                                                                                <xsl:with-param name="ItemDivPrefix">
                                                                                    actionPlan_goalStatus_<xsl:value-of select="GoalID"/>
                                                                                </xsl:with-param>
                                                                                <xsl:with-param name="ItemCollection"
                                                                                                select="../../ItemStatusCollection/Items/."/>
                                                                                <xsl:with-param name="CurrentOptionID" select="StatusID" />
                                                                                <xsl:with-param name="IsModifiable">
                                                                                    <xsl:choose>
                                                                                        <xsl:when test="PermissionID = 4">
                                                                                            <xsl:text>true</xsl:text>
                                                                                        </xsl:when>
                                                                                        <xsl:otherwise>
                                                                                            <xsl:text>false</xsl:text>
                                                                                        </xsl:otherwise>
                                                                                    </xsl:choose>
                                                                                </xsl:with-param>
                                                                            </xsl:call-template>
                                                                        </td>
                                                                        <td style="width:100px;	margin-left: 5px;text-align:right; vertical-align: bottom;">
                                                                            <xsl:if test="TemplateActivate != 1">
                                                                                <a href="http://{$HostName}/Goal.aspx?ID={GoalID}">
                                                                                    <img src="{$TemplateURL}Web/Images/BtnOpenGoal.png" title="Open Goal" style="border: 0px;"></img>
                                                                                </a>
                                                                            </xsl:if>
                                                                            <xsl:if test="TemplateActivate = 1">
                                                                                <a href="http://{$HostName}/Goal.aspx?ID={GoalID}">
                                                                                    <img src="{$TemplateURL}Web/Images/BtnActivate.png" title="Open Goal" style="border: 0px;"></img>
                                                                                </a>
                                                                            </xsl:if>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td colspan="3">

                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </div>
                                                            <div id="div_actionPlan_{GoalID}_content"
                                                                             style="display: none;">

                                                            </div>
                                                            <div id="div_actionPlan_{GoalID}_NoAction_Content"
                                                                        style="display: none;">
                                                                <span class="label" style="margin:10px;">
                                                                    You have no current items.<a href="http://{$HostName}/Goal.aspx?ID={GoalID}" class="link"
                                              target="_blank">&#xa0;Open Goal&#xa0;</a>to view goal details.
                                                                </span>
                                                            </div>
                                                        </div>
                                                    </xsl:for-each>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <div class="seperatorLine"></div>
                                                </td>
                                            </tr>
                                        </table>
                                    </xsl:if>
                                </xsl:for-each>
                            </xsl:otherwise>
                        </xsl:choose>
                    </div>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:choose>
                        <xsl:when test="$Mode = '2'">
                            <xsl:value-of select="normalize-space(ActionPlan/ActionPlanThisWeekHtml)" disable-output-escaping="yes"/>
                        </xsl:when>
                        <xsl:when test="$Mode = '4'">
                            <xsl:value-of select="normalize-space(ActionPlan/PlannerHtml)" disable-output-escaping="yes"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:for-each select="ActionPlan/GoalItems/LifeSpaces/LifeSpace[$lsItemID &lt;=1 or ItemID = $lsItemID]">
                                <!--<xsl:for-each select="ActionPlan/LifeSpaces/LifeSpace">-->
                                <xsl:variable name="LifeSpaceItemID" select="ItemID"></xsl:variable>

                                <xsl:if test="ItemPermissionID &gt; 0 or TypeID =2 or count(../../GoalItem[LifeSpaceID = $LifeSpaceItemID]) &gt; 0">
                                    <table width="100%">
                                        <tr>
                                            <td style="vertical-align: top; text-align: center; width:100px;" align="center">
                                                <div>
                                                    <div>
                                                        <a href="http://{$HostName}/LifeSpace.aspx?ID={normalize-space(ItemID)}" class="link">
                                                            <xsl:choose>
                                                                <xsl:when test="ItemID > 6">
                                                                    <img src="{$TemplateURL}Web/Images/LifeSpace LLC.jpg"
                                                                            height="70px" width="52px"></img>
                                                                </xsl:when>
                                                                <xsl:otherwise>
                                                                    <img src="{$TemplateURL}Web/Images/{normalize-space(Item)}.jpg"
                                                                         height="70px" width="52px"></img>
                                                                </xsl:otherwise>
                                                            </xsl:choose>
                                                        </a>
                                                    </div>
                                                    <div>
                                                        <a href="http://{$HostName}/LifeSpace.aspx?ID={normalize-space(ItemID)}" class="link">
                                                            <xsl:value-of select="Item"/>
                                                        </a>
                                                    </div>
                                                    <xsl:if test="count(../../GoalItem[LifeSpaceID = $LifeSpaceItemID]) &gt;= 1">
                                                        <div style="margin-top:10px;">
                                                            <a href="http://{$HostName}/CreateGoal.aspx?ID={normalize-space(ItemID)}"
                                                               class="anchorButton" style="color: white; text-decoration: none;">Add New Goal</a>
                                                        </div>
                                                    </xsl:if>
                                                </div>
                                            </td>
                                            <td style="vertical-align: top; padding-top: 10px; padding-bottom: 10px;">
                                                <xsl:if test="count(../../GoalItem[LifeSpaceID = $LifeSpaceItemID]) = 0">
                                                    <div style="margin-top: 10px; margin-bottom: 10px; width: 100%; text-align: center">You have no goals in this area.</div>
                                                    <div align="center">
                                                        <a href="http://{$HostName}/CreateGoal.aspx?ID={normalize-space(ItemID)}" class="anchorButton"
                                                           style="color: white; text-decoration: none;">Add New Goal</a>
                                                    </div>
                                                </xsl:if>
                                                <xsl:for-each select="../../GoalItem[LifeSpaceID = $LifeSpaceItemID]">
                                                    <xsl:variable name="actionText">
                                                        <xsl:choose>
                                                            <xsl:when test="TotalActions=1">
                                                                <xsl:text>Action</xsl:text>
                                                            </xsl:when>
                                                            <xsl:when test="TotalActions &gt; 1 or TotalActions=0">
                                                                <xsl:text>Actions</xsl:text>
                                                            </xsl:when>
                                                        </xsl:choose>
                                                    </xsl:variable>
                                                    <xsl:variable name="workoutText">
                                                        <xsl:choose>
                                                            <xsl:when test="TotalWorkouts = 1">
                                                                <xsl:text>Workout</xsl:text>
                                                            </xsl:when>
                                                            <xsl:when test="TotalWorkouts &gt; 1 or TotalWorkouts = 0">
                                                                <xsl:text>Workouts</xsl:text>
                                                            </xsl:when>
                                                        </xsl:choose>
                                                    </xsl:variable>

                                                    <div style="width: 100%;">
                                                        <div id="div_actionPlan_{GoalID}">
                                                            <table class="tableMaster">
                                                                <!--<table class="tableMaster" border="1">-->
                                                                <tr>
                                                                    <td aligm="left" style="vertical-align: bottom;">
                                                                        <xsl:choose>
                                                                            <xsl:when test="$Mode = '3'">
                                                                                <span class="link" style="text-align: left;"
                                                                                      onmouseover="this.style.textDecoration='underline';"
                                                                                      onmouseout="this.style.textDecoration='none';">
                                                                                    <xsl:value-of select="GoalName"/>
                                                                                </span>

                                                                            </xsl:when>
                                                                            <xsl:when test="TotalActions = 0 and TotalWorkouts=0">
                                                                                <span class="link" style="text-align: left;"
                                                                                      onmouseover="this.style.textDecoration='underline';"
                                                                                      onmouseout="this.style.textDecoration='none';"
                                                                                      onClick="return DoIt_DisplayNoActionText('div_actionPlan_{GoalID}_NoAction_Content');">
                                                                                    <xsl:value-of select="GoalName"/>
                                                                                </span> (<xsl:value-of select="TotalActions"/>&#xa0;Actions,&#xa0;<xsl:value-of select="TotalWorkouts"/>&#xa0;
                                                                                <xsl:choose>
                                                                                    <xsl:when test="TotalWorkouts=0 or TotalWorkouts &gt;1">
                                                                                        <xsl:text>Workouts</xsl:text>
                                                                                    </xsl:when>
                                                                                    <xsl:when test="TotalWorkouts=1">
                                                                                        <xsl:text>Workout</xsl:text>
                                                                                    </xsl:when>
                                                                                </xsl:choose>)
                                                                            </xsl:when>
                                                                            <xsl:otherwise>
                                                                                <span class="link"
                                                                                          onmouseover="this.style.textDecoration='underline';"
                                                                                          onmouseout="this.style.textDecoration='none';"
                                                                                          onclick="return DoIt_getDoItForSelectedOrder(
                                                                                    'div_actionPlan_{GoalID}_content'
                                                                                    , '{GoalID}', 'Day/Goal'
                                                                                    , '2', '{$lsItemID}');"
                                                                                          style="text-align: left;">
                                                                                    <xsl:value-of select="GoalName"/>
                                                                                </span> (<xsl:value-of select="TotalActions"/>&#xa0;<xsl:value-of select="$actionText"/>,&#xa0;<xsl:value-of select="TotalWorkouts"/>&#xa0;<xsl:value-of select="$workoutText"/>)
                                                                            </xsl:otherwise>
                                                                        </xsl:choose>
                                                                    </td>
                                                                    <td style="width:100px;	margin-left: 5px;text-align:left;vertical-align: bottom;">
                                                                        <!--<xsl:value-of select="$ItemCollection"/>-->
                                                                        <xsl:call-template name="ItemDropDown">
                                                                            <xsl:with-param name="ItemID" select="GoalID"/>
                                                                            <xsl:with-param name="Action" select="'ActionPlan_UpdateGoalStatus'"/>
                                                                            <xsl:with-param name="ItemDivPrefix">
                                                                                actionPlan_goalStatus_<xsl:value-of select="GoalID"/>
                                                                            </xsl:with-param>
                                                                            <xsl:with-param name="ItemCollection"
                                                                                            select="../../ItemStatusCollection/Items/."/>
                                                                            <xsl:with-param name="CurrentOptionID" select="StatusID" />
                                                                            <xsl:with-param name="IsModifiable">
                                                                                <xsl:choose>
                                                                                    <xsl:when test="PermissionID = 4">
                                                                                        <xsl:text>true</xsl:text>
                                                                                    </xsl:when>
                                                                                    <xsl:otherwise>
                                                                                        <xsl:text>false</xsl:text>
                                                                                    </xsl:otherwise>
                                                                                </xsl:choose>
                                                                            </xsl:with-param>
                                                                        </xsl:call-template>
                                                                    </td>
                                                                    <td style="width:100px;	margin-left: 5px;text-align:right; vertical-align: bottom;">
                                                                        <xsl:if test="TemplateActivate != 1">
                                                                            <a href="http://{$HostName}/Goal.aspx?ID={GoalID}">
                                                                                <img src="{$TemplateURL}Web/Images/BtnOpenGoal.png" title="Open Goal" style="border: 0px;"></img>
                                                                            </a>
                                                                        </xsl:if>
                                                                        <xsl:if test="TemplateActivate = 1">
                                                                            <a href="http://{$HostName}/Goal.aspx?ID={GoalID}">
                                                                                <img src="{$TemplateURL}Web/Images/BtnActivate.png" title="Open Goal" style="border: 0px;"></img>
                                                                            </a>
                                                                        </xsl:if>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td colspan="3">

                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </div>
                                                        <div id="div_actionPlan_{GoalID}_content"
                                                                         style="display: none;">

                                                        </div>
                                                        <div id="div_actionPlan_{GoalID}_NoAction_Content"
                                                                         style="display: none;">
                                                            <span class="label" style="margin:10px;">
                                                                You have no current items.<a href="http://{$HostName}/Goal.aspx?ID={GoalID}" class="link"
                                                                 target="_blank">&#xa0;Open Goal&#xa0;</a>to view goal details.
                                                            </span>
                                                        </div>
                                                    </div>
                                                </xsl:for-each>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                <div class="seperatorLine"></div>
                                            </td>
                                        </tr>
                                    </table>
                                </xsl:if>
                            </xsl:for-each>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:otherwise>
            </xsl:choose>
        </div>

    </xsl:template>
</xsl:stylesheet>
