function tinyMCEInitialization(){
	tinyMCE.init({
		// General options
		mode : "specific_textareas",
		editor_selector : "mceEditor",
		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 options
		theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,insertdate,inserttime,|,forecolor,backcolor",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,code",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen",
		theme_advanced_buttons4 : "styleselect,formatselect,fontselect,fontsizeselect,|,help,ibrowser",
		
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		file_browser_callback : "fileBrowserCallBack",
		relative_urls : false, //отключаем конвертирование ссылки
	});
}

function tinyMCEInitializationSimple(){
	tinyMCE.init({
		// General options
		mode : "specific_textareas",
		editor_selector : "mceEditor",
		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,preview",

		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,forecolor,backcolor,|,hr,fullscreen",
		theme_advanced_buttons2 : "pasteword,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,cleanup,code",
		theme_advanced_buttons3: false,
		
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_resizing : true,
		relative_urls : false, //отключаем конвертирование ссылки
	});
}

function tinyMCEInitializationComment(id){
	tinyMCE.init({
		// General options
		mode : "specific_textareas",
		editor_selector : "comment"+id,
		theme : "advanced",

//		// Theme options
		theme_advanced_buttons1 : false,
		theme_advanced_buttons2 : false,
		theme_advanced_buttons3 : false,
		theme_advanced_toolbar_location: false,
		relative_urls : false, //отключаем конвертирование ссылки
	});
}

function fileBrowserCallBack(field_name, url, type, win) {
	var connector = "../../filemanager/browser.html?Connector=connectors/php/connector.php";
	var enableAutoTypeSelection = true;

	var cType;
	tinyfck_field = field_name;
	tinyfck = win;

	switch (type) {
		case "image":
		cType = "Image";
		break;
		case "flash":
		cType = "Flash";
		break;
		case "file":
		cType = "File";
		break;
	}

	if (enableAutoTypeSelection && cType) {
		connector += "&Type=" + cType;
	}

	window.open(connector, "tinyfck", "modal,width=600,height=400");
}