var dia_tinyMCE_Conf = {
        mode : "none",
        theme : "advanced",
        convert_urls : false,
        relative_urls : false,
        force_br_newlines : true,
        force_p_newlines : false,
        language : 'pl',//(navigator.language ? navigator.language : navigator.userLanguage),
        plugins : "table,advlink,advimage,contextmenu,media,paste",
        theme_advanced_buttons1 : "formatselect,fontselect,fontsizeselect,separator,removeformat,cleanup",
        theme_advanced_buttons2 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,backcolor,forecolor",
        theme_advanced_buttons3 : "cut,copy,paste,pastetext,pasteword,selectall,separator,undo,redo,separator,link,unlink,anchor,separator,image,media,separator,code",
        theme_advanced_buttons4 : "tablecontrols,separator",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        content_css : WEB_ROOT + 'css/themes/' + CSS_THEME + '/css/editor.css',
        plugi2n_insertdate_dateFormat : "%Y-%m-%d",
        plugi2n_insertdate_timeFormat : "%H:%M:%S",
        extended_valid_elements : "a[name|href|target|title|onclick],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
        advimage_image_browser_callback : "dia_ImageBrowserCallback",
        table_image_browser_callback : "dia_ImageBrowserCallback",
        file_browser_callback : "dia_FileBrowserCallback",
        media_use_script : true,
        paste_use_dialog : false,
        theme_advanced_resizing : true,
        theme_advanced_resize_horizontal : false,
        paste_auto_cleanup_on_paste : true,
        paste_convert_headers_to_strong : false,
        paste_strip_class_attributes : "all"
};

function dia_FileBrowserCallback(field_name, url, type, win)
{
    var	urlStr = BASE_URL+'/documents/manage/';

    imageBroswerWin = win.open(urlStr,'DiamondCMSFileBrowser','width=600,height=400,menubar=no,resizeable=no,scrollbars=yes');

    window.tinyMCE_field = field_name;
    window.document.tinyMCE_field = field_name;
    win.tinyMCE_field = field_name;

    imageBroswerWin.focus()
}

function dia_ImageBrowserCallback(field_name, url, type, win)
{
    var	urlStr = BASE_URL+'/images/manage/';

    imageBroswerWin = win.open(urlStr,'DiamondCMSImageBrowser','width=600,height=400,menubar=no,resizeable=no,scrollbars=yes');

    window.tinyMCE_field = field_name;
    window.document.tinyMCE_field = field_name;
    win.tinyMCE_field = field_name;

    imageBroswerWin.focus()
}

tinyMCE.init(dia_tinyMCE_Conf);
