
tinyMCE.init({
	theme : "advanced",
	plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,media,searchreplace,print,contextmenu,paste,directionality,fullscreen",
	theme_advanced_buttons1_add_before : "save,newdocument,separator",
	theme_advanced_buttons1_add : "fontsizeselect",
	theme_advanced_buttons2_add : "separator,forecolor,backcolor",
	theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator",
	theme_advanced_buttons3_add_before : "tablecontrols,separator",
	theme_advanced_buttons3_add : "emotions,media,advhr",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	plugi2n_insertdate_dateFormat : "%Y-%m-%d",
    	plugi2n_insertdate_timeFormat : "%H:%M:%S",
	paste_use_dialog : false,
	theme_advanced_resizing : true,
	theme_advanced_resize_horizontal : false,
	theme_advanced_link_targets : "_something=My somthing;_something2=My somthing2;_something3=My somthing3;",
	paste_auto_cleanup_on_paste : true,
	paste_convert_headers_to_strong : false,
	paste_strip_class_attributes : "all",
	paste_remove_spans : false,
	paste_remove_styles : false,	
	file_browser_callback : "fileBrowserCallBack",
	apply_source_formatting : true,
	remove_linebreaks : false
});


function fileBrowserCallBack(field_name, url, type, win) {

	if((field_name=='href')&&(type=='file')){
		// Link Browser
		var connector = sitepath + "plugins/tiny_mcpuk/filemanager/linkbrowser.php?win=" + win.name;
		tinymcpuk_field = field_name;
		tinymcpuk = win;
		window.open(connector, "tinymcpuk", "modal,width=600,height=400,top=200,left=200");
	}else{
		// Image Browser
		var connector = sitepath + "plugins/tiny_mcpuk/filemanager/browser.html?Connector=" + sitepath + "plugins/tiny_mcpuk/filemanager/connectors/php/connector.php";
		var enableAutoTypeSelection = true;
		var cType;
		tinymcpuk_field = field_name;
		tinymcpuk = 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, "tinymcpuk", "modal,width=600,height=400");
	}
}

