<%@ Register TagPrefix="CS" Namespace="CommunityServer.Controls" Assembly="CommunityServer.Controls" %>
<%@ Register TagPrefix="CP" Namespace="CommunityServer.ControlPanel.Controls" Assembly="CommunityServer.Web" %>
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="SkinOptionsControl.ascx.cs" Inherits="CommunityServer.ControlPanel.Controls.Blogs.SkinOptionsControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register TagPrefix="CA" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>
<script language="javascript">
	function selectTheme()
	{
		var element = $('<%=  Themes.ClientID %>');
        var index = element.selectedIndex;
        var text = element.options[index].value;
        return text
	}

    function UpdatePreview()
	{
        $('<%= this.PreviewImage.ClientID %>').innerHTML = '';
        $('<%= this.PreviewText.ClientID %>').innerHTML = '';
        Element.show('loading');
        SelectPreviewImage();
        SelectPreviewText();
	}
    function SelectPreviewText()
    {
        SkinOptionsControl.GetPreviewText('<%= this.ClientID %>',selectTheme(),previewTextCallBack);
    }
    
    function previewTextCallBack(res)
    {
        $('<%= this.PreviewText.ClientID %>').innerHTML = res.value;
        /*if(res.value.length == 0)
			Element.hide('<%= this.PreviewText.ClientID %>');
		else
	        Element.show('<%= this.PreviewText.ClientID %>');*/
    }
    
    function SelectPreviewImage()
    {
        SkinOptionsControl.GetPreviewImage('<%= this.ClientID %>',selectTheme(),previewImageCallBack);
    }

    function previewImageCallBack(res)
    {
        Element.hide('loading');
        $('<%= this.PreviewImage.ClientID %>').innerHTML = res.value;

    }

</script>
<CP:StatusMessage id="Status" runat="server"></CP:StatusMessage>
<div class="CommonFormFieldName" id="SkinSelector" Runat="server">
	<cp:helpicon id="HelpIcon1" runat="Server" resourcename="CP_Blog_SkinOptions_Theme_Help"></cp:helpicon>
	<CP:FormLabel id="FormLabel1" runat="server" ControlToLabel="Themes" ResourceName="CP_Blog_SkinOptions_Theme"></CP:FormLabel>&nbsp;
	<asp:DropDownList id="Themes" Runat="Server"></asp:DropDownList>
	<table cellpadding="15" cellspacing="0" border="0" align="center" id="previewtable" runat="server">
		<tr valign="top">
			<td>
				<span id="PreviewImage" runat="server"></span><span id="loading" style="DISPLAY:none">
					<center>Loading <img src="<%=CommunityServer.Components.SiteUrls.Instance().LoadingImageUrl%>"></center>
				</span>
			</td>
			<td>
				<div id="PreviewText" runat="server" style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: #cccccc 1px solid; OVERFLOW-Y: scroll; PADDING-LEFT: 4px; OVERFLOW-X: hidden; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 300px; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 200px"></div>
			</td>
		</tr>
	</table>
</div>
