Index: /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe.html
===================================================================
--- /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe.html	(revision 6674)
+++ /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe.html	(revision 6674)
@@ -0,0 +1,16 @@
+<html>
+<head>
+<script>
+function onLoadHandler(){
+	globals = uiFrame.globals = scriptFrame.globals = new scriptFrame.Globals();
+	globals.uiFrame = uiFrame;
+	globals.scriptFrame = scriptFrame;
+	globals.rootWindow = window;
+}
+</script>
+</head>
+<frameset rows="100%,0%,0%" border="0" onload="onLoadHandler();">
+<frame name="uiFrame" id="uiFrame" src="./multiframe_ui.html" frameborder="0" noresize scrolling="auto">
+<frame name="scriptFrame" id="scriptFrame" src="./multiframe_script.html" frameborder="0" noresize>
+</frameset>
+</html>
Index: /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe.js
===================================================================
--- /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe.js	(revision 6674)
+++ /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe.js	(revision 6674)
@@ -0,0 +1,107 @@
+function Globals() {
+}
+
+Globals.prototype.start = function Globals_start() {
+	loadWidgets(this.uiFrame.document.body);
+}
+
+Function.prototype.setContext = function Function_setContext(obj){
+	var func = this;
+	var args = Array.prototype.slice.call(arguments, 1);
+	return function(){
+		func.apply(obj, args);
+	};
+};
+
+function loadWidgets(elem){
+	loadElementWidgets(elem);
+	var query = elem.ownerDocument.evaluate("./" + "/" + "*[@widget_class]", elem, null, 7, null);
+	for( var i = 0,len = query.snapshotLength; i < len; i++ )
+		loadElementWidgets(query.snapshotItem(i));
+};
+
+function loadElementWidgets(elem){
+	var widgetClass = elem.getAttribute('widget_class');
+	if (!widgetClass)
+		return;
+	if (!elem.id)
+		elem.id = 'WIDGET' + WidgetListener.prototype.autoGenId++;
+	for (var c = widgetClass.split(' '), j = 0; j < c.length; j++)
+		new WidgetLoader(elem.id, c[j]);
+};
+
+// ScriptLoader
+function ScriptLoader(id) {
+	this.id = id;
+};
+ScriptLoader.prototype.load = function ScriptLoader_load(href) {
+	this.href = href;
+	this.createElement();
+	this.elem.setAttribute('src', href);
+	this.elem.ownerDocument.getElementsByTagName('head')[0].appendChild(this.elem);
+};
+
+ScriptLoader.prototype.createElement = function ScriptLoader_createElement(){
+
+	this.elem = this.oDocument ? this.oDocument.createElement('script') : document.createElement('script');
+	this.elem['type'] = 'text/javascript';
+	this.elem.id = this.id;
+	this.elem.onload = this.onDatasetComplete.setContext(this);
+}; 
+
+// WidgetLoader
+function WidgetLoader(id, name) {
+	this.id = id;
+	this.name = name;
+	this.onDatasetComplete();
+};
+
+WidgetLoader.prototype.onDatasetComplete = function WidgetLoader_onDatasetComplete(state){
+	var names = this.name.split(':');
+	if (!names[1]) {
+		this.widgets[this.id + ':' + names[0]] = new window[names[0]](this.id); 
+	}
+};
+WidgetLoader.prototype.widgets = {};
+WidgetLoader.prototype.autoGenId = 0;
+
+// Widget_CKEditor
+function Widget_CKEditor(id) {
+	this.id = id;
+	this.createEditorElem();
+};
+
+Widget_CKEditor.prototype.createEditorElem = function Widget_CKEditor_createEditorElem() {
+	
+	var loader = new ScriptLoader();
+	var obj = this;
+	loader.onDatasetComplete = function(state) {
+		obj.onDatasetComplete(state);
+	};
+
+	// loads the script in the script frame
+
+	// NG
+	//loader.oDocument = globals.scriptFrame.document;
+
+	// OK
+	loader.oDocument = globals.uiFrame.document;
+
+	loader.load("../ckeditor.js");
+}
+
+Widget_CKEditor.prototype.onDatasetComplete = function Widget_CKEditor_onDatasetComplete(state){
+	
+	if (!window['CKEDITOR']) {
+		if (globals.uiFrame['CKEDITOR']) {
+			CKEDITOR = globals.uiFrame['CKEDITOR'];
+		}
+	}
+	if (window['CKEDITOR'] && CKEDITOR.status == 'loaded') {
+		var editor = CKEDITOR.replace(this.id, {});
+	}
+	else {
+		setTimeout(this.onDatasetComplete.setContext(this), 100);
+	}
+}
+
Index: /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe_script.html
===================================================================
--- /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe_script.html	(revision 6674)
+++ /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe_script.html	(revision 6674)
@@ -0,0 +1,8 @@
+<html>
+<head>
+<script>
+document.write('<script src="./multiframe.js"><\/script>');
+</script>
+</head>
+<body></body>
+</html>
Index: /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe_ui.html
===================================================================
--- /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe_ui.html	(revision 6674)
+++ /CKEditor/branches/developers/ibm/7206/_7206_tc/multiframe_ui.html	(revision 6674)
@@ -0,0 +1,21 @@
+<html>
+<head>
+<script>
+function createWidgets() {
+	globals.start();
+}
+</script>
+</head>
+<body>
+
+	<p>
+		<input onclick="createWidgets();" type="button" value="Create Widgets" />
+	</p>
+	<!-- This div will hold the editor. -->
+	<div id="editor"  widget_class="Widget_CKEditor">
+	</div>
+
+
+</body>
+</html>
+
