tinyMCE.init({
  mode                            : "textareas",
  theme                           : "advanced",
  editor_selector                 : "mceEditor",
  plugins                         : "table",
  theme_advanced_toolbar_location : "top",
  theme_advanced_buttons1         : "undo,redo,separator,bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,formatselect",
  theme_advanced_buttons2         : "link,unlink,anchor,hr,charmap,separator,tablecontrols,image,code",
  theme_advanced_buttons3         : "",
  theme_advanced_layout_manager   : "SimpleLayout",
  remove_script_host              : false,
  relative_urls                   : false,
  apply_source_formatting         : true,
  file_browser_callback           : 'imagePicker',
  extended_valid_elements         : 'map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],'
                                  + 'area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|shape<circle?default?poly?rect|style|tabindex|title|target],'
				  +"object[align<bottom?left?middle?right?top|archive|border|class|classid"
  					+"|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name"
    					+"|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
      					+"|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap"
        				+"|vspace|width],"
				  +"param[id|name|type|value|valuetype<DATA?OBJECT?REF],"
				  +"embed[src|type|allowscriptaccess|allowfullscreen|width|height],"

});

var imceBrowserURL = "/imgList.php";
var imceRefererWin, imceRefererField, imceRefererType, imceRefererURL;
function imagePicker(field_name, url, type, win) {
  //if (type!='image') return;//work for only images
  var imcePopup = window.open(imceBrowserURL, '', 'width=640, height=560, resize=1, scrollbars=1');
  imcePopup.focus();
  imceRefererWin = win;
  imceRefererField = win.document.forms[0].elements[field_name];
  imceRefererType = type;
  imceRefererURL = url;
}
