bgneal@45: tinyMCEPopup.requireLangPack();
bgneal@45: tinyMCEPopup.onInit.add(onLoadInit);
bgneal@45: 
bgneal@45: function saveContent() {
bgneal@45: 	tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});
bgneal@45: 	tinyMCEPopup.close();
bgneal@45: }
bgneal@45: 
bgneal@45: function onLoadInit() {
bgneal@45: 	tinyMCEPopup.resizeToInnerSize();
bgneal@45: 
bgneal@45: 	// Remove Gecko spellchecking
bgneal@45: 	if (tinymce.isGecko)
bgneal@45: 		document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
bgneal@45: 
bgneal@45: 	document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
bgneal@45: 
bgneal@45: 	if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
bgneal@45: 		setWrap('soft');
bgneal@45: 		document.getElementById('wraped').checked = true;
bgneal@45: 	}
bgneal@45: 
bgneal@45: 	resizeInputs();
bgneal@45: }
bgneal@45: 
bgneal@45: function setWrap(val) {
bgneal@45: 	var v, n, s = document.getElementById('htmlSource');
bgneal@45: 
bgneal@45: 	s.wrap = val;
bgneal@45: 
bgneal@45: 	if (!tinymce.isIE) {
bgneal@45: 		v = s.value;
bgneal@45: 		n = s.cloneNode(false);
bgneal@45: 		n.setAttribute("wrap", val);
bgneal@45: 		s.parentNode.replaceChild(n, s);
bgneal@45: 		n.value = v;
bgneal@45: 	}
bgneal@45: }
bgneal@45: 
bgneal@45: function toggleWordWrap(elm) {
bgneal@45: 	if (elm.checked)
bgneal@45: 		setWrap('soft');
bgneal@45: 	else
bgneal@45: 		setWrap('off');
bgneal@45: }
bgneal@45: 
bgneal@45: var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
bgneal@45: 
bgneal@45: function resizeInputs() {
bgneal@45: 	var el = document.getElementById('htmlSource');
bgneal@45: 
bgneal@45: 	if (!tinymce.isIE) {
bgneal@45: 		 wHeight = self.innerHeight - 65;
bgneal@45: 		 wWidth = self.innerWidth - 16;
bgneal@45: 	} else {
bgneal@45: 		 wHeight = document.body.clientHeight - 70;
bgneal@45: 		 wWidth = document.body.clientWidth - 16;
bgneal@45: 	}
bgneal@45: 
bgneal@45: 	el.style.height = Math.abs(wHeight) + 'px';
bgneal@45: 	el.style.width  = Math.abs(wWidth) + 'px';
bgneal@45: }