<%@ Control Language="C#" %>
<%@ Register TagPrefix="CSD" Namespace="CommunityServer.Discussions.Controls" Assembly="CommunityServer.Discussions" %>
<%@ Register TagPrefix="CS" Namespace="CommunityServer.Controls" Assembly="CommunityServer.Controls" %>
<%@ Import Namespace="CommunityServer.Discussions.Controls" %>
<%@ Import Namespace="CommunityServer.Discussions.Components" %>
<%@ Import Namespace="CommunityServer.Components" %>
<%@ Import Namespace="CommunityServer.Controls" %>
<%@ Import Namespace="CommunityServer" %>

<CS:Style href="ForumThreadedPost.css" runat="server" ID="Style1"/>

<script language="javascript">
try
{
	var url = window.top.location.href;
	var re = new RegExp('<%=CommunityServer.Discussions.Controls.PostThreadedView.ValidTopWindowUrlPattern%>', 'i');
	if (!re.test(url))
		window.top.location = '<%= SiteUrls.Instance().Post(CSContext.Current.PostID) %>';
}
catch(err)
{
}
</script>
<script language="javascript">
var resizeHandle = null;
function resizePostDisplay(width, height)
{
	clearTimeout(resizeHandle);
	var oWidth = width;
	var oHeight = height;

	var buttons = document.getElementById('PostButtons');
	var container = document.getElementById('PostDisplayContainer');
	var body = document.getElementById('PostDisplayBody');
	var header = document.getElementById('PostDisplayHeader');
	var footer = document.getElementById('PostDisplayFooter');

	if (container && body && header && footer && buttons && height > 0 && width > 0)
	{
		try
		{
			height -= parseInt(buttons.offsetHeight);
			container.style.height = ensureSafeInteger(height - 18) + 'px';
			
			height -= (parseInt(footer.offsetHeight) + parseInt(header.offsetHeight));
			body.style.height = ensureSafeInteger(height - 56) + 'px';
			
			buttons.style.width = ensureSafeInteger(width - 16) + 'px';
			container.style.width = ensureSafeInteger(width - 16) + 'px';
			header.style.width = ensureSafeInteger(width - 36) + 'px';
			body.style.width = ensureSafeInteger(width - 36) + 'px';
			footer.style.width = ensureSafeInteger(width - 48) + 'px';
			
			container.style.visibility = 'visible';
			buttons.style.visibility = 'visible';
		}
		catch (err)
		{
		}
	}
	
	resizeHandle = setTimeout('resizePostDisplay(' + oWidth + ',' + oHeight + ')', 999);
}

function ensureSafeInteger(value)
{
	if (value < 0)
		return 0;
	else
		return value;
}
</script>

<div id="PostButtons" class="ForumThreadPostButtons" style="visibility: hidden;">
<div style="float: left">
	<CSD:ForumImageButton runat="server" ButtonType="Reply" id="ReplyButton" />
	<CSD:ForumImageButton runat="server" ButtonType="Quote" id="QuoteButton" />
	<CSD:ForumImageButton runat="server" ButtonType="Delete" id="DeleteButton" />
	<CSD:ForumImageButton runat="server" ButtonType="Edit" id="EditButton" />
</div>
<div style="float: right">
	<csd:ChangeViewPopupMenu runat="server" id="ChangeViewPopupMenu" activebuttoncssclass="CommonImageTextButtonHighlight" inactivebuttoncssclass="CommonImageTextButton" innerbuttoncssclass="CommonButtonInnerContentDown" />
	<cs:favoritepopupmenu id="FavoritePopupMenu" runat="server" activebuttoncssclass="CommonImageTextButtonHighlight" inactivebuttoncssclass="CommonImageTextButton" innerbuttoncssclass="CommonButtonInnerContentDown" />
	<cs:contactpopupmenu id="ContactPopupMenu" runat="server" activebuttoncssclass="CommonImageTextButtonHighlight" inactivebuttoncssclass="CommonImageTextButton" innerbuttoncssclass="CommonButtonInnerContentDown" />
	<CSD:RatePost id="RatePost" runat="server" visible="false"  CssClass="ForumThreadRateControl" ReadOnlyCssClass="ForumThreadRateControlReadOnly" ActiveCssClass="ForumThreadRateControlActive" ImagesBaseUrl="~/Themes/default/images/common/" />
	<csd:moderationpopupmenu id="ModerationPopupMenu" runat="server" activebuttoncssclass="CommonTextButtonHighlight" inactivebuttoncssclass="CommonTextButton" innerbuttoncssclass="CommonButtonInnerContentDown" />
	<CSD:RatePost id="RateThread" runat="server" visible="false" Cssclass="ForumThreadRateControl" ReadOnlyCssclass="ForumThreadRateControlReadOnly" ActiveCssclass="ForumThreadRateControlActive" ImagesBaseUrl="~/Themes/default/images/common/" />
	<CS:ThreadSubscribeLinkButton runat="server" id="TrackingButton" UseImages="true" TrackingResourceName="PostFlatView_EnableThreadTrackingOn" NotTrackingResourceName="PostFlatView_EnableThreadTrackingOff" />
</div>
<div style="clear: both;"></div>
</div>

<div class="ForumThreadPostContainer" id="PostDisplayContainer" style="visibility: hidden;">
	<div class="ForumThreadPostBody">
		<div class="ForumThreadPostHeader" id="PostDisplayHeader">
			<table cellpadding="0" cellspacing="0" border="0">
			<tr valign="top">
				<td class="ForumThreadPostUserAvatar"><CS:UserAvatar runat="server" Border="1" PadImage="False" id="Avatar" /></td>
				<td>
					<div class="ForumThreadPostTitle"><asp:Literal runat="server" id="Emoticon" /> <asp:Literal runat="server" id="Subject" /></div>
					<div class="ForumThreadPostPubDate"><asp:Literal ID="PostDate" Runat="server" /></div>
					<div class="ForumThreadPostAuthor"><asp:Literal runat="server" id="Username" /></div>
					<div class="ForumThreadPostUserProperties">
						<ul class="ForumThreadPostUserPropertyList">
							<li>
								<CS:PostIcons runat="server" id="PostIcon" />
							</li>
							<li>
								<CS:UserAttribute FormatString="{0}" Attribute="Joined" runat="server" id="JoinedAttribute" />
							</li>
							<li>
								<CS:UserAttribute FormatString="{0}" Attribute="Location" runat="server" id="LocationAttribute" />
							</li>
							<li>
								<CS:UserAttribute FormatString="{0}" Attribute="Posts" runat="server" id="PostsAttribute" />
							</li>
							<li>
								<CS:UserAttribute FormatString="{0}" Attribute="Points" runat="server" id="PointsAttribute" />
							</li>
						</ul>
					</div>
					<div class="ForumThreadPostRoleIcons"><CS:RoleIcons runat="server" id="RoleIcon" EnablePadding="false"/></div>
					<div class="ForumThreadPostAttachment"><CSD:PostAttachment runat="server" id="PostAttachment" /></div>
				</td>
			</tr>
			</table>
		</div>
		<div class="ForumThreadPostContent" id="PostDisplayBody">
			<CSD:PostView runat="server" id="PostView" />
		</div>
		<div class="ForumThreadPostFooterArea" id="PostDisplayFooter">	
			<ul class="ForumPostStatistics CommonPrintHidden" style="clear: both;">
				<CS:ListItemLiteral runat = "Server" id = "PostPoints" />
				<CS:ListItemLiteral runat = "Server" id = "PostIPAddress" />
				<CS:ListItemLink runat = "Server" id = "ReportLink" />
				<CS:ListItemLink runat = "Server" id = "quickReplyLink" />
			</ul>
		</div>
	</div>
</div>

<script language="javascript">
setTimeout(initializePostDisplay, 19);
function initializePostDisplay()
{
	var buttons = document.getElementById('PostButtons');
	if (buttons)
	{
		if (parseInt(buttons.offsetHeight) == 0)
			setTimeout(initializePostDisplay, 19);
		else
		{
			if (window.parent && window.parent.updateLinkTargets)
				window.parent.updateLinkTargets(document);
		
			if (window.parent && window.parent.getPostDisplayWidthHeight)
			{
				var wh = window.parent.getPostDisplayWidthHeight();
				resizePostDisplay(wh[0], wh[1]);
			}
		}
	}
}
</script>



								



