﻿function myCustomCleanup(type, value) {
        if (type == "insert_to_editor") {
            value = value.replace(/&lt;/gi, "<");
            value = value.replace(/&gt;/gi, ">");
        }
        return value;
    }
    function myCustomSaveContent(element_id, html, body) {
        html = html.replace(/</gi, "&lt;");
        html = html.replace(/>/gi, "&gt;");
        return html;
    }
    tinyMCE.init({
        mode: "textareas",

        theme: "advanced",
        
        language : 'da',

        plugins: "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager,attachment",

        //theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,|,formatselect,fontselect,fontsizeselect,|,forecolor,backcolor",

        //theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,link,unlink,image,media,|,insertdate,inserttime",

        theme_advanced_buttons1: "bold,italic,underline,strikethrough,|cut,copy,paste,pasteword,|,undo,redo|,link,unlink,image,media,attachment",

        theme_advanced_buttons2: "",

        theme_advanced_buttons3: "",

        theme_advanced_toolbar_location: "top",

        theme_advanced_toolbar_align: "left",

        theme_advanced_resizing: false,

        template_external_list_url: "js/template_list.js",

        external_link_list_url: "js/link_list.js",

        external_image_list_url: "js/image_list.js",

        media_external_list_url: "js/media_list.js",

        cleanup_callback: "myCustomCleanup",

        save_callback: "myCustomSaveContent",
        
        editor_deselector: "mceNoEditor"
    });


    $(document).ready(function() {

        $(".run").click(function() {

            $("#box").animate({ opacity: "0.1", left: "+=400" }, 1200)
	  .animate({ opacity: "0.4", top: "+=160", height: "20", width: "20" }, "slow")
	  .animate({ opacity: "1", left: "0", height: "100", width: "100" }, "slow")
	  .animate({ top: "0" }, "fast")
	  .slideUp()
	  .slideDown("slow")
            return false;

        });

    });