/*----------------------------------------------------------	AMAN_RedSYS(R) - Fileinfo:	$Author: michael $	$Source: /home/cvs/redsys/content/htmlarea/htmlarea-redsys-bindings.js,v $	$Revision: 1.14 $	Copyright (c) AMAN Media GmbH 1997 - 2005	http://www.aman.de | http://www.redsys.de---------------------------------------------------------*/// global var for current editorvar edit = null;var htmlarea_editors = new Array();var htmlarea_names = new Array();var htmlarea_stylesheet = new Array();var htmlarea_preset = new Array();var htmlarea_configs = new Array();var htmlarea_plugins = ['TableOperations','ListType','ContextMenu','CharacterMap','FullScreen','InsertAnchor',												'HtmlTidy','Stylist','FindReplace','Abbreviation','QuickTag'];function makeConfig(style,preset) {  // create configuration object  config = new HTMLArea.Config();// Mediadb and Linkman buttonsconfig.registerButton({  id        : "linkmanager",  tooltip   : "Linkmanager",  image     : _editor_url + "images/ed_link.gif",  textMode  : false,  action    : function(editor, id) {                edit=editor;                openwin('popups/system_linkman_new.php?lm[types]=<?=urlencode("file:,ftp:,gopher:,http:,https:,mailto:,news:,telnet:,wais:") ?>&callback=main.insert_link',800,550,'resizable=1,scrollbars=1,status=yes');              }});config.registerButton({  id        : "mediamanager",  tooltip   : "MediaManager",  image     : _editor_url + "images/ed_mediamanager.gif",  textMode  : false,  action    : function(editor, id) {		edit=editor;                openwin('popups/system_media_popup_new.php?show=popup&data[callback_func]=main.insert_media',1000,680,'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizeable=0')              }});  // Toolbar config  if (preset=='miniEditor') {	  config.toolbar = [[ "bold", "italic", "underline", "separator",			      "space",			      "linkmanager", "mediamanager","htmlmode" ]			  ];  } else if (preset=='simpleEditor') {		config.toolbar = [[ "undo", "redo", "separator", "bold", "italic", 									"underline", "separator", "subscript", "superscript", "space", "separator",									"linkmanager", "mediamanager", "separator","htmlmode" ]									];  } else {		config.toolbar = [[ "undo", "redo", "separator","unorderedlist", 									"orderedlist", "outdent", "indent", "separator", "justifyleft", "justifycenter", "justifyright", 									"justifyfull", "separator", "bold", "italic", "underline", "separator", "subscript", 									"superscript", "space", "separator", "inserthorizontalrule", "linkmanager", "mediamanager", "inserttable",									"separator", "htmlmode","wordclean","clearfonts","removeformat","toggleborders","killword" ]									];  }	config.flowToolbars = true;  // Css//  config.pageStyle = "@import url('"+style+"');";//	config.pageStyleSheets = [style,_editor_url+"helper.css"];  config.stylistLoadStylesheet(style);  if (HTMLArea.is_gecko)		config.panel_dimensions =	  {	    left:   '200px', // Width	    right:  '200px',	    top:    '100px', // Height	    bottom: '100px'	  }		else {		config.panel_dimensions =	  {	    left:   '100px', // Width	    right:  '100px',	    top:    '100px', // Height	    bottom: '100px'	  }		}	config.baseHref = _baseHref;  return config;}function preReplaceArea(id,stylesheet,preset) {	htmlarea_names.push(id);	htmlarea_stylesheet.push(stylesheet);	htmlarea_preset.push(preset);}function replaceArea() {  if (!HTMLArea.loadPlugins(htmlarea_plugins,replaceArea)) return;	for (var i=0; i < htmlarea_names.length; i++) {		var plugins = null;	  	  if (htmlarea_preset[i]=='fullEditor') {	    plugins = ['TableOperations','ListType','ContextMenu','CharacterMap','FullScreen','InsertAnchor','Stylist',	    						'FindReplace','Abbreviation','QuickTag'];	  }	  else if (htmlarea_preset[i]=='normalEditor') {	    plugins = ['ListType','ContextMenu','CharacterMap','FullScreen','InsertAnchor','Stylist','QuickTag'];	  }	  else	  	plugins = [];	  if (_tidy_prg != "")	  	plugins.push('HtmlTidy');		htmlarea_configs[i] = makeConfig(htmlarea_stylesheet[i],htmlarea_preset[i]);    htmlarea_editors[i] = new HTMLArea(htmlarea_names[i], htmlarea_configs[i]);	  //register Plugins	  htmlarea_editors[i].registerPlugins(plugins);	}		for (var i=0; i < htmlarea_names.length; i++) {		if (htmlarea_editors[i]) {			htmlarea_editors[i].generate();		}	}}function insert_link(link) {  // Linkmanager check  if ( link != '') {    // is something selected ?    if (edit.getSelectedHTML()!='') {      // make a link      var end_link=link.indexOf("Link");      edit.surroundHTML(link.substr(0,end_link),'</a>');    } else {      // insert linked "LINK"      edit.insertHTML(link);    }   }}function insert_media(insert,prefix,suffix) {  if (insert!='')    edit.insertHTML(insert);  if (prefix!='') {    // is something selected ?    if (edit.getSelectedHTML()!='') {      // make a link      edit.surroundHTML(prefix,suffix);    } else {      // insert      edit.insertHTML(prefix + 'Medialink' + suffix);    }  }}
