    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Mensagem1.aspx.vb" Inherits="InovarPAA.Mensagem1" ValidateRequest="false" %>

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server" >
   <script src="Resources.Gizmox.WebGUI.Forms.Skins.CommonSkin.Interfaces.js.wgx" type="text/javascript"></script>
        <title></title>
             <style type="text/css" >
            #form1
            {
                height: 50px;
                width: 330px;
            }
            #Dir
            {
                position:relative;
                float :right;
                top: 1px;
                left: -4px;
                width: 200px;
                height: 50px;
                right: 4px;
            }
            #Esq
            {
                position:relative;
                float :left;
                top: -3px;
                left: -1px;
                width: 360px;
                height: 105px;
            }
            </style>
    </head>
    <body style="width: 315px; height: 95px;">
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" >
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
                </asp:ScriptReference>
            </Scripts>
        </telerik:RadScriptManager>
        <div id="Esq" >
            <telerik:RadEditor ID="RadEditor1" EditModes="Design" ExternalDialogsPath="~/WebComponent/EditorDialogs/" Width="365px" Height="155px" Runat="server" StripFormattingOnPaste="None" 
            NewLineMode="P" StripFormattingOptions="AllExceptNewLines" OnClientLoad="OnClientLoad" OnClientCommandExecuted="ValidaAlteracaoMensagem" OnClientDomChange="ValidaAlteracaoMensagem" OnClientPasteHtml="ValidaAlteracaoMensagem">
                <Tools>
                    <telerik:EditorToolGroup>
<%--                        <telerik:EditorSplitButton Name="Undo" />
                        <telerik:editorsplitbutton name="redo" />
                        <telerik:editortool name="cut" />
                        <telerik:editortool name="copy" />--%>
                        <telerik:editortool name="bold" />
                        <telerik:editortool name="italic" />
                        <telerik:editortool name="underline" />
                        <telerik:editorTool name="InsertLink" />
<%--                    <telerik:editortool name="justifyleft" />
                        <telerik:editortool name="justifycenter" />
                        <telerik:editortool name="justifyright" />
                        <telerik:editortool name="justifyfull" />
                        <telerik:editortool name="justifynone" />
                        <telerik:editortool name="insertorderedlist" />--%>
                    </telerik:EditorToolGroup>
                </Tools>
                <Content></Content>

                <TrackChangesSettings CanAcceptTrackChanges="False"></TrackChangesSettings>
        </telerik:RadEditor>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%--            <telerik:RadButton ID="RadButton2" runat="server" ButtonType="StandardButton" 
                BackColor="#659CEF" Text="Gerar e guardar ofício" UseSubmitBehavior="True" 
                ForeColor="White" EnableAjaxSkinRendering="True" 
                EnableBrowserButtonStyle="True" Font-Bold="True" Font-Names="Arial" AutoPostBack="True">
            </telerik:RadButton>--%>
        </div>
        &nbsp;</form>
        <script type="text/javascript">
            function OnClientLoad(editor, args) {
                editor.attachEventHandler("onkeydown", function (e) {
                    setTimeout(function () {
                        ValidaAlteracaoMensagem(editor, args);
                    }, 0);
                });

                var style = editor.get_contentArea().style;
                style.backgroundImage = "none";
                style.backgroundColor = "white";
                style.color = "Black";
                style.fontFamily = "ARIAL";
                style.fontSize = 12 + "px";
            }

            function ValidaAlteracaoMensagem(editor, args) {
                var TamanhoMaximo = 200;
                var TextoMensagem = editor.get_text();
                if (TextoMensagem.length > TamanhoMaximo) {
                    editor.set_html(TextoMensagem.substring(0, TamanhoMaximo));
                    alert("Número máximo de caracteres atingido!")

                    return;
                }
                var objEvent = VWG.Events.CreateEvent("<%= PageContext.ID %>", "message");
                var TextoApassar = editor.get_html();
                VWG.Events.SetEventAttribute(objEvent, "messagetext",TextoApassar);
                VWG.Events.SetEventAttribute(objEvent, "CaixaAtiva", 1);
                VWG.Events.RaiseEvents();
            }

        </script>
    </body>

    </html>

