tinyMCEPopup.requireLangPack();
var ed;

function init() {
	ed = tinyMCEPopup.editor;
	document.body.innerHTML = tinyMCEPopup.getWindowArg('magnify_publisher_iframe');
}

function closeTinyMCEPopup() {
	tinyMCEPopup.close();
}

function mvp_add_to_text_editor( text_to_add ) {
	ed = tinyMCEPopup.editor;
	var content = ed.getContent();
	ed.setContent( content + text_to_add );
		if ( window.parent.ed ) {
			window.parent.closeTinyMCEPopup();
		}
}

function mvp_publisher_embed( embed_info ) {	
	var embed_code = "\n" + embed_info.placeholder + "\n";		
	mvp_add_to_text_editor( embed_code );
}

tinyMCEPopup.onInit.add(init);