if(!$.isMobile() && !$.testingActive){
    tinyMCE_GZ.init({
        plugins: 'contextmenu,fullscreen,spellchecker,table,paste',
        themes: 'simple,advanced',
        languages: 'en',
        disk_cache: true,
        debug: false
    });
    
    //removing mceEditor class from inline comments
    $(function(){
        $(".olt-comments textarea.mceEditor").removeClass("mceEditor");
    });

    tinyMCE.init({
        theme: "advanced",
        mode: "specific_textareas",
        editor_selector: "mceEditor",
        skin: "default",
        plugins: "contextmenu,fullscreen,spellchecker,table,paste",
        plugin_preview_width: "500",
        plugin_preview_height: "600",
        apply_source_formatting: true,
        force_br_newlines: false,
        force_p_newlines: true,
        remove_trailing_nbsp: false,
        theme_advanced_path: false,
        relative_urls: false,
        inline_styles: true,
        browsers: "msie,gecko,opera,safari",
        extended_valid_elements: "style[]",
        cleanup_callback: "myCustomCleanup",
        convert_urls: false,
        table_cell_limit: 1000,
        table_col_limit: 20,
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location: "bottom",
        theme_advanced_resizing: true,
        theme_advanced_resizing_use_cookie: false,
        theme_advanced_resize_horizontal: false,
        theme_advanced_blockformats: "p,h1,h2,h3,pre",
        theme_advanced_buttons1: "link,unlink,image,table,separator,"
        + "formatselect,forecolor,separator,"
        + "bold,italic,underline,strikethrough,separator,"
        + "bullist,numlist,outdent,indent,separator,"
        + "justifyleft,justifycenter,justifyright,justifyfull,separator,"
        + "spellchecker,code,fullscreen,pasteword",
        theme_advanced_buttons2: "",
        width: "100%",
        spellchecker_rpc_url : "/common/js/tiny_mce/plugins/spellchecker/rpc.php"
    });
}

function myCustomCleanup(type, value)
 {
    switch (type)
    {
    case "insert_to_editor":
        break;
    case "insert_to_editor_dom":
        var scriptTags = value.getElementsByTagName('script');
        if (scriptTags && scriptTags.length)
        {
            for (var i = (scriptTags.length - 1); i >= 0; i--)
            {
                scriptTags[i].parentNode.removeChild(scriptTags[i]);
            }
        }
        break;
    case "get_from_editor":
        value = value.replace(/<p>\s*<\/p>/gi, '');
        break;
    case "get_from_editor_dom":
        break;
    }
    return value;
}