﻿
function tinyMCEInit() {
    tinyMCE.init({
        mode: "textareas",
        theme: "advanced",
        plugins: "advlink,table",
        height: "400",
        theme_advanced_buttons1: "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,undo,redo,|,cleanup,|,code",
        theme_advanced_buttons2: "formatselect,|,bullist,numlist,|,link,unlink,anchor,|,image,",
        theme_advanced_buttons3: "tablecontrols",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        extended_valid_elements: "a[name|href|target|title|onclick|id|class|style],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style|rel|alt],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style|id]",
        relative_urls: true,
        document_base_url: RM_DOCUMENT_BASE_URL,
        forced_root_block: false,
        force_br_newlines: false,
        force_p_newlines: false,
        theme_advanced_statusbar_location: "none",
        content_css: RM_BASEURL + TINYMCE_CSS,
        table_cell_styles: "Colored Text Center Bold=textCenterBold",
        table_row_styles: "Odd Row=oddRow",

        file_browser_callback: "ProPayFileBrowser"
    });
}
// 
//    table_styles: "Table Class=standard",

//    theme_advanced_buttons3: "separator,strikethrough,justifyleft,preview",
// theme_advanced_statusbar_location: "bottom",




 function ProPayFileBrowser (field_name, url, type, win) {

//    alert("Field_Name: " + field_name + "\nURL: " + url + "\nType: " + type + "\nWin: " + win); // debug/testing

    /* If you work with sessions in PHP and your client doesn't accept cookies you might need to carry
       the session name and session ID in the request string (can look like this: "?PHPSESSID=88p0n70s9dsknra96qhuk6etm5").
       These lines of code extract the necessary parameters and add them back to the filebrowser URL again. */

    /* Here goes the URL to your server-side script which manages all file browser things. */

    var fileBrowserPage = RM_BASEURL + "Admin/media/Browser.aspx";

/*    
    var searchString = window.location.search; // possible parameters
    if (searchString.length < 1) {
        // add "?" to the URL to include parameters (in other words: create a search string because there wasn't one before)
        searchString = "?";
    }
*/

    // newer writing style of the TinyMCE developers for tinyMCE.openWindow


      tinyMCE.activeEditor.windowManager.open({
//    tinyMCE.openWindow({
        file : fileBrowserPage,
        title : "File Browser",
        width : 885,  // Your dimensions may differ - toy around with them!
        height : 565,
        close_previous : "no"
    }, {
        window : win,
        input : field_name,
        resizable : "yes",
        inline : "yes",  // This parameter only has an effect if you use the inlinepopups plugin!
        editor_id : tinyMCE.selectedInstance.editorId
    });


    return false;
    
    
  }
