﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:include href="GenericTemplates/Notes_LineBreak.xslt" />


    <xsl:variable name="TargetURL">
        <xsl:text>http://www.lifespace.com</xsl:text>
    </xsl:variable>


    <xsl:template match="/">
        <xsl:variable name="TotalCurrentActions" select="count(UserActions/Item)"/>
        <xsl:variable name="PastDueActions" select="UserActions/TotalPastDueActions"/>
        <xsl:variable name="User" select="UserActions/Item/UserName"/>
        <xsl:variable name="TemplateURL" select="UserActions/TemplateURL"/>
        <xsl:variable name="AttachItemID" select="UserActions/Item/AttachItemID"></xsl:variable>
        <xsl:variable name="AttachItemTypeID" select="UserActions/Item/AttachItemTypeID"></xsl:variable>
        <xsl:variable name="ImageURL" select="UserActions/Item/ImageURL"></xsl:variable>
        <xsl:variable name="Description" select="UserActions/Item/Description"></xsl:variable>
        <xsl:variable name="Title" select="UserActions/Item/Title"></xsl:variable>
        <xsl:variable name="CurrentDay" select="UserActions/CurrentDay"/>
        <xsl:variable name="CurrentMonth" select="UserActions/CurrentMonth"/>
        <xsl:variable name="GoalImageURL" select="UserActions/Item/GoalImageURL"></xsl:variable>
        <xsl:variable name="ActiveMasterBrandID">
            <xsl:choose>
                <xsl:when test="UserActions/ActiveMasterBrandID">
                    <xsl:value-of select="UserActions/ActiveMasterBrandID"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:number value="-99"></xsl:number>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:variable name="ActiveMasterBrandTargetURL" select="UserActions/MasterBrand/TargetURL"></xsl:variable>

        <xsl:variable name="NotificationLogoURLPath">
            <xsl:choose>
                <xsl:when test="UserActions/MasterBrandSettings/MasterBrandSetting[MBrandID = $ActiveMasterBrandID and SettingKey = 'NotificationLogoURLPath']/SettingValue">
                    <xsl:value-of select="UserActions/MasterBrandSettings/MasterBrandSetting[MBrandID = $ActiveMasterBrandID]/SettingValue"/>
                </xsl:when>
                <xsl:otherwise>                    
                    <xsl:value-of select="$TargetURL"/>
                    <xsl:text>/desktopModules/LifespaceTemplates/Web/Images/Ver_2_0/logo.png</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:variable name="NotificationHeaderColor">
            <xsl:choose>
                <xsl:when test="UserActions/MasterBrandSettings/MasterBrandSetting[MBrandID = $ActiveMasterBrandID and SettingKey = 'NotificationHeaderColor']/SettingValue">
                    <xsl:value-of select="UserActions/MasterBrandSettings/MasterBrandSetting[MBrandID = $ActiveMasterBrandID and SettingKey = 'NotificationHeaderColor']/SettingValue"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>#3F3F41</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:variable name="NotificationHeaderCornerLeft">
            <xsl:choose>
                <xsl:when test="UserActions/MasterBrandSettings/MasterBrandSetting[MBrandID = $ActiveMasterBrandID and SettingKey = 'NotificationRoundCornerLeft']/SettingValue">
                    <xsl:value-of select="UserActions/MasterBrandSettings/MasterBrandSetting[MBrandID = $ActiveMasterBrandID and SettingKey = 'NotificationRoundCornerLeft']/SettingValue"/>
                </xsl:when>
                <xsl:otherwise>                    
                    <xsl:value-of select="$TargetURL"/>
                    <xsl:text>/desktopModules/LifespaceTemplates/Web/Images/Ver_2_0/LtTop.png</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:variable name="NotificationHeaderCornerRight">
            <xsl:choose>
                <xsl:when test="UserActions/MasterBrandSettings/MasterBrandSetting[MBrandID = $ActiveMasterBrandID and SettingKey = 'NotificationRoundCornerRight']/SettingValue">
                    <xsl:value-of select="UserActions/MasterBrandSettings/MasterBrandSetting[MBrandID = $ActiveMasterBrandID and SettingKey = 'NotificationRoundCornerRight']/SettingValue"/>
                </xsl:when>
                <xsl:otherwise>                    
                    <xsl:value-of select="$TargetURL"/>
                    <xsl:text>/desktopModules/LifespaceTemplates/Web/Images/Ver_2_0/RtTop.png</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>




        <xsl:variable name="ItemDisplay">
            <xsl:choose>
                <xsl:when test ="$TotalCurrentActions = 1">
                    <xsl:text>item</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>items</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:variable name="PastDueActionItemsDisplay">
            <xsl:choose>
                <xsl:when test="$PastDueActions &gt; 1">
                    <xsl:text>items</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>item</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:variable name="UserNameOnHeaderFontColor">
            <xsl:choose>
                <xsl:when test="$NotificationHeaderColor = '#EDEDED'">
                    <xsl:text>#4B4B4B</xsl:text>
                </xsl:when>
                <xsl:when test="$NotificationHeaderColor = '#b0d1e0'">
                    <xsl:text>#787878</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>#b5bbc2</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <xsl:variable name="MonthDayOnHeaderFontColor">
            <xsl:choose>
                <xsl:when test="$NotificationHeaderColor = '#EDEDED'">
                    <xsl:text>#787878</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>white</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>


        <html>
            <head>
            </head>
            <body>
                <table width="100%" cellspacing="0" cellpadding="0" style="width: 100.0%; background: #f2f2f2;">
                    <tbody>
                        <tr>
                            <td valign="top" style="padding: 0in 0in 0in 0in; min-height: 10px">
                                <div align="center">
                                    <table width="600" cellspacing="0" cellpadding="0" border="0" style="width: 6.25in;background: {$NotificationHeaderColor}">
                                        <tbody>
                                            <tr style="min-height: 7.5pt">
                                                <td width="25" valign="top" style="width: 18.75pt; padding: 0in 0in 0in 0in; min-height: 7.5pt">
                                                    <p style="line-height: 0%;margin:0;">
                                                        <img width="10" height="10" border="0" src="{$NotificationHeaderCornerLeft}" />
                                                    </p>
                                                </td>
                                                <td style="padding: 0in 0in 0in 0in; min-height: 7.5pt">
                                                </td>
                                                <td width="25" valign="top" style="width: 18.75pt; padding: 0in 0in 0in 0in; min-height: 7.5pt;min-height: 10px">
                                                    <p align="right" style="text-align: right; line-height: 0%;margin:0;">
                                                        <img width="10" height="10" border="0" src="{$NotificationHeaderCornerRight}" />
                                                    </p>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="padding: 0in 0in 0in 0in">
                                                </td>
                                                <td style="padding: 0in 0in 0in 0in">
                                                    <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100.0%">
                                                        <tbody>
                                                            <tr>
                                                                <td style="padding: 0in 0in 0in 0in">
                                                                    <p style="margin:0;">
                                                                        <img height="32" border="0" alt="LifeSpace" src="{$NotificationLogoURLPath}" />
                                                                    </p>
                                                                </td>
                                                                <td style="padding: 0in 0in 0in 0in">
                                                                    <div align="right">
                                                                        <table cellspacing="0" cellpadding="0" border="0">
                                                                            <tbody>
                                                                                <tr>
                                                                                    <td style="padding: 0in 3.75pt 0in 0in">
                                                                                        <div>
                                                                                            <b>
                                                                                                <span style="color: {$UserNameOnHeaderFontColor};text-align: right;margin:0;font-size:12.5pt;text-transform: capitalize;">
                                                                                                    <xsl:value-of select="$User"/>
                                                                                                </span>
                                                                                            </b>
                                                                                        </div>
                                                                                        <div>
                                                                                            <p style="text-align: right;margin:0;">
                                                                                                <span style="color: {$MonthDayOnHeaderFontColor};">
                                                                                                    <xsl:value-of select="$CurrentMonth"/>
                                                                                                </span>
                                                                                            </p>
                                                                                        </div>
                                                                                    </td>
                                                                                    <td style="padding: 0in 0in 0in 0in">
                                                                                        <p style="line-height: 45.0pt;">
                                                                                            <span style="font-size: 45.0pt; color: {$MonthDayOnHeaderFontColor}">
                                                                                                <xsl:value-of select="$CurrentDay"/>
                                                                                            </span>
                                                                                        </p>
                                                                                    </td>
                                                                                </tr>
                                                                            </tbody>
                                                                        </table>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </td>
                                                <td style="padding: 0in 0in 0in 0in">
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <p align="center" style="text-align: center;margin:0;">

                                </p>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" style="padding: 0in 0in 0in 0in">
                                <div align="center">
                                    <table width="600" cellspacing="0" cellpadding="0" border="0" style="width: 6.25in">
                                        <tbody>
                                            <tr>
                                                <td style="padding: 0in 0in 0in 0in">
                                                    <table width="100%" cellspacing="0" cellpadding="0" border="1" style="width: 100.0%;
															background: white; border-top: none; border-left: solid #e4e4e4 1.0pt; border-bottom: none;
															border-right: solid #e4e4e4 1.0pt">
                                                        <tbody>
                                                            <xsl:for-each select ="UserActions/Item[not(following::Item/GoalID = GoalID)]">

                                                                <xsl:variable name="TargetGoalBaseURL">
                                                                    <xsl:choose>
                                                                        <xsl:when test="$ActiveMasterBrandID &gt; 0">
                                                                            <xsl:value-of select="$ActiveMasterBrandTargetURL"/>
                                                                        </xsl:when>
                                                                        <xsl:when test="MasterDomainURL">
                                                                            <xsl:value-of select="MasterDomainURL"/>
                                                                        </xsl:when>
                                                                        <xsl:otherwise>
                                                                            <xsl:text>http://www.lifespace.com</xsl:text>
                                                                        </xsl:otherwise>
                                                                    </xsl:choose>
                                                                </xsl:variable>

                                                                <xsl:variable name="GoalID" select="GoalID"></xsl:variable>
                                                                <tr>
                                                                    <td style="border: none; padding: 2.0pt 15.0pt 0in 15.0pt" colspan="2">
                                                                        <div style="border: none; border-bottom: none; padding: 0in 0in 2.0pt 0in">
                                                                            <h1 style="margin-right: 0in; margin-bottom: 5.5pt; margin-left: 0in; border: none;padding: 0in">
                                                                                <span style="font-size: 16.5pt; font-family: Arial,sans-serif; color: #222222; font-weight: normal">
                                                                                    <img style="border: none;margin:0; padding: 3.0pt 3.0pt 0in 3.0pt;" align="absmiddle"
																						 width="48" height="48" border="0" src="{GoalImageURL}" />
                                                                                    <a href="{$TargetGoalBaseURL}/Goal.aspx?ID={normalize-space(GoalID)}&amp;Ref=EM.due"
																					   style="text-decoration:none;font-size: 16.5pt; font-family: Arial,sans-serif; color: #222222; font-weight: normal;"
																					   target="_blank">
                                                                                        <xsl:value-of select="Goal"/>
                                                                                    </a>
                                                                                </span>
                                                                            </h1>
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                                <xsl:for-each select ="../../UserActions/Item[normalize-space(GoalID)=$GoalID]">
                                                                    <xsl:variable name ="ActionID" select ="ActionID"></xsl:variable>
                                                                    <tr>
                                                                        <td style="border: none; padding: 0in 15.0pt 2.0pt 20.0pt">
                                                                            <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100.0%">
                                                                                <tbody>
                                                                                    <tr>
                                                                                        <td valign="top" style="padding: 0in 0in 0in 0in; min-height: 20px">
                                                                                            <table cellspacing="0" cellpadding="0" border="0">
                                                                                                <tbody>
                                                                                                    <tr>
                                                                                                        <td width="20" valign="top" style="width: 15.0pt; padding: 0in 0in 0in 0in">
                                                                                                            <p style="line-height: 15.0pt;margin:0;">

                                                                                                            </p>
                                                                                                        </td>
                                                                                                        <td style="padding: 0in 0in 0in 0in">
                                                                                                            <div style="border: none; padding: 2.5pt 0in 1.0pt 0in">
                                                                                                                <p style="line-height: 15.0pt;margin:0;">
                                                                                                                    <a href="{$TargetGoalBaseURL}/Goal.aspx?ID={normalize-space(GoalID)}&amp;Ref=EM.due"
																													   target="_blank" style="color: #3088cd; text-decoration: none;font-size: 12.5pt;">
                                                                                                                        <xsl:value-of select="ActionName"/>
                                                                                                                    </a>
                                                                                                                    <div style="border: none; padding: 2.5pt 0in 2.0pt 0in">
                                                                                                                        <span style="color: #3088cd; text-decoration: none;font-size: 10.5pt;color: #6D6E71;">
                                                                                                                            <xsl:call-template name="break">
                                                                                                                                <xsl:with-param name="text" select="ActionDescription"></xsl:with-param>
                                                                                                                            </xsl:call-template>
                                                                                                                        </span>
                                                                                                                    </div>
                                                                                                                </p>
                                                                                                            </div>
                                                                                                        </td>
                                                                                                    </tr>
                                                                                                    <xsl:if test="../Item[AttachItemTypeID]">
                                                                                                        <tr>
                                                                                                            <td width="20" valign="top" style="width: 15.0pt; padding: 0in 15.0pt 5.0pt 15.0pt">
                                                                                                                <p style="line-height: 15.0pt;margin:0;">

                                                                                                                </p>
                                                                                                            </td>
                                                                                                            <td>
                                                                                                                <xsl:for-each select="../Item[AttachItemTypeID = 22 and ActionID = $ActionID]">
                                                                                                                    <div style="border: none; padding: 2.5pt 0in 7.0pt 0in">
                                                                                                                        <table cellpadding="0" border="0" cellspacing="0">
                                                                                                                            <tr>
                                                                                                                                <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                    <xsl:if test="ImageURL != ''">
                                                                                                                                        <a href="{$TargetGoalBaseURL}/Publication.aspx?ID={normalize-space(AttachItemID)}">
                                                                                                                                            <img src ="{ImageURL}" height="45" width="45"></img>
                                                                                                                                        </a>
                                                                                                                                    </xsl:if>
                                                                                                                                </td>
                                                                                                                                <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                    <div>
                                                                                                                                        <span>
                                                                                                                                            <a href="{$TargetGoalBaseURL}/Publication.aspx?ID={normalize-space(AttachItemID)}"
																																			   style="color: #17375E; text-decoration: underline;font-size: 9.5pt;font-weight:bold;">
                                                                                                                                                <xsl:value-of select="Title"/>
                                                                                                                                            </a>
                                                                                                                                        </span>
                                                                                                                                    </div>
                                                                                                                                    <div>
                                                                                                                                        <span style="color: #3088cd; text-decoration: none;font-size: 9.0pt;color: #6D6E71;">
                                                                                                                                            <xsl:value-of select="Description"/>
                                                                                                                                        </span>
                                                                                                                                    </div>
                                                                                                                                </td>
                                                                                                                            </tr>
                                                                                                                        </table>
                                                                                                                    </div>
                                                                                                                </xsl:for-each>
                                                                                                                <xsl:for-each select="../Item[AttachItemTypeID = 19 and ActionID = $ActionID]">
                                                                                                                    <div style="border: none; padding: 2.5pt 0in 7.0pt 0in">
                                                                                                                        <table cellpadding="0" border="0" cellspacing="0">
                                                                                                                            <tr>
                                                                                                                                <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                    <xsl:if test="ImageURL != ''">
                                                                                                                                        <a href="{$TargetGoalBaseURL}/Content.aspx?ID={normalize-space(AttachItemID)}">
                                                                                                                                            <img src ="{ImageURL}" height="45" width="45"></img>
                                                                                                                                        </a>
                                                                                                                                    </xsl:if>
                                                                                                                                </td>
                                                                                                                                <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                    <div>
                                                                                                                                        <span>
                                                                                                                                            <a href="{$TargetGoalBaseURL}/Content.aspx?ID={normalize-space(AttachItemID)}"
																																			   style="color: #17375E; text-decoration: underline;font-size: 9.5pt;font-weight:bold;">
                                                                                                                                                <xsl:value-of select="Title"/>
                                                                                                                                            </a>
                                                                                                                                        </span>
                                                                                                                                    </div>
                                                                                                                                    <div>
                                                                                                                                        <span style="color: #3088cd; text-decoration: none;font-size: 9.0pt;color: #6D6E71;">
                                                                                                                                            <xsl:value-of select="Description"/>
                                                                                                                                        </span>
                                                                                                                                    </div>
                                                                                                                                </td>
                                                                                                                            </tr>
                                                                                                                        </table>
                                                                                                                    </div>
                                                                                                                </xsl:for-each>
                                                                                                                <xsl:for-each select="../Item[AttachItemTypeID = 23 and ActionID = $ActionID]">
                                                                                                                    <div style="border: none; padding: 2.5pt 0in 7.0pt 0in">
                                                                                                                        <table cellpadding="0" border="0" cellspacing="0">
                                                                                                                            <tr>
                                                                                                                                <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                    <xsl:if test="ImageURL != ''">
                                                                                                                                        <a href="{$TargetGoalBaseURL}/{PromoteKey}">
                                                                                                                                            <img src ="{ImageURL}" height="45" width="45"></img>
                                                                                                                                        </a>
                                                                                                                                    </xsl:if>
                                                                                                                                </td>
                                                                                                                                <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                    <div>
                                                                                                                                        <span>
                                                                                                                                            <a href="{$TargetGoalBaseURL}/{PromoteKey}"
																																			   style="color: #17375E; text-decoration: underline;font-size:9.5pt;font-weight:bold;">
                                                                                                                                                <xsl:value-of select="Title"/>
                                                                                                                                            </a>
                                                                                                                                        </span>
                                                                                                                                    </div>
                                                                                                                                    <div>
                                                                                                                                        <span style="color: #3088cd; text-decoration: none;font-size: 9.0pt;color: #6D6E71;">
                                                                                                                                            <xsl:value-of select="Description"/>
                                                                                                                                        </span>
                                                                                                                                    </div>
                                                                                                                                </td>
                                                                                                                            </tr>
                                                                                                                        </table>
                                                                                                                    </div>
                                                                                                                </xsl:for-each>
                                                                                                            </td>
                                                                                                        </tr>
                                                                                                    </xsl:if>
                                                                                                </tbody>
                                                                                            </table>
                                                                                        </td>
                                                                                    </tr>
                                                                                </tbody>
                                                                            </table>
                                                                        </td>
                                                                    </tr>
                                                                </xsl:for-each>
                                                            </xsl:for-each>
                                                            <xsl:for-each select ="UserActions/Item[not(GoalID)]">
                                                                <xsl:variable name ="ActionID" select ="ActionID"></xsl:variable>
                                                                <tr>
                                                                    <td width="10" style="width: 7.5pt; border: none; padding: 0in 0in 0in 0in">
                                                                        <p style="line-height: 0%;margin:0;">
                                                                            <span style="font-size: 1.0pt">

                                                                            </span>
                                                                        </p>
                                                                    </td>
                                                                    <td style="border: none; padding: 0in 15.0pt 15.0pt 15.0pt">
                                                                        <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100.0%">
                                                                            <tbody>
                                                                                <tr>
                                                                                    <td valign="top" style="padding: 0in 0in 0in 0in; min-height: 20px">
                                                                                        <table cellspacing="0" cellpadding="0" border="0">
                                                                                            <tbody>
                                                                                                <tr>
                                                                                                    <td width="20" valign="top" style="width: 15.0pt; padding: 0in 0in 0in 0in">
                                                                                                        <p style="line-height: 15.0pt;margin:0;">

                                                                                                        </p>
                                                                                                    </td>
                                                                                                    <td style="padding: 0in 0in 0in 0in">
                                                                                                        <div style="border: none; padding: 2.5pt 0in 2.0pt 0in">
                                                                                                            <p style="line-height: 15.0pt;margin:0;">
                                                                                                                <a href="{$TargetURL}/Goal.aspx?ID={normalize-space(GoalID)}&amp;Ref=EM.due"
																												   target="_blank" style="color: #3088cd; text-decoration: none;font-size: 12.5pt;">
                                                                                                                    <xsl:value-of select="ActionName"/>
                                                                                                                </a>
                                                                                                                <div style="border: none; padding: 2.5pt 0in 2.0pt 0in">
                                                                                                                    <span style="color: #3088cd; text-decoration: none;font-size: 10.5pt;color: #6D6E71;">
                                                                                                                        <xsl:call-template name="break">
                                                                                                                            <xsl:with-param name="text" select="ActionDescription"></xsl:with-param>
                                                                                                                        </xsl:call-template>
                                                                                                                    </span>
                                                                                                                </div>
                                                                                                                <span style="font-size: 10.5pt">

                                                                                                                </span>
                                                                                                            </p>
                                                                                                        </div>
                                                                                                    </td>
                                                                                                </tr>
                                                                                                <xsl:if test="../Item[AttachItemTypeID]">
                                                                                                    <tr>
                                                                                                        <td width="20" valign="top" style="width: 15.0pt; padding: 0in 15.0pt 5.0pt 15.0pt">
                                                                                                            <p style="line-height: 15.0pt;margin:0;">

                                                                                                            </p>
                                                                                                        </td>
                                                                                                        <td>
                                                                                                            <xsl:for-each select="../Item[AttachItemTypeID = 22 and ActionID = $ActionID]">
                                                                                                                <div style="border: none; padding: 2.5pt 0in 7.0pt 0in">
                                                                                                                    <table cellpadding="0" border="0" cellspacing="0">
                                                                                                                        <tr>
                                                                                                                            <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                <xsl:if test="ImageURL != ''">
                                                                                                                                    <a href="{$TargetURL}/Publication.aspx?ID={normalize-space(AttachItemID)}">
                                                                                                                                        <img src ="{ImageURL}" height="45" width="45"></img>
                                                                                                                                    </a>
                                                                                                                                </xsl:if>
                                                                                                                            </td>
                                                                                                                            <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                <div>
                                                                                                                                    <span>
                                                                                                                                        <a href="{$TargetURL}/Publication.aspx?ID={normalize-space(AttachItemID)}"
																																		   style="color: #17375E; text-decoration: underline;font-size: 9.5pt;font-weight:bold;">
                                                                                                                                            <xsl:value-of select="Title"/>
                                                                                                                                        </a>
                                                                                                                                    </span>
                                                                                                                                </div>
                                                                                                                                <div>
                                                                                                                                    <span style="color: #3088cd; text-decoration: none;font-size: 9.0pt;color: #6D6E71;">
                                                                                                                                        <xsl:value-of select="Description"/>
                                                                                                                                    </span>
                                                                                                                                </div>
                                                                                                                            </td>
                                                                                                                        </tr>
                                                                                                                    </table>
                                                                                                                </div>
                                                                                                            </xsl:for-each>
                                                                                                            <xsl:for-each select="../Item[AttachItemTypeID = 19 and ActionID = $ActionID]">
                                                                                                                <div style="border: none; padding: 2.5pt 0in 7.0pt 0in">
                                                                                                                    <table cellpadding="0" border="0" cellspacing="0">
                                                                                                                        <tr>
                                                                                                                            <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                <xsl:if test="ImageURL != ''">
                                                                                                                                    <a href="{$TargetURL}/Content.aspx?ID={normalize-space(AttachItemID)}">
                                                                                                                                        <img src ="{ImageURL}" height="45" width="45"></img>
                                                                                                                                    </a>
                                                                                                                                </xsl:if>
                                                                                                                            </td>
                                                                                                                            <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                <div>
                                                                                                                                    <span>
                                                                                                                                        <a href="{$TargetURL}/Content.aspx?ID={normalize-space(AttachItemID)}"
																																		   style="color: #17375E; text-decoration: underline;font-size: 9.5pt;font-weight:bold;">
                                                                                                                                            <xsl:value-of select="Title"/>
                                                                                                                                        </a>
                                                                                                                                    </span>
                                                                                                                                </div>
                                                                                                                                <div>
                                                                                                                                    <span style="color: #3088cd; text-decoration: none;font-size: 9.0pt;color: #6D6E71;">
                                                                                                                                        <xsl:value-of select="Description"/>
                                                                                                                                    </span>
                                                                                                                                </div>
                                                                                                                            </td>
                                                                                                                        </tr>
                                                                                                                    </table>
                                                                                                                </div>
                                                                                                            </xsl:for-each>
                                                                                                            <xsl:for-each select="../Item[AttachItemTypeID = 23 and ActionID = $ActionID]">
                                                                                                                <div style="border: none; padding: 2.5pt 0in 7.0pt 0in">
                                                                                                                    <table cellpadding="0" border="0" cellspacing="0">
                                                                                                                        <tr>
                                                                                                                            <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                <xsl:if test="ImageURL != ''">
                                                                                                                                    <a href="{$TargetURL}/{PromoteKey}">
                                                                                                                                        <img src ="{ImageURL}" height="45" width="45"></img>
                                                                                                                                    </a>
                                                                                                                                </xsl:if>
                                                                                                                            </td>
                                                                                                                            <td style="border: none; padding: 5.0pt 5.0pt 0in 5.0pt">
                                                                                                                                <div>
                                                                                                                                    <span>
                                                                                                                                        <a href="{$TargetURL}/{PromoteKey}"
																																		   style="color: #17375E; text-decoration: underline;font-size:9.5pt;font-weight:bold;">
                                                                                                                                            <xsl:value-of select="Title"/>
                                                                                                                                        </a>
                                                                                                                                    </span>
                                                                                                                                </div>
                                                                                                                                <div>
                                                                                                                                    <span style="color: #3088cd; text-decoration: none;font-size: 9.0pt;color: #6D6E71;">
                                                                                                                                        <xsl:value-of select="Description"/>
                                                                                                                                    </span>
                                                                                                                                </div>
                                                                                                                            </td>
                                                                                                                        </tr>
                                                                                                                    </table>
                                                                                                                </div>
                                                                                                            </xsl:for-each>
                                                                                                        </td>
                                                                                                    </tr>
                                                                                                </xsl:if>
                                                                                            </tbody>
                                                                                        </table>
                                                                                    </td>
                                                                                </tr>
                                                                            </tbody>
                                                                        </table>
                                                                    </td>
                                                                    <td style="border: none; padding: 0in 0in 0in 0in">
                                                                        <p style="margin:0;">

                                                                        </p>
                                                                    </td>
                                                                </tr>
                                                            </xsl:for-each>
                                                        </tbody>
                                                    </table>
                                                    <table width="100%" cellspacing="0" cellpadding="0" border="0"
														   style="width: 100.0%;
															background: white; border-top: none; border-left: solid #e4e4e4 1.0pt; border-bottom: none;
															border-right: solid #e4e4e4 1.0pt">
                                                        <tbody>
                                                            <tr style="min-height: 7.5pt">
                                                                <td>
                                                                    <xsl:choose>
                                                                        <xsl:when test ="$PastDueActions">
                                                                            <td style="border: none; padding: 15.0pt 15.0pt 0in 15.0pt" colspan="2">
                                                                                <div style="border: none; padding: 0in 0in 2.0pt 0in">
                                                                                    <span style="font-size: 13.5pt; font-family: Arial,sans-serif; color: #6D6E71; font-weight: normal">
                                                                                        In addition, you have
                                                                                        <a href="{$TargetURL}/Home.aspx"
																						   style="color: #17375E; text-decoration: none;font-size:13.5pt;font-weight:bold;">
                                                                                            <xsl:value-of select ="$PastDueActions"/>
                                                                                            <span style="padding:0in 0in 0in 2.0pt"> past due </span>
                                                                                            <xsl:value-of select="$PastDueActionItemsDisplay"/>
                                                                                        </a>
                                                                                    </span>
                                                                                </div>
                                                                            </td>
                                                                        </xsl:when>
                                                                    </xsl:choose>
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100.0%;background: white">
                                                        <tbody>
                                                            <tr style="min-height: 7.5pt">
                                                                <td width="10" valign="top" style="width: 7.5pt; background: #f2f2f2; padding: 0in 0in 0in 0in;min-height: 7.5pt; min-height: 10px">
                                                                    <p style="line-height: 0%;margin:0;">
                                                                        <span style="font-size: 1.0pt">
                                                                            <img width="10" height="10" border="0" src="{$TargetURL}/desktopModules/LifespaceTemplates/Web/Images/Ver_2_0/clb_01.png" />

                                                                        </span>
                                                                    </p>
                                                                </td>
                                                                <td valign="bottom" style="padding: 0in 0in 0in 0in; min-height: 7.5pt; min-height: 10px">
                                                                    <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100.0%">
                                                                        <tbody>
                                                                            <tr style="min-height: .75pt">
                                                                                <td style="background: #e4e4e4; padding: 0in 0in 0in 0in; min-height: .75pt; min-height: 1px">
                                                                                    <p style="line-height: 0%;margin:0;">
                                                                                        <span style="font-size: 1.0pt">

                                                                                        </span>
                                                                                    </p>
                                                                                </td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                                <td width="10" valign="top" style="width: 7.5pt; background: #f2f2f2; padding: 0in 0in 0in 0in;min-height: 7.5pt; min-height: 10px">
                                                                    <p align="right" style="text-align: right; line-height: 0%;margin:0;">
                                                                        <span style="font-size: 1.0pt">
                                                                            <img width="10" height="10" border="0" src="{$TargetURL}/desktopModules/LifespaceTemplates/Web/Images/Ver_2_0/crb_01.png" />
                                                                        </span>
                                                                    </p>
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </td>

                                            </tr>
                                            <tr style="min-height: 15.0pt">
                                                <td colspan="2" style="padding: 0in 0in 0in 0in; min-height: 15.0pt; min-height: 20px">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2" style="padding: 0in 0in 0in 0in; min-height: 10px">
                                                    <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100.0%;background: white">
                                                        <tbody>
                                                            <tr style="min-height: 7.5pt">
                                                                <td width="10" valign="bottom" style="width: 7.5pt; background: #f2f2f2; padding: 0in 0in 0in 0in;min-height: 7.5pt">
                                                                    <p align="right" style="text-align: right; line-height: 0%;margin:0;">
                                                                        <span style="font-size: 1.0pt">
                                                                            <img width="10" height="10" border="0" src="{$TargetURL}/desktopModules/LifespaceTemplates/Web/Images/Ver_2_0/clt_01.png" />

                                                                        </span>
                                                                    </p>
                                                                </td>
                                                                <td valign="top" style="padding: 0in 0in 0in 0in; min-height: 7.5pt; min-height: 1px">
                                                                    <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100.0%">
                                                                        <tbody>
                                                                            <tr style="min-height: .75pt">
                                                                                <td style="background: #e4e4e4; padding: 0in 0in 0in 0in; min-height: .75pt">
                                                                                    <p style="line-height: 0%;margin:0;">
                                                                                        <span style="font-size: 1.0pt">

                                                                                        </span>
                                                                                    </p>
                                                                                </td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                                <td width="10" valign="bottom" style="width: 7.5pt; background: #f2f2f2; padding: 0in 0in 0in 0in;min-height: 7.5pt; min-height: 10px">
                                                                    <p style="line-height: 0%;margin:0;">
                                                                        <span style="font-size: 1.0pt">
                                                                            <img width="10" height="10" border="0" src="{$TargetURL}/desktopModules/LifespaceTemplates/Web/Images/Ver_2_0/crt_01.png" />

                                                                        </span>
                                                                    </p>
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <table width="100%" cellspacing="0" cellpadding="0" border="1" style="width: 100.0%;
														background: white; border-top: none; border-left: solid #e4e4e4 1.0pt; border-bottom: none;border-right: solid #e4e4e4 1.0pt">
                                                        <tbody>
                                                            <tr>
                                                                <td width="10" style="width: 7.5pt; border: none; padding: 0in 0in 0in 0in">
                                                                    <p style="margin:0;">

                                                                    </p>
                                                                </td>
                                                                <td style="border: none; padding: 7.5pt 7.5pt 7.5pt 7.5pt">
                                                                    <div style="border: none; border-bottom: none; padding: 0in 0in 2.0pt 0in">
                                                                        <h1 style="margin-right: 0in; margin-bottom: 9.5pt; margin-left: 0in; border: none;padding: 0in">
                                                                            <span style="font-size: 16.5pt; font-family: Arial,sans-serif; color: #222222; font-weight: normal">
                                                                                Tip of the Day!
                                                                            </span>
                                                                        </h1>
                                                                    </div>
                                                                    <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100.0%">
                                                                        <tbody>
                                                                            <tr>
                                                                                <td valign="top" style="padding: 0in 0in 0in 0in; min-height: 20px">
                                                                                    <table cellspacing="0" cellpadding="0" border="0">
                                                                                        <tbody>
                                                                                            <tr>
                                                                                                <td width="20" valign="top" style="width: 15.0pt; padding: 0in 0in 0in 0in">
                                                                                                    <p style="line-height: 15.0pt;margin:0;">

                                                                                                    </p>
                                                                                                </td>
                                                                                                <td style="padding: 0in 0in 0in 0in">
                                                                                                    <div style="border: none; padding: 2.5pt 0in 2.0pt 0in">
                                                                                                        <p style="line-height: 15.0pt;margin:0;">
                                                                                                            <span style="font-size: 12.5pt">
                                                                                                                <a target="_blank" style="text-decoration: none;">
                                                                                                                    <span style="color: #289AAC;">
                                                                                                                        If you haven't already done so, or if you would like to alter what you have entered
                                                                                                                    </span>
                                                                                                                </a>

                                                                                                            </span>
                                                                                                        </p>
                                                                                                    </div>
                                                                                                    <div style="border: none; padding: 0in 0in 2.0pt 0in">
                                                                                                        <p style="line-height: 15.0pt;margin:0;">
                                                                                                            <span>
                                                                                                                <a href="{$ActiveMasterBrandTargetURL}/Vision.aspx" style="font-size: 10.5pt; color: #737373">
                                                                                                                    Setup your Vision, Plan, Communities, Social Settings
                                                                                                                </a>

                                                                                                            </span>
                                                                                                        </p>
                                                                                                    </div>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </tbody>
                                                                                    </table>
                                                                                </td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                                <td width="10" style="width: 7.5pt; border: none; padding: 0in 0in 0in 0in">
                                                                    <p style="margin:0;">

                                                                    </p>
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100.0%;background: white">
                                                        <tbody>
                                                            <tr style="min-height: 7.5pt">
                                                                <td width="10" valign="top" style="width: 7.5pt; background: #f2f2f2; padding: 0in 0in 0in 0in;min-height: 7.5pt; min-height: 10px">
                                                                    <p align="right" style="text-align: right; line-height: 0%;margin:0;">
                                                                        <span style="font-size: 1.0pt">
                                                                            <img width="10" height="10" border="0" src="{$ActiveMasterBrandTargetURL}/desktopModules/LifespaceTemplates/Web/Images/Ver_2_0/clb_01.png" />

                                                                        </span>
                                                                    </p>
                                                                </td>
                                                                <td valign="bottom" style="padding: 0in 0in 0in 0in; min-height: 7.5pt; min-height: 1px">
                                                                    <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100.0%">
                                                                        <tbody>
                                                                            <tr style="min-height: .75pt">
                                                                                <td style="background: #e4e4e4; padding: 0in 0in 0in 0in; min-height: .75pt">
                                                                                    <p style="line-height: 0%;margin:0;">
                                                                                        <span style="font-size: 1.0pt">

                                                                                        </span>
                                                                                    </p>
                                                                                </td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                                <td width="10" valign="top" style="width: 7.5pt; background: #f2f2f2; padding: 0in 0in 0in 0in;min-height: 7.5pt; min-height: 10px">
                                                                    <p style="line-height: 0%;margin:0;">
                                                                        <span style="font-size: 1.0pt">
                                                                            <img width="10" height="10" border="0" src="{$ActiveMasterBrandTargetURL}/desktopModules/LifespaceTemplates/Web/Images/Ver_2_0/crb_01.png" />

                                                                        </span>
                                                                    </p>
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" style="padding: 0in 0in 0in 0in; min-height: 20px">
                                <div align="center">
                                    <table width="600" cellspacing="0" cellpadding="0" border="0" style="width: 6.25in">
                                        <tbody>
                                            <tr>
                                                <td width="20" style="width: 15.0pt; padding: 0in 0in 0in 0in">
                                                </td>
                                                <td style="padding: 3.5pt 0in 0in 0in">
                                                    <p style="line-height: 12.0pt;margin:0;">
                                                        <span style="font-size: 8.5pt; font-family: Arial,sans-serif; color: #aaaaaa">
                                                            <a target="_blank" href="{$ActiveMasterBrandTargetURL}/Settings.aspx">
                                                                <span style="color: #2f88cd">Unsubscribe</span>
                                                            </a>or
                                                            <a target="_blank" href="{$ActiveMasterBrandTargetURL}/Settings.aspx">
                                                                <span style="color: #2f88cd">Change Settings</span>
                                                            </a>
                                                        </span>
                                                    </p>
                                                </td>
                                                <td width="20" style="width: 15.0pt; padding: 0in 0in 0in 0in">
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
