tinyMCE.init({
	mode : "textareas",
	language : tinyMCELocale,
	theme : "advanced",
	plugins : "autosave,inlinepopups,table,advimage,advlink,emotions,preview,media,searchreplace,paste,xhtmlxtras,spellchecker",
	theme_advanced_buttons1 : "bold,italic,underline,indent,outdent,separator,bullist,numlist,link,unlink,separator,emotions,image,media,|,forecolor,fontselect,fontsizeselect,|,pasteword,code,preview,spellchecker",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	plugin_preview_width : "250",
	plugin_preview_height : "350",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "none",
	extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap|style],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],iframe[src|width|height|name|align]",
	file_browser_callback : "fileBrowserCallBack",
	editor_deselector : "mceNoEditor",
	theme_advanced_resize_horizontal : false,
	theme_advanced_resizing : true,
	nonbreaking_force_tab : true,
	apply_source_formatting : true,
	content_css : ".." + siteTheme + "/css/spigitstyle.css",
	gecko_spellcheck : true,
	spellchecker_word_separator_chars: '\\s',
	spellchecker_rpc_url : "/Core/SpellCheckerServlet",
	spellchecker_languages : "+English=en",
	convert_urls : 0,
	relative_urls : 0,
	media_strict : false
});

function fileBrowserCallBack(field_name, url, type, win) {
	var resourceDir = "http://localhost:8088/resources/files";
	var connector = "/User/Resources?Callback=openFile&Connector=" + resourceDir;
	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, scrollbars=yes");
}
