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();
	}
	
	
	// Row 1
	var adv_row_one =  "fontselect,fontsizeselect,separator,backcolor,forecolor,separator,";

	// Row 2
	var adv_row_two =  "selectall,cut,copy,paste,pastetext,separator,search,replace,separator,";
		adv_row_two += "bullist,numlist,outdent,indent,separator,undo,redo,separator,";
		adv_row_two += "link,unlink,anchor,separator,separator,image,separator,separator,charmap,insertdate,inserttime,hr,media,";
		adv_row_two += "separator,separator,separator,preview,fullscreen,separator,separator,separator,cleanup,styleprops,code";

	// Row 3
	var adv_row_three 	=  "table,tablecontrols";
	
	// Extended Elements
	var adv_extra_elms	=  "iframe[*],hr[class|width|size|noshade|style],";
	adv_extra_elms		+= "a[class|name|href|target|title|rel|style|onclick]";
	
	// Invalid Elements
	var adv_invalid_elms = "link,javascript,script";
	
	// Start
	tinyMCE.init({
		mode : "exact",
		elements : $str_MCE_ID,
		theme                              	: "advanced",
		skin								: "cirkuit",
		width                              	: $width,
		height                             	: $height,
		
		plugins                            	: $use_fullpage + "table,advimage,advlink,emotions,insertdatetime,preview,searchreplace,paste,contextmenu,style,media,fullscreen",
		
		theme_advanced_buttons1_add			: adv_row_one, // add on top
		theme_advanced_buttons2				: adv_row_two, // re-done from scratch
		theme_advanced_buttons3				: $use_fullpage + adv_row_three, // re-done from scratch
		
		extended_valid_elements				: adv_extra_elms,
		invalid_elements					: adv_invalid_elms, 
		valid_children 						: "+body[style]",
		
		theme_advanced_toolbar_location    	: "top",
		theme_advanced_toolbar_align       	: "left",
		theme_advanced_statusbar_location  	: "bottom",
		theme_advanced_resizing            	: true,
		theme_advanced_resize_horizontal   	: false,

		plugin_insertdate_dateFormat       	: "%Y-%m-%d",
		plugin_insertdate_timeFormat       	: "%H:%M %p",
		
		file_browser_callback              	: "fileBrowserCallBack",

		paste_use_dialog                   	: true,
		visual 								: true,
		apply_source_formatting           	: true,
		relative_urls 					   	: false, 
		remove_script_host 				   	: $strip_hostname_from_image_links,
		content_css 					   	: $content_css 
		
		
	});
		
	
	
	
}


