tinyMCE.init({
language : 'ru',
docs_language : 'ru',
width: '458px',
height: '400px',
disk_cache : false,

//popup_css: false,
plugins : "bbcode,media,emotions,advimage,advlink,autosave,myload",
						//emotions_images_url : '/img/emotions/',
mode : "exact",
entity_encoding : "raw",
theme : "advanced",
skin : "o2k7",
elements : "link_content",
//skin_variant : "silver",
theme_advanced_layout_manager: "SimpleLayout",
//theme_advanced_buttons1: "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,fontselect,fontsizeselect,forecolor,bulllist,numlist,link,unlink,image,separator,removeformat,cleanup,separator,emotions",
theme_advanced_buttons1: "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,forecolor,bulllist,numlist,link,unlink,separator,removeformat,cleanup,separator,emotions,myload",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
//							fontselect,fontsizeselect,forecolor,bullist,numlist,link",
//							theme_advanced_buttons2: "tablecontrols",
//							theme_advanced_buttons3: "",
//							theme_advanced_disable : "bullist,numlist,link,styleselect,formatselect,indent,outdent,undo,redo,anchor,help,code,unlink,removeformat,sub,sup,hr,charmap,visualaid,image,cleanup,strikethrough",
theme_advanced_disable : "bullist,numlist",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align: "left",

table_styles : "Header 1=header1;Header 2=header2;Header 3=header3",
table_cell_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Cell=tableCel1",
table_row_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1",
table_cell_limit : 100,
table_row_limit : 5,
table_col_limit : 5,
force_br_newlines: "false",
remove_linebreaks : false,
convert_fonts_to_spans : true,
relative_urls : false,
file_browser_callback : "ajaxfilemanager"
});

/*
var w = window;
if(w.addEventListener) {
	w.addEventListener('load', add_edit, false);
	}
else if(w.attachEvent) {
	w.attachEvent('onload', add_edit);
	}


function add_edit () {

		tinyMCE.execCommand('mceToggleEditor',false,'link_content');

}
*/
function ajaxfilemanager(field_name, url, type, win) {
	var ajaxfilemanagerurl = "http://demo.phpletter.com/ajaxfilemanager/ajaxfilemanager.php?editor=tinymce";
	switch (type) {
		case "image":
			break;
		case "media":
			break;
		case "flash": 
			break;
		case "file":
			break;
		default:
			return false;
	}
	var fileBrowserWindow = new Array();
	fileBrowserWindow["file"] = ajaxfilemanagerurl;
	fileBrowserWindow["title"] = "Ajax File Manager";
	fileBrowserWindow["width"] = "782";
	fileBrowserWindow["height"] = "440";
	fileBrowserWindow["close_previous"] = "no";
	tinyMCE.openWindow(fileBrowserWindow, {
	  window : win,
	  input : field_name,
	  resizable : "yes",
	  inline : "yes",
	  editor_id : tinyMCE.getWindowArg("editor_id")

			});
			
			return false;
}

function toggle_html(obj)
{
	obj.innerHTML = (obj.innerHTML != 'HTML') ? 'HTML' : 'Визуальный редактор';
}


function change_blog_name(obj) {
			link_name = document.getElementById('link_name');
			if(link_name)
			{
				link_name.style.display = (obj.options[obj.selectedIndex].value) ? 'none' : 'block';
				link_name.value = (obj.options[obj.selectedIndex].value) ? '' : link_name.value;
			}
		}

