// find richeditor id
var script = document.getElementsByTagName('script');
var x, attr, check_init;
for (x=0; x < script.length; x++){
  attr = script[x].getAttribute('src');
  check_init = attr.indexOf('init.full.js?');
  if ( check_init >= 0 ){
    elm = attr.substring(check_init+13, attr.length);
    break;
  }
}

tinyMCE.init({
		// General options
		mode : "exact",
    elements : elm,
		theme : "advanced",
		//plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

		// Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink",
		theme_advanced_buttons3 : "|,bullist,numlist,|,outdent,indent,blockquote,insertdate,inserttime,preview,|,forecolor,backcolor,|,sub,sup,|,charmap,emotions,advhr",
    theme_advanced_buttons2 : "|,fontselect,fontsizeselect,image,media,cleanup,code,anchor",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
    width : "300",
		
		// Replace values for the template plugin
		template_replace_values : {
			//username : "",
			//staffid : ""
		}
	});