<%@ Page Language="C#" AutoEventWireup="true"  Theme="Web20" CodeFile="Compose.aspx.cs" Inherits="Compose" %>
<%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" style="overflow:hidden">

<head runat="server">
    <title>Compose</title>

	<meta http-equiv="Content-type" content="application/xhtml+xml; charset=utf-8" />
    
    <style type="text/css" runat="server">
		* { margin: 0; padding: 0; }
		
		.composeWindow
		{
			overflow: hidden;
		}
		
		fieldset { border: 0; overflow: hidden; }
		legend { display: none; }

		div.radeditor.rade_wrapper
		{
			border: 0 !important;
		}
		
		#RadEditor1BottomResizer
		{
			display: none
		}
		
		.submitButton,
		.cancelButton
		{
			border: 0;
			color: #fff;
			font: bold 12px Arial,Verdana,sans-serif;
			
			position: absolute;
			bottom: 5px;
			
			width: 67px;
			height: 21px;
			
			display: block;
			
			background: url('Img/button.gif') no-repeat 0 0;
		}
		
		.submitButton
		{
			right: 20px;
		}
		
		.cancelButton
		{
			right: 100px;
		}
    </style>
</head>
<body class="composeWindow">    
    <form id="form1" runat="server">
		<telerik:RadScriptManager ID="ScriptManager" runat="server" />
		
		<fieldset>
			<legend>Compose message</legend>

			<telerik:RadEditor ID="RadEditor1"
				Width="795px" Height="460px" AutoResizeHeight="false"
				runat="server" ImageManager-ViewPaths="~/Img" ImageManager-UploadPaths="~/Img"
				 ImageManager-DeletePaths="~/Img" ImageManager-MaxUploadFileSize="512000" DocumentManager-DeletePaths="~/Documents"
				 FlashManager-DeletePaths="~/Flash" MediaManager-DeletePaths="~/Flash" TemplateManager-DeletePaths="~/Documents"
				 DocumentManager-ViewPaths="~/Documents"  DocumentManager-UploadPaths="~/Documents" FlashManager-UploadPaths="~/Flash"
				 MediaManager-UploadPaths="~/Flash"  TemplateManager-UploadPaths="~/Documents" FlashManager-ViewPaths="~/Flash"
				 MediaManager-ViewPaths="~/Media" ToolsFile="~/ToolsFile.xml" OnClientLoad="OnClientLoad" ExternalDialogsPath="~/Dialogs" >
				 
				<DocumentManager DeletePaths="~/Documents" UploadPaths="~/Documents" ViewPaths="~/Documents" />
				<MediaManager DeletePaths="~/Flash" UploadPaths="~/Flash" ViewPaths="~/Media" />
				<ImageManager DeletePaths="~/Img" MaxUploadFileSize="512000" UploadPaths="~/Img" ViewPaths="~/Img" />
				<TemplateManager DeletePaths="~/Documents" UploadPaths="~/Documents" />
				<FlashManager DeletePaths="~/Flash" UploadPaths="~/Flash" ViewPaths="~/Flash" />
				<Content></Content>
				
			</telerik:RadEditor>

			<script type="text/javascript">
				function GetRadWindow()
				{
					return window.radWindow || window.frameElement.radWindow;
				}	
					
				function OnClientCancel()
				{
				    if (spellInProgress) 
				    {
				        alert("You have to finish the spell check first!");
				    }
				    else
				    {
					    var oWindow = GetRadWindow();			
					    oWindow.close();
					}
					return false;
				}	
				
				function OnClientSubmit()
				{
					var oWindow = GetRadWindow();			
					oWindow.close();
				}		
				
				function OnClientButtonSubmit()
				{
				    if (spellInProgress) 
				    {
				        alert("You have to finish the spell check first!");
				        return false;
				    }
				}	
					
				var spellInProgress = false;
				
				function OnClientLoad(sender,e)
				{
				    sender.add_spellCheckLoaded(function()
                    {
                        var spell = sender.get_ajaxSpellCheck();
                                                
                        spell.add_spellCheckStart(function(sender, args)
                        { 
                           spellInProgress = true;
                        });
                                    
                        spell.add_spellCheckEnd(function(sender, args)
                        {
                           spellInProgress = false;
                        });
                    });

				}
			</script>
			
			<asp:Literal ID="InjectScript" runat="server"></asp:Literal>
			
			<asp:Button ID="Button1" runat="server" Text="Submit" CssClass="submitButton" OnClientClick="return OnClientButtonSubmit()" OnClick="Button1_Click" />
			<asp:Button ID="Button2" runat="server" Text="Cancel" CssClass="cancelButton" OnClientClick="return OnClientCancel()"/>
			
		</fieldset>
    </form>
</body>
</html>
