﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">

	<xsl:import href="StringReplace.xslt"/>
	<xsl:import href="NotifyUserList.xslt"/>
	<xsl:template match="Notes">

		<xsl:variable name ="taskID" select="normalize-space(TaskID)"/>
		<xsl:variable name ="Mode" select="normalize-space(Mode)"/>
		<xsl:variable name ="TemplateURL" select="normalize-space(TemplateURL)"/>
		<xsl:variable name="BetaVersion" select="normalize-space(BetaVersion)"></xsl:variable>
		<xsl:variable name="PermissionID" select="normalize-space(permissionID)"></xsl:variable>
		<xsl:variable name="PortalPermissionID" select="/Notes/Permissions/ItemPermission/PermissionID"></xsl:variable>
		<xsl:variable name="Action" select="normalize-space(Action)"></xsl:variable>
		<xsl:variable name="ShareITList" select="/Notes/ShareITRecords/ShareIT"></xsl:variable>
		<xsl:variable name="PortalUserList" select="/Notes/PortalUserDetail/Local/Permission[PermissionActiveYN = 1]"></xsl:variable>
		<xsl:variable name="PortalClientList" select="/Notes/PortalClientDetail/Local/Permission"></xsl:variable>
		<xsl:variable name="LogInUser" select="/Notes/LogInUser"></xsl:variable>
		<xsl:variable name="NotesPrivacyLevel" select="/Notes/Settings/NotesPrivacyLevel"></xsl:variable>
		<xsl:variable name="HostName" select="normalize-space(HostName)"></xsl:variable>
		<xsl:variable name="NoteAutoNotify">
			<xsl:choose>
				<xsl:when test="/Notes/Settings/NoteAutoNotify[text()]">
					<xsl:value-of select="/Notes/Settings/NoteAutoNotify"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:number value="0"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="ShareWidgetDisplay">
			<xsl:choose>
				<xsl:when test="SourceTypeID = 22">display:none;</xsl:when>
				<!--<xsl:when test="$NoteAutoNotify = 1">display:none;</xsl:when>-->
				<xsl:otherwise>display:inline;</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<div style="margin-left:20px;" id="div_{$taskID}_Header" >
			<div class="marginTop10" id="div_Notes_Header" style="display:none;">
				<span class="packageTitle">Enter Notes and Journal Entries Here</span>
			</div>
			<xsl:if test ="$Mode != 'EmailDigest' and (SourceTypeID) != 16">
				<div id="div_itemNotes_{$taskID}_TextArea">
					<div id="div_textArea_{$taskID}" style="margin-top: 10px; margin-bottom: 10px;">
						<!--<textarea id="txt_itemNotes_{$taskID}" rows="1" class="textAreaNotes"
                                  onclick='addNote("div_itemNotes_{$taskID}_AddNote", "txt_itemNotes_{$taskID}");                                  
								  document.getElementById("div_{$taskID}_ShareWithTeam").style.display="block";                                  
								  if(document.getElementById("div_{$taskID}_NotifyAllCoachingProgram") != null &amp;&amp; !document.getElementById("chk_{$taskID}_ShareWithTeam").checked) document.getElementById("div_{$taskID}_NotifyAllCoachingProgram").style.display="block";
								  if(document.getElementById("div_{$taskID}_NotifyMyClientPortal") != null &amp;&amp; !document.getElementById("chk_{$taskID}_ShareWithTeam").checked) document.getElementById("div_{$taskID}_NotifyMyClientPortal").style.display="block";
                                  if(document.getElementById("tbl_Action_{$taskID}_Detail") != null) document.getElementById("tbl_Action_{$taskID}_Detail").style.display="none";
                                  if(document.getElementById("div_Notes_Header") != null) document.getElementById("div_Notes_Header").style.display="block";
								  if(document.getElementById("div_{$taskID}_UploadSuite_AddButton") != null &amp;&amp;
								  document.getElementById("NoteFileUpload_{$taskID}_Panel").style.display=="none") 
								  document.getElementById("div_{$taskID}_UploadSuite_AddButton").style.display="block";
								  $("#div_itemNotes_{$taskID}").addClass("NotesMrgn");
								  $("#div_SharedPrivatePanel_{$taskID}").css("display","block");
								  displayDivIfRadioSelected("rdPrivateSecurityLevel_{$taskID}", "div_PrivatePanel_{$taskID}");'
                                  onKeyUp="control_TextAreaAutoGrow('txt_itemNotes_{$taskID}');setSliderNoteActivePanelFlag({$taskID})"
                                  onFocus='listener_SetNoteSavePending({$taskID});'
                                  style='overflow:hidden;'>Add note here..</textarea>-->
						<textarea id="txt_itemNotes_{$taskID}" rows="1" class="textAreaNotes"
						onclick='addNote("div_itemNotes_{$taskID}_AddNote", "txt_itemNotes_{$taskID}");                                  
								  document.getElementById("div_{$taskID}_ShareWithTeam").style.display="block";                                  
								  if(document.getElementById("div_{$taskID}_NotifyAllCoachingProgram") != null &amp;&amp; !document.getElementById("chk_{$taskID}_ShareWithTeam").checked) document.getElementById("div_{$taskID}_NotifyAllCoachingProgram").style.display="block";
								  if(document.getElementById("div_{$taskID}_NotifyMyClientPortal") != null &amp;&amp; !document.getElementById("chk_{$taskID}_ShareWithTeam").checked) document.getElementById("div_{$taskID}_NotifyMyClientPortal").style.display="block";
                                  if(document.getElementById("tbl_Action_{$taskID}_Detail") != null) document.getElementById("tbl_Action_{$taskID}_Detail").style.display="none";
                                  if(document.getElementById("div_Notes_Header") != null) document.getElementById("div_Notes_Header").style.display="block";
								  if(document.getElementById("div_{$taskID}_UploadSuite_AddButton") != null &amp;&amp;
								  document.getElementById("NoteFileUpload_{$taskID}_Panel").style.display=="none") 
								  document.getElementById("div_{$taskID}_UploadSuite_AddButton").style.display="block";
								  $("#div_itemNotes_{$taskID}").addClass("NotesMrgn");
								  $("#div_SharedPrivatePanel_{$taskID}").css("display","block");
								  displayDivIfRadioSelected("rdPrivateSecurityLevel_{$taskID}", "div_PrivatePanel_{$taskID}");'
						onKeyUp="control_TextAreaAutoGrow('txt_itemNotes_{$taskID}');setSliderNoteActivePanelFlag({$taskID})"
						onFocus='listener_SetNoteSavePending({$taskID});'
						style='overflow:hidden;'>Add note here..</textarea>
					</div>
					<!--<script>
							<xsl:text>chk_</xsl:text>
							<xsl:value-of select="$taskID"></xsl:value-of>
							<xsl:text>_ShareWithTeam.click();</xsl:text>
						

						</script>-->
					<!--<xsl:variable name="clsNotePanelWidth">
						<xsl:choose>
							<xsl:when test="$NotesPrivacyLevel/Labels !=''">
								<xsl:text>col-md-12</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text>col-md-8</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>-->
					<div class="col-md-12 col-xs-12 padingL0">
						<div class="col-md-8 col-xs-8 padingL0">
							<xsl:choose>
								<xsl:when test="$BetaVersion >= 3 and $Action !='GetItemNotes3_0'">
									<xsl:call-template name="SurveyQuestionFileUpload">
										<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
										<xsl:with-param name="SourceItemID" select="$taskID"></xsl:with-param>
									</xsl:call-template>
								</xsl:when>
							</xsl:choose>
						</div>
						<xsl:variable name="styleOfPost">
							<xsl:choose>
								<xsl:when test="$Action='GetItemNotes3_0'">
									<text>width:20%!important;</text>
								</xsl:when>
								<xsl:otherwise>
									<text>width:32%!important;</text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<div id="div_itemNotes_{$taskID}_AddNote" style="margin-bottom: 10px !important; float:right;{$styleOfPost}" focus="false"
							 class="col-md-4 col-xs-4 padingL0 textCenter onMouseOver divBrowseGradient padding10 spanBrowseGradientTextGray"
							 onmouseover="document.getElementById('img_Save').src='{$TemplateURL}Web/Images/Ver_2_0/icon_add_over.png';
                                     this.setAttribute('focus','true');"
							 onmouseout="document.getElementById('img_Save').src='{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png';
                                    this.setAttribute('focus','false');"
							 onClick='$("#div_itemNotes_{$taskID}").removeClass("NotesMrgn");hideSaveNotePopupOnSubmit("{$taskID}");sliderNotesPanelActive = false;'>
							<img id="img_Save" alt="" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" style="padding-left:8px;" align="absmiddle" class="marginRight5 verticallyMiddle"></img>
							<span id="span_SubmitNote" class="capitalFont verticallyMiddle">post</span>
						</div>
						<xsl:if test="$NotesPrivacyLevel/Labels !=''">
							<div style="float:left;display:none;margin-top:10px;width:100%;" id="div_SharedPrivatePanel_{$taskID}">
								<input type="radio" checked="" name="nmSecurityType_{$taskID}" class="btn-share"
										onclick="$('#div_PrivatePanel_{$taskID}').css('display','none');"
									   id="rdSharedSecurityLevel_{$taskID}">
									<span class="btn-share">Shared</span>
								</input>
								<input type="radio" name="nmSecurityType_{$taskID}" class="btn-private"
									   onclick="$('#div_PrivatePanel_{$taskID}').css('display','block');
									   displayUncheckCheckEdit('chk_{$taskID}_ShareWithTeam');"
									   id="rdPrivateSecurityLevel_{$taskID}">
									<span class="btn-share">Private</span>
								</input>
							</div>
						</xsl:if>
					</div>
					<div id="div_PrivatePanel_{$taskID}" style="display:none;margin-top:10px;float:left;">
						<span style="width:auto;float:left;font-weight:bold;line-height:14px;">	Visible by:</span>
						<xsl:if test="$NotesPrivacyLevel/Labels !=''">
							<xsl:for-each  select="$NotesPrivacyLevel/Labels">
								<xsl:choose>
									<xsl:when test="@default='true'">
										<div style="width:auto;float:left;display:inline;">
											<input type="radio" name="nmPrivacy_{$taskID}" checked="" val="{@value}" class="btn-share">
											</input>
											<span class="btn-share">
												<xsl:value-of select="."/>
											</span>
										</div>
									</xsl:when>
									<xsl:otherwise>
										<div style="width:auto;float:left;display:inline;">
											<input type="radio" name="nmPrivacy_{$taskID}" val="{@value}" class="btn-share">		</input>
											<span class="btn-share">
												<xsl:value-of select="."/>
											</span>
										</div>
									</xsl:otherwise>
								</xsl:choose>

							</xsl:for-each>
						</xsl:if>
					</div>

					<div id='div_{$taskID}_ShareWithTeam' style='display:none;width: 100%;float: left;line-height: 41px;text-align:left;margin-top:10px;'>
						<div style="width:75%;float:left">
							<xsl:choose>
								<xsl:when test="$NoteAutoNotify = 1">
									<input type="checkbox" class="verticallyMiddle"  id="chk_{$taskID}_ShareWithTeam"
										   style="margin:0 !important; {$ShareWidgetDisplay}"
										   checked="true"
										   onclick="displayNotesNotifyDiv('chk_{$taskID}_ShareWithTeam','div_{$taskID}_NotifyMyClientPortal','div_{$taskID}_NotifyAllCoachingProgram');">
									</input>
								</xsl:when>
								<xsl:otherwise>
									<input type="checkbox" class="verticallyMiddle"  id="chk_{$taskID}_ShareWithTeam"
										   style="margin:0 !important; {$ShareWidgetDisplay}"
											 onclick="displayNotesNotifyDiv('chk_{$taskID}_ShareWithTeam','div_{$taskID}_NotifyMyClientPortal','div_{$taskID}_NotifyAllCoachingProgram');">
									</input>
								</xsl:otherwise>
							</xsl:choose>
							<span class="verticallyMiddle capitalFont" style="{$ShareWidgetDisplay}">
								Notify Additional Members:
							</span>
						</div>

						<xsl:choose>
							<xsl:when test="($PermissionID=3 or $PermissionID=4) and $BetaVersion >=3 and $Action !='GetItemNotes3_0'">
								<div class="btn-group"  style="width: 11%; text-align: right; float: right; line-height: 41px;height: 41px;">
									<button  onclick="OnClickSlideBottom('slidepanel')" type="button" class="multiselect dropdown-toggle btn padinone" data-toggle="dropdown" title="" aria-expanded="false" style="width: auto;padding:0px;line-height:44px;">
										<span class="onMouseOver star-default glyphicon glyphicon-star star_3" id="spanAddPriority_Task" Value="3"></span>
									</button>
									<ul style="" class=" dropdown-menu Priority sldstar" id="ddlAddPriority_Task">
										<li livalue="1"  onclick="selectPriorityDropDownValue('spanAddPriority_Task','ddlAddPriority_Task',1);">
											<a href="javascript:void(0);" >
												<label class="radio" style="padding-left: 0px;">
													<span class="glyphicon glyphicon-star star_1" ></span>
												</label>
											</a>
										</li>
										<li livalue="3" class="active" onclick="selectPriorityDropDownValue('spanAddPriority_Task','ddlAddPriority_Task',3);">
											<a href="javascript:void(0);">
												<label class="radio" style="padding-left: 0px;">
													<span class="glyphicon glyphicon-star star_3" ></span>
												</label>
											</a>
										</li>
									</ul>
								</div>
							</xsl:when>
						</xsl:choose>
					</div>
					<input type="hidden" value="{$HostName}" id="hdfHostName"></input>
					<xsl:call-template name="NotifyListDetails">
						<xsl:with-param name="ShareITList" select="$ShareITList"></xsl:with-param>
						<xsl:with-param name="taskID" select="$taskID"></xsl:with-param>
						<xsl:with-param name="PortalUserList" select="$PortalUserList"></xsl:with-param>
						<xsl:with-param name="PortalClientList" select="$PortalClientList"></xsl:with-param>
						<xsl:with-param name="LogInUser" select="$LogInUser"></xsl:with-param>
						<xsl:with-param name="NoteAutoNotify" select="$NoteAutoNotify"></xsl:with-param>
						<xsl:with-param name="PortalPermissionID" select="$PortalPermissionID"></xsl:with-param>
					</xsl:call-template>

				</div>
			</xsl:if>

			<xsl:choose>
				<xsl:when test="count(Note) != 0">
					<div id ="div_itemNotes_{$taskID}" style="clear: both;padding-top: 5px;width:100%;float:left;padding-bottom:115px;">
						<xsl:apply-templates select="Note">
							<xsl:with-param name="IsSecureConnection" select="IsSecureConnection"></xsl:with-param>
							<xsl:with-param name="BetaVersion" select="$BetaVersion"></xsl:with-param>
							<xsl:with-param name="Action" select="$Action"></xsl:with-param>
							<xsl:with-param name="NotesPrivacyLevel" select="$NotesPrivacyLevel"></xsl:with-param>
							<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
						</xsl:apply-templates>
					</div>
				</xsl:when>
				<xsl:otherwise>
					<div id ="div_itemNotes_{$taskID}" style="clear: both;padding-top: 5px;width:100%;float:left;padding-bottom:115px;">
						<xsl:apply-templates select="Note">
							<xsl:with-param name="IsSecureConnection" select="IsSecureConnection"></xsl:with-param>
							<xsl:with-param name="BetaVersion" select="$BetaVersion"></xsl:with-param>
							<xsl:with-param name="Action" select="$Action"></xsl:with-param>
							<xsl:with-param name="NotesPrivacyLevel" select="$NotesPrivacyLevel"></xsl:with-param>
							<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
						</xsl:apply-templates>
					</div>
				</xsl:otherwise>
			</xsl:choose>

			<xsl:choose>
				<xsl:when test="count(Note) &gt; 5 and $Action = 'GetItemNotes3_0'">
					<div id="viewAllcomment">
						<a href="javascript:void(0)" onClick="ViewAllComments();">View All</a>
					</div>
				</xsl:when>
			</xsl:choose>

		</div>
	</xsl:template>

	<xsl:template match ="Note">

		<xsl:param name="DisplayReply">
			<xsl:choose>
				<xsl:when test="ParentType = 25">
					<xsl:text>False</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>True</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:param>

		<xsl:param name="TemplatePathURL">
			<xsl:choose>
				<xsl:when test="count(../../Notes/TemplateURL) &gt; 0">
					<xsl:value-of select="../TemplateURL"/>
				</xsl:when>
				<xsl:when test="count(../../TemplateURL) &gt; 0">
					<xsl:value-of select="../../TemplateURL"/>
				</xsl:when>
			</xsl:choose>
		</xsl:param>

		<xsl:param name="FbPicURL">
			<xsl:choose>
				<xsl:when test="FBPicURL">
					<xsl:value-of select="FBPicURL"/>
				</xsl:when>
				<xsl:when test="FbPicURL">
					<xsl:value-of select="FbPicURL"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="../Note/FbPicURL"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:param>
		<xsl:param name ="UserID" select="'N/A'"/>
		<xsl:param name="Mode2" select="'N/A'"></xsl:param>
		<xsl:param name="PermissionID" select="'N/A'"></xsl:param>
		<xsl:param name ="itemID" select="'N/A'"/>
		<xsl:param name="IsSecureConnection" select="'N/A'"></xsl:param>
		<xsl:param name="BetaVersion" select="'N/A'"></xsl:param>
		<xsl:param name="Action" select="'N/A'"></xsl:param>
		<xsl:param name="NotesPrivacyLevel" select="'N/A'"></xsl:param>
		<xsl:param name="HostName" select="'N/A'"></xsl:param>
		<xsl:variable name ="LoginUser" select="normalize-space(../LogInUser)"/>
		<xsl:variable name ="IsCommunityAdmin" select="normalize-space(../IsCommunityAdmin)"/>
		<xsl:variable name ="lsPermissionId" select="normalize-space(../permissionID)"/>
		<xsl:variable name="BetaVersionInfo">
			<xsl:choose>
				<xsl:when test="$BetaVersion ='N/A'">
					<xsl:value-of select="normalize-space(../BetaVersion)"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$BetaVersion"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="Protocol">
			<xsl:choose>
				<xsl:when test="$IsSecureConnection = 1">
					<xsl:text>https://</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>http://</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="FormattedFbPicURL">
			<xsl:choose>
				<xsl:when test="$IsSecureConnection = 1">
					<xsl:call-template name="replaceCharsInString">
						<xsl:with-param name="stringIn" select="$FbPicURL"></xsl:with-param>
						<xsl:with-param name="charsIn">
							<xsl:text>http://</xsl:text>
						</xsl:with-param>
						<xsl:with-param name="charsOut">
							<xsl:text>https://</xsl:text>
						</xsl:with-param>
					</xsl:call-template>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$FbPicURL"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="Display">
			<xsl:choose>
				<xsl:when test="position() &gt; 5 and $Action = 'GetItemNotes3_0'">display:none;</xsl:when>
				<xsl:otherwise></xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="SecureLevel" select="SecureLevel"></xsl:variable>

		<!--<xsl:if test="$lsPermissionId=$SecureLevel and PrivateYN=1">-->
		<div id="div_Note_{normalize-space(ItemID)}" class="labelSmall"
			 style="float:left;width:100%;background-color:#E6E6E6;border-top:1px solid #D2D2D2;padding-top:2px;padding-bottom:2px;{$Display}"
			 onmouseover="document.getElementById('img_{normalize-space(ItemID)}_Delete').style.visibility='visible';"
			 onmouseout="document.getElementById('img_{normalize-space(ItemID)}_Delete').style.visibility='hidden';">
			<div id="div_Note_{normalize-space(ItemID)}_View" style="width:100%;float:left;display:flex;" >
				<span class="col-md-auto pull-left padgLR0">
					<xsl:choose>
						<xsl:when test="$FbPicURL != ''">
							<img src="{$FormattedFbPicURL}" height="50px" width="50px" class="verticallyMiddle marginLeft5"></img>
						</xsl:when>
						<xsl:otherwise>
							<img src="{$TemplatePathURL}Web/Images/Ver_2_0/DefaultUserPic.jpg" height="50px" width="50px" class="verticallyMiddle marginLeft5"></img>
						</xsl:otherwise>
					</xsl:choose>
				</span>
				<span style="width:80%;float:left;margin-left:10px;">
					<span class="discussionStartUser">
						<xsl:value-of select ="FirstName"/>&#xa0;<xsl:value-of select ="LastName"/>
					</span>
					<span style="width:10%;float:right;">
						<xsl:choose>
							<xsl:when test="$BetaVersionInfo >= 3 and $Action !='GetItemNotes3_0'">
								<xsl:variable name="DropdownToggle">
									<xsl:choose>
										<xsl:when test="$lsPermissionId=3 or $lsPermissionId=4">
											<xsl:text>dropdown</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text></xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>

								<div class="btn-group" style="padding:0;">

									<button  type="button" class="multiselect dropdown-toggle btn padinone" data-toggle="{$DropdownToggle}" title="" aria-expanded="false" style="width: auto;padding:0px;">
										<span class="onMouseOver star-default glyphicon glyphicon-star star_{PriorityID}" id="span_NotesPriority_{normalize-space(ItemID)}">
										</span>
									</button>
									<xsl:choose>
										<xsl:when test="$lsPermissionId=3 or $lsPermissionId=4">
											<ul style="padding:0;width:70px;right:0!important;left:inherit;" class=" dropdown-menu Priority" id="ddl_NotesPriority_{normalize-space(ItemID)}" previousValue="{PriorityID}">
												<xsl:choose>
													<xsl:when test="PriorityID=1">
														<li class="active" >
															<a href="javascript:void(0);" onclick="UpdateItemNotesPriority_3_0('{normalize-space(ItemID)}','1');">
																<label class="radio" style="padding-left: 0px;">
																	<span class="glyphicon glyphicon-star star_1" ></span>
																</label>
															</a>
														</li>
														<li >
															<a href="javascript:void(0);" onclick="UpdateItemNotesPriority_3_0('{normalize-space(ItemID)}','3');">
																<label class="radio" style="padding-left: 0px;">
																	<span class="glyphicon glyphicon-star star_3" ></span>
																</label>
															</a>
														</li>
													</xsl:when>
													<xsl:otherwise>
														<li >
															<a href="javascript:void(0);" onclick="UpdateItemNotesPriority_3_0('{normalize-space(ItemID)}','1');">
																<label class="radio" style="padding-left: 0px;">
																	<span class="glyphicon glyphicon-star star_1" ></span>
																</label>
															</a>
														</li>
														<li class="active" >
															<a href="javascript:void(0);" onclick="UpdateItemNotesPriority_3_0('{normalize-space(ItemID)}','3');">
																<label class="radio" style="padding-left: 0px;">
																	<span class="glyphicon glyphicon-star star_3" ></span>
																</label>
															</a>
														</li>
													</xsl:otherwise>
												</xsl:choose>
											</ul>
										</xsl:when>
									</xsl:choose>
								</div>

							</xsl:when>
						</xsl:choose>
					</span>
					<span style="width:10%;float:right;">
						<xsl:if test ="$LoginUser = UserID or $lsPermissionId &gt;= 4">
							<img id="img_{normalize-space(ItemID)}_Delete" style="visibility:hidden" title="Delete Note"
								 class="onMouseOver"
								 onclick="Notes_DeleteNote('{normalize-space(ItemID)}','div_Note_{normalize-space(ItemID)}');"
								 src="{$TemplatePathURL}Web/Images/Ver_2_0/BT_x.png"></img>
						</xsl:if>
					</span>
					<span style="width:100%;float:left;line-height:21px;text-align:left;margin-top:0px;">
						<span id="lbl_itemNote_{normalize-space(ItemID)}" class="discussionText">
							<xsl:apply-templates select ="NoteDesc"></xsl:apply-templates>
						</span>
					</span>
					<span style="width:100%;float:left; display:flex;align-items:center">
						<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
						<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />

						<xsl:variable name="loweredFileName">
							<xsl:value-of select="translate(AttachedFileName, $uppercase, $smallcase)"/>
						</xsl:variable>

						<xsl:variable name="ImageLink">
							<xsl:choose>
								<xsl:when test ="contains($loweredFileName, 'jpg') or contains($loweredFileName, 'jpeg')
                                          or contains($loweredFileName, 'png') or contains($loweredFileName, 'gif')
                                          or contains($loweredFileName, 'bmp')">
									<xsl:text>image-link</xsl:text>
								</xsl:when>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="Url">
							FileCabinet <xsl:value-of  select="substring-after(AttachmentURL,'FileCabinet')" />
						</xsl:variable>
						<xsl:variable name="ThumUrl">
							FileCabinetThumbnails<xsl:value-of  select="substring-after(ThumbNailURL,'FileCabinetThumbnails')" />
						</xsl:variable>
						<span style="float:left;" class="col-md-auto">
							<xsl:choose>
								<xsl:when test="$BetaVersionInfo >= 3">
									<xsl:choose>
										<xsl:when  test="$HostName !='N/A' and substring-after(ThumbNailURL,'FileCabinetThumbnails') !=''">
											<a target="_blank" href="{$Url}" class="{$ImageLink}" onclick="setActivePanelFlagforImage()">
												<img align="absmiddle" src="{$HostName}/{normalize-space($ThumUrl)}" onload="setWidthAndHeightImage(this, 40);">
												</img>
											</a>
										</xsl:when>
										<xsl:otherwise>
											<a target="_blank" href="{$Url}" class="{$ImageLink}" onclick="setActivePanelFlagforImage()">
												<img align="absmiddle" src="{ThumbNailURL}"
												onload="setWidthAndHeightImage(this, 40);">
												</img>
											</a>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:when>
								<xsl:otherwise>
									<a target="_blank" href="{$Url}" class="{$ImageLink}" onclick="setActivePanelFlagforImage()">
										<img align="absmiddle" src="{ThumbNailURL}" onload="setWidthAndHeightImage(this, 40);">
										</img>
									</a>
								</xsl:otherwise>
							</xsl:choose>
						</span>
						<span style="width:78%;float:left;margin-left: 8px;">
							<a target="_blank" href="{$Url}" class="{$ImageLink}" onclick="setActivePanelFlagforImage()">
								<span class="discussionText whitespace">
									<xsl:value-of select="AttachedFileName"/>
								</span>
							</a>
						</span>
					</span>

					<span style="width:100%;float:right;text-align: right;">

						<!--<xsl:if test="$NotesPrivacyLevel !='''N/A'">-->
						<xsl:if test="$NotesPrivacyLevel !='N/A' and PrivateYN=1">
							<span style="color:red;font-weight:bolder;float: left;">
								Private:  <xsl:value-of select="$NotesPrivacyLevel/Labels[@value=$SecureLevel]/."></xsl:value-of>
								<xsl:if test="UserCount &gt; 0">
									+ <xsl:value-of select="UserCount"></xsl:value-of> users
								</xsl:if>
							</span>
						</xsl:if>
						<span class="notesTime3_0">
							<xsl:choose>
								<xsl:when test="normalize-space(CreatedMinutes) != ''">
									<xsl:call-template name="TimeStamp">
										<xsl:with-param name="CreatedMinutes" select="CreatedMinutes"></xsl:with-param>
									</xsl:call-template>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="NoteDateTime"/>
								</xsl:otherwise>
							</xsl:choose>
						</span>
					</span>
				</span>


				<!--<table class="tableMaster" cellpadding="2" cellspacing="0">
					<tr>
						<td width="5%" class="padding5">
							<xsl:choose>
								<xsl:when test="$FbPicURL != ''">
									<img src="{$FormattedFbPicURL}" height="50px" width="50px" class="verticallyMiddle marginLeft5"></img>
								</xsl:when>
								<xsl:otherwise>
									<img src="{$TemplatePathURL}Web/Images/Ver_2_0/DefaultUserPic.jpg" height="50px" width="50px" class="verticallyMiddle marginLeft5"></img>
								</xsl:otherwise>
							</xsl:choose>
						</td>
						<td width="85%">
							<div>
								<table class="tableMaster">
									<tr>
										<td width="75%">
											<span class="discussionStartUser">
												<xsl:value-of select ="FirstName"/>&#xa0;<xsl:value-of select ="LastName"/>
											</span>
										</td>
										<td width="25%" style="text-align:right;">
											<xsl:choose>
												<xsl:when test="$BetaVersionInfo ='3.0' and $Action !='GetItemNotes3_0'">
													<xsl:variable name="DropdownToggle">
														<xsl:choose>
															<xsl:when test="$lsPermissionId=3 or $lsPermissionId=4">
																<xsl:text>dropdown</xsl:text>
															</xsl:when>
															<xsl:otherwise>
																<xsl:text></xsl:text>
															</xsl:otherwise>
														</xsl:choose>
													</xsl:variable>
													<div class="col-md-12">
														<div class="btn-group" style="padding:0;">

															<button  type="button" class="multiselect dropdown-toggle btn padinone" data-toggle="{$DropdownToggle}" title="" aria-expanded="false" style="width: auto;padding:0px;">
																<span class="onMouseOver star-default glyphicon glyphicon-star star_{PriorityID}" id="span_NotesPriority_{normalize-space(ItemID)}">
																</span>
															</button>
															<xsl:choose>
																<xsl:when test="$lsPermissionId=3 or $lsPermissionId=4">
																	<ul style="padding:0;width:70px;right:0!important;left:inherit;" class=" dropdown-menu Priority" id="ddl_NotesPriority_{normalize-space(ItemID)}" previousValue="{PriorityID}">
																		<xsl:choose>
																			<xsl:when test="PriorityID=1">
																				<li class="active" >
																					<a href="javascript:void(0);" onclick="UpdateItemNotesPriority_3_0('{normalize-space(ItemID)}','1');">
																						<label class="radio" style="padding-left: 0px;">
																							<span class="glyphicon glyphicon-star star_1" ></span>
																						</label>
																					</a>
																				</li>
																				<li >
																					<a href="javascript:void(0);" onclick="UpdateItemNotesPriority_3_0('{normalize-space(ItemID)}','3');">
																						<label class="radio" style="padding-left: 0px;">
																							<span class="glyphicon glyphicon-star star_3" ></span>
																						</label>
																					</a>
																				</li>
																			</xsl:when>
																			<xsl:otherwise>
																				<li >
																					<a href="javascript:void(0);" onclick="UpdateItemNotesPriority_3_0('{normalize-space(ItemID)}','1');">
																						<label class="radio" style="padding-left: 0px;">
																							<span class="glyphicon glyphicon-star star_1" ></span>
																						</label>
																					</a>
																				</li>
																				<li class="active" >
																					<a href="javascript:void(0);" onclick="UpdateItemNotesPriority_3_0('{normalize-space(ItemID)}','3');">
																						<label class="radio" style="padding-left: 0px;">
																							<span class="glyphicon glyphicon-star star_3" ></span>
																						</label>
																					</a>
																				</li>
																			</xsl:otherwise>
																		</xsl:choose>
																	</ul>
																</xsl:when>
															</xsl:choose>
														</div>
													</div>
												</xsl:when>
											</xsl:choose>
										</td>
										<td width="10%" class="verticallyMiddle" >
											<xsl:if test ="$LoginUser = UserID or $lsPermissionId = 4">
												<img id="img_{normalize-space(ItemID)}_Delete" style="visibility:hidden" title="Delete Note"
													 class="onMouseOver"
													 onclick="Notes_DeleteNote('{normalize-space(ItemID)}','div_Note_{normalize-space(ItemID)}');"
													 src="{$TemplatePathURL}Web/Images/Ver_2_0/BT_x.png"></img>
											</xsl:if>
										</td>
									</tr>
								</table>
							</div>
							<div>
								<span id="lbl_itemNote_{normalize-space(ItemID)}" class="discussionText">
									<xsl:apply-templates select ="NoteDesc"></xsl:apply-templates>
								</span>
							</div>
							<xsl:if test ="$LoginUser = $UserID or $PermissionID = 4">
								<a href="#" class="link" style="font-size: 9pt; margin-right: 5px;"
                                                         onClick='return Notes_EditNote(
                                                                      "div_Note_{normalize-space($itemID)}_Update",
                                                                      "div_Note_{normalize-space($itemID)}_View",
                                                                      "lbl_itemNote_{normalize-space($itemID)}",
                                                                      "txt_itemNote_{normalize-space($itemID)}"
                                                                      );'>
									Edit
								</a>
							</xsl:if>
							<xsl:if test ="$LoginUser = $UserID or $IsCommunityAdmin = 'True' or $PermissionID = 4">
								<a href="#" class="link" style="font-size: 9pt;"
                                                         onClick='return Notes_DeleteNote(
                                                                  "{normalize-space($itemID)}", 
                                                                  "div_Note_{normalize-space($itemID)}"
                                                                  );'>
									Delete
								</a>
							</xsl:if>
						</td>
					</tr>
					<xsl:if test="$BetaVersionInfo = '3.0'">
						<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
						<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />

						<xsl:variable name="loweredFileName">
							<xsl:value-of select="translate(AttachedFileName, $uppercase, $smallcase)"/>
						</xsl:variable>

						<xsl:variable name="ImageLink">
							<xsl:choose>
								<xsl:when test ="contains($loweredFileName, 'jpg') or contains($loweredFileName, 'jpeg')
                                          or contains($loweredFileName, 'png') or contains($loweredFileName, 'gif')
                                          or contains($loweredFileName, 'bmp')">
									<xsl:text>image-link</xsl:text>
								</xsl:when>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="Url">
							FileCabinet <xsl:value-of  select="substring-after(AttachmentURL,'FileCabinet')" />
						</xsl:variable>
						<tr>
							<td width="5%" class="padding5">
							</td>
							<td width="85%">
								<div onclick="setActivePanelFlagforImage()">
									<div style="display:table-cell;">
										<div class="verticallyMiddle" style="line-height:30px;display:table-cell;">
											<a target="_blank" href="{$Url}" class="{$ImageLink}">
												<img align="absmiddle" src="{ThumbNailURL}" onload="setWidthAndHeightImage(this, 50);">
												</img>
											</a>
										</div>
										<div style="display:table-cell" >
											<div class="verticallyMiddle" style="line-height:30px;float:left;margin-left:2px;" >
												<a target="_blank" href="{$Url}" class="{$ImageLink}" >
													<span class="discussionText whitespace">
														<xsl:value-of select="AttachedFileName"/>
													</span>
												</a>
											</div>
										</div>
									</div>
								</div>



							</td>
						</tr>
					</xsl:if>
					<tr>
						<td>
						</td>
						<td style='text-align:right;padding-bottom:10px;'>
							<span class="notesTime3_0">
								<xsl:choose>
									<xsl:when test="normalize-space(CreatedMinutes) != ''">
										<xsl:call-template name="TimeStamp">
											<xsl:with-param name="CreatedMinutes" select="CreatedMinutes"></xsl:with-param>
										</xsl:call-template>
									</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="NoteDateTime"/>
									</xsl:otherwise>
								</xsl:choose>
							</span>
						</td>
					</tr>
				</table>-->
			</div>
		</div>
		<!--</xsl:if>-->
	</xsl:template>

	<xsl:template name ="TimeStamp">
		<xsl:param name="CreatedMinutes" select="'N/A'"></xsl:param>
		<font color="#414040">
			<xsl:if test ="$CreatedMinutes &lt; 1">
				&#xa0;<xsl:value-of select="round(normalize-space($CreatedMinutes) * 60)"/> second(s) ago
			</xsl:if>
			<xsl:if test ="$CreatedMinutes &gt;= 1 and $CreatedMinutes &lt; 60">
				&#xa0;<xsl:value-of select="round(normalize-space($CreatedMinutes))"/> minute(s) ago
			</xsl:if>
			<xsl:if test ="$CreatedMinutes &gt;= 60 and $CreatedMinutes &lt; 1440 ">
				&#xa0;<xsl:value-of select="round(normalize-space($CreatedMinutes) div 60)"/> hour(s) ago
			</xsl:if>
			<xsl:if test ="$CreatedMinutes &gt; 1440 ">
				&#xa0;<xsl:value-of select="round(normalize-space($CreatedMinutes) div 1440)"/> day(s) ago
			</xsl:if>
		</font>
	</xsl:template>

	<xsl:template match="NoteDesc">
		<xsl:call-template name="break"></xsl:call-template>
	</xsl:template>


	<xsl:template name="SurveyQuestionFileUpload">
		<xsl:param name="TemplateURL" select="'N/A'"></xsl:param>
		<xsl:param name="SourceItemID" select="'N/A'"></xsl:param>


		<div class="col-md-12 padgLR0">
			<div id="NoteFileUpload_{$SourceItemID}_Panel" style="display:none;" class="col-md-12 col-xs-12 col-xs-12 padgLR0">
				<div class="col-md-10 col-xs-10 col-xs-10 padgLR0">
					<div class="verticallyMiddle col-md-4  padgLR0" style="height:30px;">
						<a id="ancNoteAttachment_{$SourceItemID}" target="_blank">
							<img id="imgNoteAttachment_{$SourceItemID}_Thumbnail" align="absmiddle"
								 onload="setWidthAndHeightImage(this, 40);">
							</img>
						</a>
					</div>

					<div class="verticallyMiddle col-md-7 col-xs-7 col-xs-7 padgLR0" style="line-height:30px;float:left;margin-left:2px;">
						<a id="ancNoteAttachment_{$SourceItemID}_Title" target="_blank">
							<span id="spnNoteAttachment_{$SourceItemID}_FileName"
								  style="font-size:16px;" class="whitespace">
							</span>
						</a>
					</div>
				</div>

				<div class="verticallyMiddle co-md-2 col-xs-2 col-xs-2 padgLR0" style="height:30px;">
					<!--<img id="SurveyFileUpload_{$ControlID}_Thumbnail" src="{$ThumbnailPath}"></img>
                    <span id="SurveyFileUpload_{$ControlID}_FileName">
                        <xsl:value-of select="$FileName"/>
                    </span>-->
					<img class="onMouseOver"
                         src="{$TemplateURL}/Web/Images/Ver_2_0/BT_deleteGoal_selfGrowth.png"
						 onClick="notes_DeleteFile({$SourceItemID}, 0);"></img>
				</div>
				<!--<div class="verticallyMiddle" style="height:80px;display:table-cell;margin-left:2px;">
					<img style="margin-left:10px;" class="onMouseOver"
                         src="{$TemplateURL}/Web/Images/Ver_2_0/BT_deleteGoal_selfGrowth.png"></img>
				</div>-->
			</div>
			<div id="div_{$SourceItemID}_UploadSuite_AddButton"
                 class="verticallyMiddle onMouseOver col-md-12 col-xs-12 col-xs-12 padgLR0"
                 style="line-height:25px;margin-top:5px;"
                 onmouseover="document.getElementById('img_AddFile') != null ? document.getElementById('img_AddFile').src='{$TemplateURL}/Web/Images/Ver_2_0/icon_add_over.png':'';"
                 onmouseout="document.getElementById('img_AddFile') != null ? document.getElementById('img_AddFile').src='{$TemplateURL}/Web/Images/Ver_2_0/icon_Add.png':'';"
                 onclick="document.getElementById('div_{$SourceItemID}_UploadSuite').style.display='block';
				 div_{$SourceItemID}_UploadSuite_AddButton.style.display='none';
                 $au.imageUploaderFlash('UploadSuite_{$SourceItemID}').uploadPane().addFiles();
				sliderNotesPanelActive = true;">

				<div style="height:23px;float:left;border:1px solid;background-color:#EBEBE4;
                     margin-right:5px;display:none;"></div>
				<div id="btnAddAttachment" class="verticallyMiddle">
					<span id="span_Add" class="capitalFont addattachtment" style="float:left;">
						<i class="fa fa-paperclip cursrP filesize" style="display:inline-block;"></i>
					</span>
					<span style="float:left;margin-left:12px;">
						Add Attachment
					</span>
				</div>
			</div>

			<div id="div_{$SourceItemID}_UploadSuite" style="display:none;" class="col-md-12 col-xs-12 col-xs-12">
				<input type="hidden" id="EmbededScript_{$SourceItemID}"
                       name="EmbededScript_{$SourceItemID}"
                       style="display:none;"
                       value="loadNotesFileUploadPanel('UploadSuite_{$SourceItemID}','div_{$SourceItemID}_UploadSuite'
                       , {$SourceItemID});"/>
			</div>
		</div>

	</xsl:template>


	<xsl:include href="Notes_LineBreak.xslt"/>
</xsl:stylesheet>
