EDITOR.tinymce_ready=function(){
	$(function(){
		$("textarea.tiny_mce_editor").tinymce({
			script_url:CORE.site_path+'addons/tiny_mce/tiny_mce.js',
			language:CORE.language.substr(0,2),
			mode:"specific_textareas",
			theme:"advanced",
			plugins:"safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
			theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontsizeselect",
			theme_advanced_buttons2 : "link,unlink,anchor,|,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,sub,sup,|,forecolor,backcolor",
			theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,insertdate,inserttime,iespell",
			theme_advanced_buttons4 : "code,fullscreen,newdocument,cleanup,|,blockquote,cite,abbr,acronym,del,ins,|,nonbreaking,pagebreak,|,charmap,emotions,|,image,media",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : true,
			theme_advanced_styles : "Style 1=style1;Style 2=style2;Style 3=Style3;Small=small",
			setup:function(tiny)
			{
				EDITOR.New(
					tiny.id,
					{
						Embed:function(type,data)
						{
							if(type=="image" && data.src)
								tiny.selection.setNode(tiny.dom.create("img",data));
							else if(type=="nick" && data.name)
								tiny.selection.setContent("<b>"+data.name.replace(/</g,"&lt;").replace(/>/g,"&gt;")+"</b>, ");
						},
						Insert:function(pre,after,F)
						{
							var text=tiny.selection.getContent();
							if($.isFunction(F))
								text=F(text);
							tiny.selection.setContent(pre+text+after);
						},
						Get:function(){ return tiny.getContent(); },
						Set:function(text){ tiny.setContent(text); },
						Selection:function(){ return tiny.selection.getContent(); },
					}
				);
				tiny.onActivate.add(function(){EDITOR.Active(tiny.id)});
			}
		});
	});
}