
// Variable to check on load
var e2s_tinymce_loaded = true; 

// Constructor for setting up tinymce for "mceEditor" class dom objects
tinyMCE.init({
	// Location of TinyMCE script
	script_url : "../WebControls/tinymce/tiny_mce.js",
	// General options
	mode : "specific_textareas",
	editor_selector : "mceEditor",
	theme : "advanced",
	plugins : "pagebreak,style,layer,table,inlinepopups,insertdatetime,preview,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
	force_p_newlines : false,
	forced_root_block : '',
	// Theme options
	theme_advanced_buttons1 : "code,|,bold,italic,underline,strikethrough,|,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,fontselect,fontsizeselect,",
	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup",
	theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,|,fullscreen",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true
});	

// Method for setting up editor using jquery
function SetupHtmlEditor(idOfTextarea) {
	var $editor = $(idOfTextarea).tinymce({
			// Location of TinyMCE script
			script_url : "../WebControls/tinymce/tiny_mce.js",
			// General options
			theme : "advanced",
			plugins : "pagebreak,style,layer,table,inlinepopups,insertdatetime,preview,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
			force_p_newlines : false,
			forced_root_block : '',
			// Theme options
			theme_advanced_buttons1 : "code,|,bold,italic,underline,strikethrough,|,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,fontselect,fontsizeselect,|,attribs,visualchars,nonbreaking",
			theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup",
			theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,|,ltr,rtl,|,fullscreen",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : true
		});	
		
	return $editor;
}

// OBSOLETE: Use JQ DOM to init editors using class: mceEditor
// $(document).ready(function() {
//		$('textarea.mceEditor').each( function() {
//		SetupHtmlEditor($(this));
//		});
// });

