/* Functions for the advlink plugin popup */

tinyMCEPopup.requireLangPack();

function preinit() {
	var url;

	if (url = tinyMCEPopup.getParam("external_link_list_url"))
		document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
}

function init() {
}
function insertAction() {
	var formObj = document.forms[0];
	var ed = tinyMCEPopup.editor;
	var node = ed.selection.getNode()

// 	if (node && node.nodeName == 'BLOCKQUOTE') {
// 		node.firstChild.nodeValue = document.getElementById("text").value;
// 	}else {
		ed.execCommand('mceInsertRawHTML', false, '<blockquote>'+formObj.text.value.replace(/\n/g,"<br />")+'</blockquote>', {skip_undo : 1});
		ed.undoManager.add();
// 	}
	
	tinyMCEPopup.close();
}

// While loading
preinit();
tinyMCEPopup.onInit.add(init);
