function myFileBrowser(field_name, url, type, win) {

    //alert("Field_Name: " + field_name + "\nURL: " + url + "\nType: " + type + "\nWin: " + win); // debug/testing

    //var cmsURL = window.location.pathname;
    // script URL
    var cmsURL = '/medias/browser';

    if(tinyMCE.selectedInstance == undefined) {
        tinyMCE.execInstanceCommand('mce_editor_0','mceImage',true);
        }

    tinyMCE.openWindow({
        file : cmsURL, // PHP session ID is now included if there is one at all
        title : "File Browser",
        width : 640,  // Your dimensions may differ - toy around with them!
        height : 400,
        close_previous : "no"
    }, {
        window : win,
        input : field_name,
        scrollbars : "yes",
        resizable : "yes",
        inline : "yes"  // This parameter only has an effect if you use the inlinepopups plugin!
        //editor_id : tinyMCE.selectedInstance.editorId
    });
    return false;
}

tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    //theme_advanced_styles: "Styled Text=text;Extra Bold=text_bold_extra;Bold=text_bold;Light Blue Bold=text_bold_lightblue;Bold Blue=text_bold_blue;Link=link;Blue Link=link_blue;Green Link=link_green;Red Link=link_red;Light Blue Link=link_lightblue;Bold Link=link_bold;Text Header=textheader;Header1=header1;Header2=header2;Header3=header3;Header4=header4;Link Nav=linkNav",
    plugins : "table",
    cleanup_on_startup : false,
    cleanup : false,
    remove_linebreaks : false,
    force_p_newlines : false,
    force_br_newlines: false,

    theme_advanced_buttons3_add : "tablecontrols",
    theme_advanced_toolbar_align : "left",
    //valid_elements: "*",
    extended_valid_elements: "*",
    invalid_elements: "iframe",
    file_browser_callback : "myFileBrowser"
});


