rem: self.editor = self.contentWindow.CodePress; 
add:    self.editor = window.frames['codepress-' + obj.id].CodePress;     self.editor.initialize('new'); 
context: CodePress = function(obj) {	var self = document.createElement('iframe');	self.textarea = obj;	self.textarea.disabled = true;	self.textarea.style.overflow = 'hidden';	self.style.height = self.textarea.clientHeight +'px';	self.style.width = self.textarea.clientWidth +'px';	self.textarea.style.overflow = 'auto';	self.style.border = '1px solid gray';	self.frameBorder = 0; // remove IE internal iframe border	self.style.visibility = 'hidden';	self.style.position = 'absolute';	self.options = self.textarea.className;		self.initialize = function() {		self.editor = self.contentWindow.CodePress;		self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0];		self.editor.setCode(self.textarea.value);		self.setOptions();		self.editor.syntaxHighlight('init');		self.textarea.style.display = 'none';		self.style.position = 'static';		self.style.visibility = 'visible';		self.style.display = 'inline';	}		// obj can by a textarea id or a string (code)	self.edit = function(obj,language) {		if(obj) self.textarea.value = document.getElementById(obj) ? document.getElementById(obj).value : obj;		if(!self.textarea.disabled) return;		self.language = language ? language : self.getLanguage();		self.src = CodePress.path+'codepress.html?language='+self.language+'&ts='+(new Date).getTime();		if(self.attachEvent) self.attachEvent('onload',self.initialize);		else self.addEventListener('load',self.initialize,false);	}	self.getLanguage = function() {		for (language in CodePress.languages) 			if(self.options.match('\\b'+language+'\\b')) 				return CodePress.languages[language] ? language : 'generic';	}		self.setOptions = function() {		if(self.options.match('autocomplete-off')) self.toggleAutoComplete();		if(self.options.match('readonly-on')) self.toggleReadOnly();		if(self.options.match('linenumbers-off')) self.toggleLineNumbers();	}		self.getCode = function() {		return self.textarea.disabled ? self.editor.getCode() : self.textarea.value;	}	self.setCode = function(code) {		self.textarea.disabled ? self.editor.setCode(code) : self.textarea.value = code;	}	self.toggleAutoComplete = function() {		self.editor.autocomplete = (self.editor.autocomplete) ? false : true;	}		self.toggleReadOnly = function() {		self.textarea.readOnly = (self.textarea.readOnly) ? false : true;		if(self.style.display != 'none') // prevent exception on FF + iframe with display:none			self.editor.readOnly(self.textarea.readOnly ? true : false);	}		self.toggleLineNumbers = function() {		var cn = self.editor.body.className;		self.editor.body.className = (cn==''||cn=='show-line-numbers') ? 'hide-line-numbers' : 'show-line-numbers';	}		self.toggleEditor = function() {		if(self.textarea.disabled) {			self.textarea.value = self.getCode();			self.textarea.disabled = false;			self.style.display = 'none';			self.textarea.style.display = 'inline';		}		else {			self.textarea.disabled = true;			self.setCode(self.textarea.value);			self.editor.syntaxHighlight('init');			self.style.display = 'inline';			self.textarea.style.display = 'none';		}	}	self.edit();	return self;}
meta: 1705	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/1705/be03acf76f44ab807a2b55354886ce247f125ead/codepress.js/buggy/chrome/content/codepress/codepress.js