init#editfield#editor=function(#primarykey#,st){

	xajxjs('tinyMCE','tiny_mce/mceloader.js',function(){
	
		tinyMCE.init({
			protect: [/[\n\f\r\t\v]/g],
			mode : "textareas",
			theme : "advanced",
			plugins: 'paste, advimage',
			theme_advanced_buttons1:"image,medialib,layout_youtube,|,bold,italic,underline,strikethrough,|,forecolor,backcolor,|,bullist,numlist,|,outdent,indent,blockquote,|,link,unlink",
			//theme_advanced_buttons2:"fontselect,fontsizeselect,|,justifyleft,justifycenter,justifyright,justifyfull,|,sourceedit",
			theme_advanced_buttons2:"objects,noamp,layout_headline,layout_col2,layout_colside_right,|,sourceedit,removeformat",
			editor_selector:'#editfield#editor_'+#primarykey#,
			extended_valid_elements : 'img[class|ampwidth|ampheight|src]',
			paste_preprocess:function(pl,o){paste_clean_image(o);},		
			height:300,
			content_css:'tiny_mce/editor.css?v='+hb(),
			init_instance_callback:function(ed){
				if (st!=null) setTimeout(function(){ed.getBody().scrollTop=st;},300);
				ed.getDoc().showqna=function(){}; //declare null function
			},			
			setup: function(ed) {
				ed.onChange.add(function(){marktabchanged('#record#_'+#primarykey#)});
				ed.onMouseUp.add(lookupselection(ed));
				ed.addButton('medialib',{title:'media library',image:'tiny_mce/icons/image.gif',onclick:function(){tinyMCE.activeEditor=ed;loadfs('Media Library','showmedialibrary');}});
				ed.addButton('noamp',{title:'AMP exclusion zone',image:'tiny_mce/icons/noamp.gif',onclick:function(){ed.selection.setContent(mcetemplates.noamp(ed));}});
				ed.addButton('layout_headline',{title:'headline',image:'tiny_mce/icons/headline.gif',onclick:function(){ed.selection.setContent(mcetemplates.headline(ed));}});
				ed.addButton('objects',{title:'Smart Objects',image:'tiny_mce/icons/object.gif',onclick:function(){lookupentity(ed,'plugin','Smart Objects');}});
				ed.addButton('layout_col2',{title:'2-column',image:'tiny_mce/icons/col2.gif',onclick:function(){ed.selection.setContent(mcetemplates.col2);}});
				ed.addButton('layout_colside_right',{title:'side column (right)',image:'tiny_mce/icons/col-side-right.gif',onclick:function(){ed.selection.setContent(mcetemplates.colsideright);}});
				ed.addButton('layout_qna',{title:'QnA',image:'tiny_mce/icons/qna.gif',onclick:function(){ed.selection.setContent(mcetemplates.qna);}});
				ed.addButton('layout_youtube',{title:'youtube video',image:'tiny_mce/icons/youtube.gif',onclick:function(){var key=prompt('Enter YouTube Video Key');ed.selection.setContent(mcetemplates.youtube(key));}});
				ed.addButton('sourceedit',{title:'Source Editor',image:'tiny_mce/icons/code.gif',onclick:function(){tinyMCE.activeEditor=ed;loadfs('Source Editor','mceeditsource',null,initsourceeditor);}});
			}				
		});		
		
	}); //xajxjs
}
