tinyMCE.init({
    theme : "advanced",
    mode: "exact",
    elements : "contentEditor",
	plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,imagemanager",
	theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview",
	theme_advanced_buttons3 : "forecolor,backcolor,|,tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,insertimage,media,advhr",
	theme_advanced_buttons4 : "print,|,ltr,rtl,|,fullscreen,|,insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",

	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,
	
	document_base_url : "http://bart.tweaking.nl/",
	content_css : "./css/editor.css",

        height:"500px",

        //Mad File Manager
        relative_urls : false,
        file_browser_callback : "MadFileBrowser"
 });
 
function MadFileBrowser(field_name, url, type, win) {
  tinyMCE.activeEditor.windowManager.open({
      file : "scripts/mfm.php?field=" + field_name + "&url=" + url + "",
      title : 'File Manager',
      width : 640,
      height : 450,
      resizable : "no",
      inline : "yes",
      close_previous : "no"
  }, {
      window : win,
      input : field_name
  });
  return false;
}
 
 function changeTtP(obj) {
	var input = obj.cloneNode(false);
	var w = obj.offsetWidth;
	input.type = 'password';
	input.value = '';
	
	obj.parentNode.replaceChild(input, obj);
	input.style.width = (w-3)+'px';
	setTimeout(function(){
		input.focus();
	}, 10);
 }

