<!--//

	tinyMCE.init({
		mode : "none",
		theme : "advanced",
		theme_advanced_disable: "justifyfull,separator,undo,redo,cleanup,numlist,sub,sup,formatselect,underline,strikethrough,help,hr,fontselect,fontsizeselect,styleselect,forecolor,backcolor,forecolorpicker,backcolorpicker,visualaid,anchor,newdocument",
		theme_advanced_buttons1 : "bold,italic,underline,justifyleft,justifycenter,bullist,outdent,indent,image,charmap",
		theme_advanced_buttons2 : "",
		theme_advanced_buttons3 : "",		
		relative_urls : false,
		remove_script_host : false,
		plugins : "fullscreen",
		theme_advanced_buttons1_add : "fullscreen",
		file_browser_callback : 'imageBrowser'
	});
	
	function toggleEditor(id) {
		var elm = document.getElementById(id);
	
		if (tinyMCE.getInstanceById(id) == null){
			tinyMCE.execCommand('mceAddControl', false, id);
			tinyMCE.execCommand('mceFocus',false,id);
		}else{
			tinyMCE.execCommand('mceRemoveControl', false, id);
		}
	}
	
	function open_dialogue(param_pk_traveller_id) {
		win = window.open('/admin/dialogue/default.php?fk_traveller_uid=' + param_pk_traveller_id,'dialogue','toolbars=no,scrollbars=no,location=no,statusbars=no,menubars=no,resizable=no,width=500,height=500,left=50,top=50);');
	}
	
	function imageBrowser(field_name, url, type, win) {
	
		// alert("Field_Name: " + field_name + "\nURL: " + url + "\nType: " + type + "\nWin: " + win); // debug/testing
		
		var fileBrowserWindow = new Array();
		
		/* If you work with sessions in PHP and your client doesn't accept cookies you might need to carry
		   the session name and session ID in the request string (can look like this: "?PHPSESSID=88p0n70s9dsknra96qhuk6etm5").
		   These lines of code extract the necessary parameters and add them back to the filebrowser URL again. */
		
		var cmsURL = "/admin/plugins/image_picker/list_images.php";      // script URL
		var searchString = window.location.search;  // possible parameters
		if (searchString.length < 1) {
			// add "?" to the URL to include parameters (in other words: create a search string because there wasn't one before)
			searchString = "?";
		}
		
		fileBrowserWindow["file"] = cmsURL + searchString + "&type=" + type; // PHP session ID is now included if there is one at all
		
		fileBrowserWindow["title"] = "File Browser";
		fileBrowserWindow["width"] = "500";
		fileBrowserWindow["height"] = "390";
		fileBrowserWindow["close_previous"] = "no";
		tinyMCE.openWindow(fileBrowserWindow, {
		  window : win,
		  input : field_name,
		  resizable : "yes",
		  inline : "yes"
		});
		return false;
	}

//-->