// configuration
HTMLArea.loadPlugin("CSS");
HTMLArea.loadPlugin("ContextMenu");
HTMLArea.loadPlugin("TableOperations");
function initDocument() {
	if( document.getElementById( "editor" ) == null ) { return; } 
	var editor = new HTMLArea( "editor" );

	editor.config.pageStyle = "@import url(/style.css);";
	editor.config.toolbar = [
		[ "fontname", "space", "fontsize", "space", "formatblock", "space", "textindicator", "bold", "italic", "underline",
		  "separator", "copy", "cut", "paste", "space", "undo", "redo" ], 
		[ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator", "insertorderedlist",
		  "insertunorderedlist", "outdent", "indent", "separator", "strikethrough", "subscript", "superscript",
			  "separator","forecolor", "hilitecolor",
			  "separator", "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode" ]
		];

	editor.config.formatblock = {
                "Heading 1": "h1",
                "Heading 2": "h2",
                "Normal": "p",
                "Address": "address",
                "Formatted": "pre"
	};

	var css_plugin_args = {  
		combos : [ { 
       		      		options: { 
				 "None"		 : "",
				 "Body Default"  : "pageBody",  
				 "Body Small"    : "pageBodySmall",  
				 "Errors"        : "errors",
       				 "Page Header"   : "pageTitle",  
       				 "Table Header"  : "tableHeader",
       				 "Highlight"     : "highlight",
				 "Footer"        : "footer"
       			       	}  
		} ]  
       	};  

	editor.registerPlugin( CSS, css_plugin_args );
	editor.registerPlugin( ContextMenu );
	editor.registerPlugin( TableOperations );

	editor.generate( );
}
