﻿var RadEditor1ClientObject = null;
RadEditorCommandList["Insert Abbreviation"] =
    	function CustomDialogCommand(commandName, editor, oTool) {
    	    //get the selected text
    	    var rngSelection = editor.Document.selection.createRange();

    	    //pop open a simple javascript prompt
    	    var reply = prompt("Please enter the description:", "");

    	    //take the return of the prompt and add html
    	    if (reply == null) {
    	        // null if cancel clicked
    	    }
    	    else if (reply == "") {
    	        // no text entered
    	    }
    	    else {
    	        var newTextValue = "<span class=\"abbr\" title=\"" + reply + "\">" + rngSelection.htmlText + "</span>";
    	        //add the new code
    	        editor.PasteHtml(newTextValue);
    	    }
    	};

RadEditorCommandList["Insert Go To Top"] =
    	function CustomDialogCommand(commandName, editor, oTool) {
    	    var newTextValue = "<a href=\"#content\" title=\"Top of Page\">Top of Page</a>";
    	    //add the new code
    	    editor.PasteHtml(newTextValue);
    	};

RadEditorCommandList["Insert Email Link"] =
    	function CustomDialogCommand(commandName, editor, oTool) {
    	    //get the selected text
    	    var rngSelection = editor.Document.selection.createRange();

    	    //pop open a simple javascript prompt
    	    var reply = prompt("Please enter the email address:", "");

    	    //take the return of the prompt and add html
    	    if (reply == null) {
    	        // null if cancel clicked
    	    }
    	    else if (reply == "") {
    	        // no text entered
    	    }
    	    else {
    	        var newTextValue = "<a href=\"mailto:" + reply + "\">" + rngSelection.htmlText + "</a>";
    	        //add the new code
    	        editor.PasteHtml(newTextValue);
    	    }
    	};

RadEditorCommandList["Insert Block Quote"] =
    	function CustomDialogCommand(commandName, editor, oTool) {
    	    //get the selected text
    	    var rngSelection = editor.Document.selection.createRange();

    	    var newTextValue = "<blockquote>" + rngSelection.htmlText + "</blockquote>";
    	    //add the new code
    	    editor.PasteHtml(newTextValue);
    	};

RadEditorCommandList["Insert Quote"] =
    	function CustomDialogCommand(commandName, editor, oTool) {
    	    //get the selected text
    	    var rngSelection = editor.Document.selection.createRange();

    	    var newTextValue = "<q>" + rngSelection.htmlText + "</q>";
    	    //add the new code
    	    editor.PasteHtml(newTextValue);
    	};

RadEditorCommandList["Insert Image Caption"] =
    	function CustomDialogCommand(commandName, editor, oTool) {
    	    //pop open a simple javascript prompt
    	    var reply = prompt("Please enter the caption:", "");

    	    //take the return of the prompt and add html
    	    if (reply == null) {
    	        // null if cancel clicked
    	    }
    	    else if (reply == "") {
    	        // no text entered
    	    }
    	    else {
    	        var newTextValue = "<br /><span class=\"caption\">" + reply + "</span>";
    	        //add the new code
    	        editor.PasteHtml(newTextValue);
    	    }
    	};
