function fileBrowserCallBack(field_name, url, type, win) {
	// due to mcpuk bug with firefox please tiny the absolute path to the connector, something like:
	// var connector = "http://localhost/tinymcpuk/filemanager/browser.html?Connector=http://localhost/tinymcpuk/filemanager/connectors/php/connector.php";
	var connector = "/common/js/external/tinyMCPUK/filemanager/browser.html?Connector=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;
	}
	
	return window.open(connector, "tinymcpuk", "modal,width=600,height=400,resizable=yes");
}


//
//Newsletter: $strip_hostname_from_image_links = false
//
//relative_urls 		: false,  //start img links with a slash (abs)
//use_fullpage			for newsletters to include all the body tags etc
//
function fncInitTinyMCE_ByID($str_MCE_ID, $width, $height, $strip_hostname_from_image_links, $use_fullpage){
	
	if ( $str_MCE_ID === undefined ) {
		alert('Pass fncInitTinyMCE_ByID a textarea ID');
		return;
	}

	if ( $width === undefined ) {
		$width = '100%';
	}

	if ( $height === undefined ) {
		$height = '400';
	}
	
	if ( $strip_hostname_from_image_links === undefined ) {
		$strip_hostname_from_image_links = true;
	}
	
	
	var $content_css = '';
		
	if ( $use_fullpage === undefined ) {
		$use_fullpage = '';
		$content_css  = '/common/ajax/back/modules/csseditor/wysiwyg_css_view.php?use_fullpage=undefined&refresh=' + new Date().getTime();
	}
	else if( $use_fullpage == true ){
		$use_fullpage = 'fullpage,';
		
	}
	else if( $use_fullpage == false ){
		$use_fullpage = '';
		$content_css  = '/common/ajax/back/modules/csseditor/wysiwyg_css_view.php?use_fullpage=false&refresh=' + new Date().getTime();
	}
	
	
	//	extended_valid_elements            : "*[*]", 
	
	tinyMCE.init({
		mode : "exact",
		elements : $str_MCE_ID,
		
		theme                              : "advanced",
		width                              : $width,
		height                             : $height,
		plugins                            : $use_fullpage + "table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,searchreplace,print,paste,directionality,fullscreen,noneditable,contextmenu,style",
		theme_advanced_buttons1_add_before : "selectall",
		theme_advanced_buttons1_add        : "fontselect,fontsizeselect,styleprops",
		theme_advanced_buttons2_add        : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor,liststyle",
		theme_advanced_buttons2_add_before : "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
		theme_advanced_buttons3_add_before : $use_fullpage + "tablecontrols,separator",
		theme_advanced_buttons3_add        : "emotions,iespell,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
		theme_advanced_toolbar_location    : "top",
		theme_advanced_toolbar_align       : "left",
		theme_advanced_statusbar_location  : "bottom",
		plugin_insertdate_dateFormat       : "%Y-%m-%d",
		plugin_insertdate_timeFormat       : "%H:%M:%S",
		extended_valid_elements            : "iframe[*],style[*],div[*],a[class|name|href|target|title|rel|style|onmouseover|onmouseout],img[class|src|border=0|alt|title|rel|hspace|vspace|width|height|align|name|style|onmouseover|onmouseout],hr[class|width|size|noshade|style],span[class|align|style]",
		file_browser_callback              : "fileBrowserCallBack",
		paste_use_dialog                   : false,
		theme_advanced_resizing            : true,
		theme_advanced_resize_horizontal   : false,
		apply_source_formatting            : true,
		relative_urls 					   : false, 
		remove_script_host 				   : $strip_hostname_from_image_links,
		content_css 					   : $content_css 
	});
		
}

