<script src="<%static_url%>/js/utils.js"></script>
<script src="<%static_url%>/js/spellcheck.js"></script>
<script src="<%static_url%>/js/editor.js"></script>
<script>
<%include utils.js%>
var sc = new spellCheck('sc');
sc.config.imageURL        = "<%image_url%>/pics";
sc.config.addPermission   = true;
sc.config.menuMaxRows     = <%if suggested_word_num%><%suggested_word_num%><%else%>10<%endif%>
sc.config.addWord         = 'msg_addword';
sc.config.disableElements = [
  'button_attach',
  'button_mode',
  'button_text',
  'button_create',
  'button_reset',
  'url_switch'
];
<%if emode eq 'html' or emode eq 'multi'%>
  <%if ie_version < 5.5 and mozilla_version < 1.4%>
      <%set editor_advanced = 0%>
  <%endif%>
<%elsif emode eq 'text'%>
   <%set editor_advanced = 0%>
<%endif%>

<%if editor_advanced%>
var ae = new advancedEditor('ae');
ae.config.imageURL    = "<%image_url%>/toolbar";
ae.config.baseURL     = "<%cgi_url%>/glist.cgi?do=msg_page;t=common;pg=";
ae.config.extraURL    = "<%hidden_query%>";

ae.names.editorForm    = 'myform';
ae.names.contentObject = 'msg_content_html'; 

ae.deleteCommand(['normal', 'form', 'sep7']);
ae.deleteCommand((isIE ? 'sep0' : 'sep1'));

ae.toolbar['image'][0] = 'showDialog("editor_image.html", 380, 120)';

sc.names.checkContent = 'msg_content_html';
sc.editor = ae;
<%else%>
sc.names.checkContent = "<%if emode eq 'text'%>msg_content_text<%else%>msg_content_html<%endif%>";
<%endif%>

<%if emode eq 'multi'%>
sc.names.checkContent = ['msg_content_html', 'msg_content_text'];
sc.names.checkResult  = ['result_spellcheck', 'result_spellcheck2'];
sc.isMultiple         = true;
<%endif%>

var old = window.onload;
window.onload = function () {
  if (old) old();
  if (typeof(ae) == 'object') ae.load();
  sc.load();
}
</script>
