context: function TinyMCE_setupContent(editor_id) {	var instance = tinyMCE.instances[editor_id];	var doc = instance.contentWindow.document;	var head = doc.getElementsByTagName('head').item(0);	// Not loaded correctly hit it again, Mozilla bug #997860	if (!tinyMCE.isMSIE && doc.title != "blank_page") {		// This part will remove the designMode status		doc.location.href = tinyMCE.baseURL + "/blank.htm";		window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 1000);		return;	}	if (!head) {		window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 10);		return;	}	doc.body.dir = this.settings['directionality'];	doc.editorId = editor_id;	// Setup base element	base = doc.createElement("base");	base.setAttribute('href', tinyMCE.settings['base_href']);	head.appendChild(base);	var oldElement = instance.oldTargetElement;	if (oldElement.nodeName.toLowerCase() == "textarea")		var content = oldElement.value;	else		var content = instance.oldTargetElement.innerHTML;	if (tinyMCE.isMSIE) {		var styleSheet = document.frames[editor_id].document.createStyleSheet(instance.settings['content_css']);		window.setInterval('tinyMCE.getCSSClasses(document.frames["' + editor_id + '"].document, "' + editor_id + '");', 500);		if (tinyMCE.settings["force_br_newlines"])			document.frames[editor_id].document.styleSheets[0].addRule("p", "margin: 0px;");		var patchFunc = function() {			var event = document.frames[editor_id].event;			event.target = document.frames[editor_id].document;			TinyMCE_handleEvent(event);		};		document.frames[editor_id].document.body.onblur = patchFunc;		document.frames[editor_id].document.body.onbeforepaste = patchFunc;		document.frames[editor_id].document.body.onbeforecut = patchFunc;		document.frames[editor_id].document.body.onpaste = patchFunc;		document.frames[editor_id].document.body.editorId = editor_id;	} else {		var targetDocument = document.getElementById(editor_id).contentWindow.document;		// * * Import editor css		var cssImporter = targetDocument.createElement("link");		cssImporter.rel = "stylesheet";		cssImporter.href = instance.settings['content_css'];		if (headArr = targetDocument.getElementsByTagName("head"));			headArr[0].appendChild(cssImporter);	}	// Fix for bug #958637	if (!tinyMCE.isMSIE) {		if (tinyMCE.settings['cleanup_on_startup']) {			var contentElement = instance.contentWindow.document.createElement("body");			contentElement.innerHTML = content;			instance.contentWindow.document.body.innerHTML = tinyMCE._cleanupHTML(instance.contentWindow.document, this.settings, contentElement);		} else {			var contentElement = instance.contentWindow.document.createElement("body");			var doc = instance.contentWindow.document;			// Convert all strong/em to b/i			content = tinyMCE.regexpReplace(content, "<strong", "<b", "gi");			content = tinyMCE.regexpReplace(content, "<em", "<i", "gi");			content = tinyMCE.regexpReplace(content, "</strong>", "</b>", "gi");			content = tinyMCE.regexpReplace(content, "</em>", "</i>", "gi");			contentElement.innerHTML = content;			// Convert img src nodes			var elms = contentElement.getElementsByTagName("img");			for (var i=0; i<elms.length; i++) {				var src = elms[i].getAttribute('src');				if (src && src != "") {					src = eval(tinyMCE.cleanup_urlconvertor_callback + "(src, elms[i], tinyMCE.cleanup_on_save);");					elms[i].setAttribute("src", src);					elms[i].setAttribute("mce_real_src", src);				}			}			// Convert anchor hrefs			elms = contentElement.getElementsByTagName("a");			for (var i=0; i<elms.length; i++) {				var href = elms[i].getAttribute('href');				if (href && href != "") {					href = eval(tinyMCE.cleanup_urlconvertor_callback + "(href, elms[i], tinyMCE.cleanup_on_save);");					elms[i].setAttribute("href", href);					elms[i].setAttribute("mce_real_href", href);				}			}			instance.contentWindow.document.body.innerHTML = contentElement.innerHTML;		}	} else {		if (tinyMCE.settings['cleanup_on_startup']) {			tinyMCE._setHTML(instance.contentWindow.document, content);			// Produces permission denied error in MSIE 5.5			eval('try {instance.contentWindow.document.body.innerHTML = tinyMCE._cleanupHTML(instance.contentDocument, this.settings, instance.contentDocument.body);} catch(e) {}');		} else			instance.contentWindow.document.body.innerHTML = content;	}	// Fix for bug #957681	//instance.contentWindow.document.designMode = instance.contentWindow.document.designMode;	// Setup element references	var parentElm = document.getElementById(instance.editorId + '_parent');	instance.formElement = parentElm.lastChild;	if (tinyMCE.settings['handleNodeChangeCallback']) {		var undoIndex = -1;		var undoLevels = -1;		if (tinyMCE.settings['custom_undo_redo']) {			undoIndex = 0;			undoLevels = 0;		}		eval(tinyMCE.settings['handleNodeChangeCallback'] + '("' + editor_id + '", tinyMCE.instances["' + editor_id + '"].contentWindow.document.body,undoIndex,undoLevels,tinyMCE.instances["' + editor_id + '"].visualAid, false);');		//window.setTimeout(tinyMCE.settings['handleNodeChangeCallback'] + '("' + editor_id + '", tinyMCE.instances["' + editor_id + '"].contentWindow.document.body,undoIndex,undoLevels);', 10);	}	tinyMCE.handleVisualAid(instance.contentWindow.document.body, true, tinyMCE.settings['visual']);	// Trigger setup content	if (tinyMCE.settings['setupcontent_callback'] != "")		eval(tinyMCE.settings['setupcontent_callback'] + '(editor_id,instance.contentWindow.document.body);');	// Re-add design mode on mozilla	if (!tinyMCE.isMSIE) {		TinyMCE_addEventHandlers(editor_id);	}}
meta: 5314	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5314/873ce1c62e52365d732f67421272ae1302559b15/tiny_mce_src.js/buggy/www/extras/tinymce/jscripts/tiny_mce/tiny_mce_src.js