<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>

<!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">
	<title></title>
	<telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
	<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
		<Scripts>
			<%--Needed for JavaScript IntelliSense in VS2010--%>
			<%--For VS2008 replace RadScriptManager with ScriptManager--%>
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
		</Scripts>
	</telerik:RadScriptManager>
	<script type="text/javascript">
		//Put your JavaScript code here.
    </script>
	<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
	</telerik:RadAjaxManager>
	<div>
    <telerik:RadEditor runat="server" ID="RadEditor1">
        <Tools>
            <telerik:EditorToolGroup>
                <telerik:EditorTool Name="InsertSpecialLink" Text="Insert Special Link" />
                <telerik:EditorTool Name="PrintPreview" Text="Print Preview" />
                <telerik:EditorTool Name="InsertEmoticon" Text="Insert Smiley" />
            </telerik:EditorToolGroup>
        </Tools>
        <Content>
        <img alt="product logo" src="../../Img/productLogoLight.gif" />is the successor of the well known industry standard Editor for ASP.NET. The tight integration with ASP.NET AJAX and the powerful new capabilities make Telerik's WYSIWYG Editor a flexible and lightweight component, turning it into the fastest loading Web Editor. Among the hottest features are: 
        <ul>
            <li><em>Single-file, drag-and-drop deployment</em></li>
            <li><em>Built on top of <a href="http://asp.net/ajax">ASP.NET AJAX</a></em></li>
            <li><em>Unmatched loading speed with new semantic rendering </em></li>
            <li><em>Full keyboard accessibility</em></li>
            <li><em>Flexible Skinning mechanism</em></li>
            <li><em>Simplified and intuitive toolbar configuration</em></li>
            <li><em>Out-of-the-box XHTML-enabled output</em></li>
            </ul>
        </Content>
    </telerik:RadEditor>
    <script type="text/javascript">
		//<![CDATA[
        Telerik.Web.UI.Editor.CommandList["InsertSpecialLink"] = function (commandName, editor, args)
        {
            var elem = editor.getSelectedElement(); //returns the selected element.

            //img fix
            if (getParentLink(elem))
            {
                elem = getParentLink(elem);
            }
            //end img fix

            if (elem.tagName == "A")
            {
                editor.selectElement(elem);
                argument = elem.cloneNode(true);
            }
            else
            {
                var content = editor.getSelectionHtml();
                var link = editor.get_document().createElement("A");
                link.innerHTML = content;
                argument = link;
            }

            var myCallbackFunction = function (sender, args)
            {
                editor.pasteHyperLink(args, "Insert Link");
            }

            editor.showExternalDialog(
            "InsertLink.aspx",
            argument,
            270,
            300,
            myCallbackFunction,
            null,
            "Insert Link",
            true,
            Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
            false,
            true);
        };

        Telerik.Web.UI.Editor.CommandList["PrintPreview"] = function (commandName, editor, args)
        {
            var args = editor.get_html(true) //returns the HTML of the selection.  

            editor.showExternalDialog(
            "PrintPreview.aspx",
            args,
            570,
            420,
            null,
            null,
            "Print Preview",
            true,
            Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
            true,
            true);
        };

        Telerik.Web.UI.Editor.CommandList["InsertEmoticon"] = function (commandName, editor, args)
        {
            var myCallbackFunction = function (sender, args)
            {
                editor.pasteHtml(String.format("<img src='{0}' border='0' align='middle' alt='emoticon' /> ", args.image));
            }

            editor.showExternalDialog(
            "InsertEmoticon.aspx",
            {},
            400,
            310,
            myCallbackFunction,
            null,
            "Insert Emoticon",
            true,
            Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
            false,
            true);
        };

        function getParentLink(el)
        {
            while (el.tagName != "A" && el.tagName != "BODY")
            {
                el = el.parentNode;
            }

            if (el.tagName == "BODY") return false
            else return el;
        }
		//]]>
    </script>
	</div>
	</form>
</body>
</html>
