
function com_htmli_forms_Input(outerNode) {
	this.init(outerNode, 'com.htmli.forms.Input', 'Input');
}
com_htmli_forms_Input.prototype = new HTMLiElement();
com_htmli_forms_Input.prototype.getSrc = function() {
				return this.getAttribute('src');
	};
	com_htmli_forms_Input.prototype.setSrc = function(src) {
					this.setAttribute('src', src);
		};
	com_htmli_forms_Input.prototype.getSelect = function() {
				return this.getAttribute('select');
	};
	com_htmli_forms_Input.prototype.setSelect = function(select) {
					this.setAttribute('select', select);
		};
	com_htmli_forms_Input.prototype.getType = function() {
				return this.getAttribute('type');
	};
	com_htmli_forms_Input.prototype.getDisabled = function() {
				var me = this;
				var __value = this.getAttribute('disabled');
				var disabled = __value;
				return me.outerNode.disabled;
				return __value;
	};
	com_htmli_forms_Input.prototype.setDisabled = function(disabled) {
					var me = this;
					var __value = disabled;
		me.outerNode.disabled = disabled;
					this.setAttribute('disabled', __value);
		};
	com_htmli_forms_Input.prototype.getValue = function() {
				var me = this;
				var __value = this.getAttribute('value');
				var value = __value;
				return me.outerNode.value;
				return __value;
	};
	com_htmli_forms_Input.prototype.setValue = function(value) {
					var me = this;
					var __value = value;
		me.outerNode.value = value;
					this.setAttribute('value', __value);
		};
	com_htmli_forms_Input.prototype.getReadonly = function() {
				return this.getAttribute('readonly');
	};
	com_htmli_forms_Input.prototype.sync = function(select) {
		var me = this;
		var xml = me.getContainer().getElementById(me.getSrc());
		var xmlDoc = xml.getXmlDocument();
		var node;
		if (select) {
			node = xmlDoc.selectSingleNode(select);
		} else {
			node = xmlDoc.selectSingleNode(me.getSelect());
		}
		var value = me.outerNode.type == 'checkbox' ? (me.outerNode.checked ? 'true':'false') : me.getValue();
		if (node.childNodes.length > 0) {
			node.replaceChild(xmlDoc.createTextNode(value), node.childNodes[0]);
		} else {
			node.appendChild(xmlDoc.createTextNode(value));
		}
		xml.setXml(xmlDoc.xml);
	};
com_htmli_forms_Input.prototype.focus = function() {
		var me = this;
		me.outerNode.focus();
	};
function com_htmli_forms_Select(outerNode) {
	this.init(outerNode, 'com.htmli.forms.Select', 'Select');
}
com_htmli_forms_Select.prototype = new HTMLiElement();
com_htmli_forms_Select.prototype.getSrc = function() {
				return this.getAttribute('src');
	};
	com_htmli_forms_Select.prototype.setSrc = function(src) {
					this.setAttribute('src', src);
		};
	com_htmli_forms_Select.prototype.getSelect = function() {
				return this.getAttribute('select');
	};
	com_htmli_forms_Select.prototype.setSelect = function(select) {
					this.setAttribute('select', select);
		};
	com_htmli_forms_Select.prototype.getValue = function() {
				var me = this;
				var __value = this.getAttribute('value');
				var value = __value;
				return me.outerNode.value;
				return __value;
	};
	com_htmli_forms_Select.prototype.setValue = function(value) {
					var me = this;
					var __value = value;
		me.outerNode.value = value;
					this.setAttribute('value', __value);
		};
	com_htmli_forms_Select.prototype.getDisabled = function() {
				var me = this;
				var __value = this.getAttribute('disabled');
				var disabled = __value;
				return me.outerNode.disabled;
				return __value;
	};
	com_htmli_forms_Select.prototype.setDisabled = function(disabled) {
					var me = this;
					var __value = disabled;
						if (__value == true) {
							__value = 'true';
						}
						if (__value == false) {
							__value = 'false';
						}
		me.outerNode.disabled = disabled;
					this.setAttribute('disabled', __value);
		};
	com_htmli_forms_Select.prototype.getSelectedIndex = function() {
				var me = this;
				var __value = this.getAttribute('');
				var selectedIndex = __value;
				return me.outerNode.selectedIndex;
				return __value;
	};
	com_htmli_forms_Select.prototype.sync = function(select,value) {
		var me = this;
		var xml = me.getContainer().getElementById(me.getSrc());
		var xmlDoc = xml.getXmlDocument();
		var sel;
		if (select) {
			sel = select.split(';');
		} else {
			sel = me.getSelect().split(';');
		}
		var node = xmlDoc.selectSingleNode(sel[0]);
		if (value) {
			if (node.childNodes.length > 0) {
				node.childNodes[0].nodeValue = value;
			} else {
				node.appendChild(xmlDoc.createTextNode(value));
			}
		} else {
			if (node.childNodes.length > 0) {
				node.replaceChild(xmlDoc.createTextNode(me.getValue()), node.childNodes[0]);
			} else {
				node.appendChild(xmlDoc.createTextNode(me.getValue()));
			}
		}
		if (sel.length >= 2) {
			node = xmlDoc.selectSingleNode(sel[1]);
			if (node.childNodes.length > 0) {
				node.childNodes[0].nodeValue = me.outerNode.options[me.outerNode.selectedIndex].text;
			} else {
				node.appendChild(xmlDoc.createTextNode(me.outerNode.options[me.outerNode.selectedIndex].text));
			}
		}
		xml.setXml(xmlDoc.xml);
	};
com_htmli_forms_Select.currentWord = "";
com_htmli_forms_Select.currentNode = null;
com_htmli_forms_Select.prototype._keyPress = function(ev) {
	if (com_htmli_forms_Select.currentNode != this.outerNode) {
		com_htmli_forms_Select.currentNode = this.outerNode;
		com_htmli_forms_Select.currentWord = "";
	}
	com_htmli_forms_Select.currentWord += String.fromCharCode(ev.getKeyCode()).toLowerCase();
	for (var i=0; i < this.outerNode.options.length; i++) {
		if (this.outerNode.options[i].text.toLowerCase().indexOf(com_htmli_forms_Select.currentWord) == 0) {
			this.outerNode.options[i].selected = true;
			break;
		}
	}
};
function com_htmli_forms_Textarea(outerNode) {
	this.init(outerNode, 'com.htmli.forms.Textarea', 'Textarea');
}
com_htmli_forms_Textarea.prototype = new HTMLiElement();
com_htmli_forms_Textarea.prototype.getSrc = function() {
				return this.getAttribute('src');
	};
	com_htmli_forms_Textarea.prototype.setSrc = function(src) {
					this.setAttribute('src', src);
		};
	com_htmli_forms_Textarea.prototype.getSelect = function() {
				return this.getAttribute('select');
	};
	com_htmli_forms_Textarea.prototype.setSelect = function(select) {
					this.setAttribute('select', select);
		};
	com_htmli_forms_Textarea.prototype.getValue = function() {
				var me = this;
				var __value = this.getAttribute('value');
				var value = __value;
				return me.outerNode.value;
				return __value;
	};
	com_htmli_forms_Textarea.prototype.setValue = function(value) {
					var me = this;
					var __value = value;
		me.outerNode.value = value;
					this.setAttribute('value', __value);
		};
	com_htmli_forms_Textarea.prototype.sync = function(select) {
		var me = this;
		var xml = me.getContainer().getElementById(me.getSrc());
		var xmlDoc = xml.getXmlDocument();
		var node;
		if (select) {
			node = xmlDoc.selectSingleNode(select);
		} else {
			node = xmlDoc.selectSingleNode(me.getSelect());
		}
		var value = me.getValue();
		if (node.childNodes.length > 0) {
			node.childNodes[0].nodeValue = value;
		} else {
			node.appendChild(xmlDoc.createTextNode(value));
		}
		xml.setXml(xmlDoc.xml);
	};
function com_htmli_ui_Import(outerNode) {
	this.init(outerNode, 'com.htmli.ui.Import', 'Import');
}
com_htmli_ui_Import.prototype = new HTMLiElement();
com_htmli_ui_Import.prototype.getUrl = function() {
				return this.getAttribute('url');
	};
	com_htmli_ui_Import.prototype.setUrl = function(url) {
					this.setAttribute('url', url);
		};
	com_htmli_ui_Import.prototype.getChildContainer = function() {
		var me = this;
		return new Container(me.outerNode);
	};
function com_htmli_ui_Menu(outerNode) {
	this.init(outerNode, 'com.htmli.ui.Menu', 'Menu');
		this.innerNode = outerNode.childNodes[1].childNodes[0];
}
com_htmli_ui_Menu.prototype = new HTMLiElement();
com_htmli_ui_Menu.prototype.showCentered = function(object) {
		var me = this;
		if (object.getStyle().position == 'relative') {
			me.show(object.getHeight()/2, object.getWidth()/2);
		} else {
			me.show(-object.getHeight()/2, object.getWidth()/2);
		}
	};
com_htmli_ui_Menu.prototype.showRight = function(object) {
		var me = this;
		if (object.getStyle().position == 'relative') {
			me.show(object.getHeight(), object.getWidth());
		} else {
			me.show(0, object.getWidth());
		}
	};
com_htmli_ui_Menu.prototype.show = function(top,left) {
		var me = this;
		var length = com_htmli_ui_Menu.active.length;
		if (length) {
			for (var i=length-1; i >= 0; i--) {
				if (!me.isChildOf(com_htmli_ui_Menu.active[i])) {
					com_htmli_ui_Menu.active[i].hide();
				}
			}
		}
		try {
			if (length) {
				for (var i=length-1; i >= 0; i--) {
					if (com_htmli_ui_Menu.active[i].outerNode == me.outerNode) {
						return;
					}
				}
			}
		}
		catch(e) { }
		com_htmli_ui_Menu.active.push(me);
		var style =	me.outerNode.style;
		style.visibility = 'visible';
		if (top) {
			style.top = top + "px";
		}
		if (left) {
			style.left = left + "px";
		}
		style.zIndex = application.nextZIndex++;
		var table = application.wrapNode(this.outerNode.childNodes[1]);
		var outer = application.wrapNode(this.outerNode);
		var shadow = me.outerNode.lastChild;
		shadow.style.height = table.getHeight() + "px";
		shadow.style.width = outer.getWidth() + "px";
		var iframe = me.outerNode.firstChild;
		iframe.style.height = table.getHeight() + "px";
		iframe.style.width = outer.getWidth() + "px";
		if (!document.all) {
			iframe.style.display = 'none';
		}
	};
com_htmli_ui_Menu.prototype.hideChildren = function() {
		var me = this;
		if (com_htmli_ui_Menu.active.length) {
			for (var i=com_htmli_ui_Menu.active.length-1; i > 0; i--) {
				if (!me.isChildOf(com_htmli_ui_Menu.active[i])) {
					com_htmli_ui_Menu.active[i].hide();
				}
			}
		}
	};
com_htmli_ui_Menu.prototype.hide = function() {
		var me = this;
		me.outerNode.style.visibility = 'hidden';
		for (var i=com_htmli_ui_Menu.active.length-1; i >= 0; i--) {
			if (com_htmli_ui_Menu.active[i].outerNode == me.outerNode) {
				com_htmli_ui_Menu.active.splice(i, 1);
				break;
			}
		}
	};
com_htmli_ui_Menu.active = new Array();
com_htmli_ui_Menu.flag = true;
com_htmli_ui_Menu.clickedDisabled = false;
com_htmli_ui_Menu.prototype.isChildOf = function(parent) {
	var node = parent.outerNode;
	var parentNode = this.outerNode;
	while (parentNode != null) {
		if (parentNode == node) {
			return true;
		}
		parentNode = parentNode.parentNode;
	}
	parentNode = null;
	return false;
};
application.addEventListener('click', function(ev) {
	var length = com_htmli_ui_Menu.active.length;
	if (ev.getButton()!=2 && length && !com_htmli_ui_Menu.clickedDisabled) {
		for (var i=length-1; i >= 0; i--) {
			var element = com_htmli_ui_Menu.active[i];
			if (element.getParentNode().getClassName()  == 'com_htmli_ui_MenuBarItem__hover') {
				element.getParentNode().setClassName('com_htmli_ui_MenuBarItem');
			}
			element.hide();
		}
		com_htmli_ui_Menu.active = new Array();
		com_htmli_ui_MenuBar.open = false;
	}
	com_htmli_ui_Menu.clickedDisabled = false;
}, false);
function com_htmli_ui_MenuBar(outerNode) {
	this.init(outerNode, 'com.htmli.ui.MenuBar', 'MenuBar');
}
com_htmli_ui_MenuBar.prototype = new HTMLiElement();
	com_htmli_ui_MenuBar.open = false;
function com_htmli_ui_MenuBarItem(outerNode) {
	this.init(outerNode, 'com.htmli.ui.MenuBarItem', 'MenuBarItem');
		this.innerNode = outerNode.childNodes[1];
}
com_htmli_ui_MenuBarItem.prototype = new HTMLiElement();
com_htmli_ui_MenuBarItem.prototype.showMenu = function() {
		var me = this;
		var child = me.getFirstChild();
		if (child != null) {
			child.show(me.getHeight());
		}
		child = null;
	};
com_htmli_ui_MenuBarItem.prototype.hideMenu = function() {
		var me = this;
		var child = me.getFirstChild();
		if (child != null) {
			child.hide();
		}
		child = null;
	};
com_htmli_ui_MenuBarItem.prototype.mouseOver = function(ev) {
	this.getParentNode().getStyle().zIndex = application.nextZIndex++;
	var menuBarItems = this.getParentNode().getChildNodes();
	var length = menuBarItems.getLength();
	for (var i=1; i<length; i++) {
		var menuBarItem = menuBarItems.item(i);
		menuBarItem.setClassName('com_htmli_ui_MenuBarItem');
	}
	this.setClassName('com_htmli_ui_MenuBarItem__hover');
	if (com_htmli_ui_Menu.flag && com_htmli_ui_MenuBar.open) {
		this.showMenu();
		ev.stopPropagation();
	}
};
com_htmli_ui_MenuBarItem.prototype.click = function(ev) {
	if (!com_htmli_ui_MenuBar.open) {
		com_htmli_ui_MenuBar.open = true;
		this.showMenu();
		ev.stopPropagation();
	} else {
		com_htmli_ui_MenuBar.open = false;
		this.hideMenu();
		ev.stopPropagation();
	}
};
function com_htmli_ui_MenuItem(outerNode) {
	this.init(outerNode, 'com.htmli.ui.MenuItem', 'MenuItem');
		this.innerNode = outerNode.childNodes[5];
}
com_htmli_ui_MenuItem.prototype = new HTMLiElement();
com_htmli_ui_MenuItem.prototype.getShortcut = function() {
				return this.getAttribute('shortcut');
	};
	com_htmli_ui_MenuItem.prototype.setShortcut = function(shortcut) {
					this.setAttribute('shortcut', shortcut);
		};
	com_htmli_ui_MenuItem.prototype.getChecked = function() {
				var value = this.getAttribute('checked');
				return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
	};
	com_htmli_ui_MenuItem.prototype.setChecked = function(checked) {
					var me = this;
					var __value = checked;
						if (__value == true) {
							__value = 'true';
						}
						if (__value == false) {
							__value = 'false';
						}
			var style = this.outerNode.firstChild.firstChild.style;
			if (checked) {
				style.display = '';
			} else {
				style.display = 'none';
			}
					this.setAttribute('checked', __value);
		};
	com_htmli_ui_MenuItem.prototype.getCaption = function() {
				return this.getAttribute('caption');
	};
	com_htmli_ui_MenuItem.prototype.setCaption = function(caption) {
					this.setAttribute('caption', caption);
		};
	com_htmli_ui_MenuItem.prototype.getType = function() {
				return this.getAttribute('type');
	};
	com_htmli_ui_MenuItem.prototype.getDisabled = function() {
				var value = this.getAttribute('disabled');
				return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
	};
	com_htmli_ui_MenuItem.prototype.setDisabled = function(disabled) {
					var me = this;
					var __value = disabled;
						if (__value == true) {
							__value = 'true';
						}
						if (__value == false) {
							__value = 'false';
						}
		if (disabled) {
			me.outerNode.childNodes[0].firstChild.className = 'com_htmli_ui_MenuItem__check com_htmli_ui_MenuItem__faded';
			me.outerNode.childNodes[1].firstChild.className = 'com_htmli_ui_MenuItem__icon com_htmli_ui_MenuItem__faded';
			me.outerNode.className = 'com_htmli_ui_MenuItem__disabled';
		} else {
			me.outerNode.childNodes[0].firstChild.className = 'com_htmli_ui_MenuItem__check';
			me.outerNode.childNodes[1].firstChild.className = 'com_htmli_ui_MenuItem__icon';
			me.outerNode.className = '';
		}
					this.setAttribute('disabled', __value);
		};
	com_htmli_ui_MenuItem.prototype.getIcon = function() {
				return this.getAttribute('icon');
	};
	com_htmli_ui_MenuItem.prototype.showMenu = function() {
		var me = this;
		var firstChild = me.getFirstChild();
		if (firstChild != null) {
			firstChild.show(me.getHeight() * me.outerNode.rowIndex);
		}
		firstChild = null;
	};
com_htmli_ui_MenuItem.prototype.hideMenu = function() {
		var me = this;
		var firstChild = me.getFirstChild();
		if (firstChild != null) {
			firstChild.hide();
		}
		firstChild = null;
	};
com_htmli_ui_MenuItem.prototype.mouseover = function() {
	this.outerNode.style.backgroundColor = '#316ac5';
	this.outerNode.style.color = '#ffffff';
	if (com_htmli_ui_Menu.flag)
	{
		com_htmli_ui_Menu.flag = false;
		if (this.getFirstChild() != null) {
			this.showMenu();
		} else {
			this.getParentNode().hideChildren();
		}
	}
};
com_htmli_ui_MenuItem.prototype.mouseout = function() {
	com_htmli_ui_Menu.flag = true;
	var style =	this.outerNode.style;
	style.backgroundColor = '';
	style.color = '';
};
com_htmli_ui_MenuItem.prototype.clickDisabled = function(ev) {
	com_htmli_ui_Menu.clickedDisabled = true;
	ev.stopPropagation();
};
com_htmli_ui_MenuItem.prototype.click = function(ev) {
	if (!this.getDisabled()) {
		var length = com_htmli_ui_Menu.active.length;
		if (length && !this.getFirstChild()) {
			for (var i=length-1; i >= 0; i--) {
				var element = com_htmli_ui_Menu.active[i];
				if (element.getParentNode().getClassName()  == 'com_htmli_ui_MenuBarItem__hover') {
					element.getParentNode().setClassName('com_htmli_ui_MenuBarItem');
				}
				element.hide();
			}
			com_htmli_ui_Menu.active = new Array();
		}
		if (this.getType() == 'check') {
			this.toggleCheck();
		}
	}
};
com_htmli_ui_MenuItem.prototype.toggleCheck = function() {
	var style = this.outerNode.firstChild.firstChild.style;
	if (style.display == '') {
		this.setChecked(false);
	} else {
		this.setChecked(true);
	}
};
function com_htmli_ui_MenuSeparator(outerNode) {
	this.init(outerNode, 'com.htmli.ui.MenuSeparator', 'MenuSeparator');
}
com_htmli_ui_MenuSeparator.prototype = new HTMLiElement();
function com_htmli_ui_RichText(outerNode) {
	this.init(outerNode, 'com.htmli.ui.RichText', 'RichText');
}
com_htmli_ui_RichText.prototype = new HTMLiElement();
com_htmli_ui_RichText.prototype.getReadonly = function() {
				var value = this.getAttribute('readonly');
				return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
	};
	com_htmli_ui_RichText.prototype.start = function() {
		var me = this;
		me.outerNode.contentWindow.document.designMode = "on";
		me.outerNode.contentWindow.document.contentEditable = "true";
		try {
			me.outerNode.contentWindow.document.execCommand("undo", false, null);
		} catch (e) {
			alert("Not supported on your level of Mozilla.");
		}
		if (me.getReadonly()) {
			me.outerNode.contentWindow.document.execCommand("readonly", false, true);
		}
	};
com_htmli_ui_RichText.prototype.startWith = function(contents) {
		var me = this;
		me.outerNode.contentWindow.document.designMode = "on";
		me.outerNode.contentWindow.document.contentEditable = "true";
		me.setHTMLContents(contents);
		try {
			me.outerNode.contentWindow.document.execCommand("undo", false, null);
		} catch (e) {
			alert("Not supported on your level of Mozilla.");
		}
		if (me.getReadonly()) {
			me.outerNode.contentWindow.document.execCommand("readonly", false, true);
		}
	};
com_htmli_ui_RichText.prototype.execCommand = function(command,value) {
		var me = this;
		me.outerNode.contentWindow.document.execCommand(command, false, value);
	};
com_htmli_ui_RichText.prototype.focus = function() {
		var me = this;
		me.outerNode.contentWindow.focus();
	};
com_htmli_ui_RichText.prototype.getDocument = function() {
		var me = this;
			return me.outerNode.contentWindow.document;
	};
com_htmli_ui_RichText.prototype.getHTMLContents = function() {
		var me = this;
		var contents = me.outerNode.contentWindow.document.body.innerHTML;
		return contents;
	};
com_htmli_ui_RichText.prototype.setHTMLContents = function(contents) {
		var me = this;
			if (document.all) {
				setTimeout(function() {
					me.outerNode.contentWindow.document.body.innerHTML = contents;}, 1);
			} else {
				me.outerNode.contentWindow.document.body.innerHTML = contents;
			}
	};
com_htmli_ui_RichText.prototype.toSource = function() {
		var me = this;
		var edit = me.outerNode;
		var html = document.createTextNode(edit.contentWindow.document.body.innerHTML);
		edit.contentWindow.document.body.innerHTML = "";
		html = me.importNode(edit.contentWindow.document,html,false);
		edit.contentWindow.document.body.appendChild(html);
	};
com_htmli_ui_RichText.prototype.toRegular = function() {
		var me = this;
		var edit = me.outerNode;
		var html = edit.contentWindow.document.body.innerHTML;
		while (html.indexOf("&gt;")>=0) html = html.replace("&gt;",">");
		while (html.indexOf("&lt;")>=0) html = html.replace("&lt;","<");
		while (html.indexOf("&amp;")>=0) html = html.replace("&amp;","&");
		edit.contentWindow.document.body.innerHTML = html;
	};
com_htmli_ui_RichText.prototype.importNode = function (doc, node, allChildren) {
	if (!document.importNode) {
		switch (node.nodeType) {
			case 1:
				var newNode = doc.createElement(node.nodeName);
				if (node.attributes && node.attributes.length > 0)
				for (var i = 0, il = node.attributes.length; i < il;) {
				 	newNode.setAttribute(node.attributes[i].nodeName, node.getAttribute(node.attributes[i++].nodeName));
				}
		 		if (allChildren && node.childNodes && node.childNodes.length > 0) {
			 		for (var i = 0, il = node.childNodes.length; i < il;) {
						newNode.appendChild(importNode(node.childNodes[i++], allChildren));
						}
				}
				return newNode;
				break;
			case 3:
			case 4:
			return doc.createTextNode(node.nodeValue);
			break;
		}
	} else {
		return doc.importNode(node, allChildren);
	}
};
function com_htmli_ui_RTButtonBar(outerNode) {
	this.init(outerNode, 'com.htmli.ui.RTButtonBar', 'RTButtonBar');
}
com_htmli_ui_RTButtonBar.prototype = new HTMLiElement();
com_htmli_ui_RTButtonBar.prototype.getTarget = function() {
				return this.getAttribute('target');
	};
com_htmli_ui_RTButtonBar.colors = ["#FFFFFF" , "#FFCCCC" , "#FFCC99" , "#FFFF99" , "#FFFFCC" , "#99FF99" , "#99FFFF" ,
	"#CCFFFF" , "#CCCCFF" , "#FFCCFF" , "#CCCCCC" , "#FF6666" , "#FF9966" , "#FFFF66" , "#FFFF33" ,
	"#66FF99" , "#33FFFF" , "#66FFFF" , "#9999FF" , "#FF99FF" , "#C0C0C0" , "#FF0000" , "#FF9900" ,
	"#FFCC66" , "#FFFF00" , "#33FF33" , "#66CCCC" , "#33CCFF" , "#6666CC" , "#CC66CC" , "#999999" ,
	"#CC0000" , "#FF6600" , "#FFCC33" , "#FFCC00" , "#33CC00" , "#00CCCC" , "#3366FF" , "#6633FF" ,
	"#CC33CC" , "#666666" , "#990000" , "#CC6600" , "#CC9933" , "#999900" , "#009900" , "#339999" ,
	"#3333FF" , "#6600CC" , "#993399" , "#333333" , "#660000" , "#993300" , "#996633" , "#666600" ,
	"#006600" , "#336666" , "#000099" , "#333399" , "#663366" , "#000000" , "#330000" , "#663300" ,
	"#663333" , "#333300" , "#003300" , "#003333" , "#000066" , "#330099" , "#330033"];
com_htmli_ui_RTButtonBar.active = null;
com_htmli_ui_RTButtonBar.prototype.onMouseDown = function(me, ev)
{
	var edit = this.getContainer().getElementById(this.getTarget());
	var className = me.className.split(' ')[1];
	var action = className.substring(className.indexOf('__')+2,className.length);
    if (action == 'ul') action = 'insertunorderedlist';
    if (action == 'ol') action = 'insertorderedlist';
	
	if ((action == 'forecolor') || (action == 'hilitecolor')) {
	this.outerNode.command =  action;
	var button = application.wrapNode(me);
	this.showPalette(button.getRelativeY() + button.getHeight(), button.getRelativeX());
	} else if (action == 'createlink') {
	var szURL = prompt("Enter a URL:", "http://");
	if ((szURL != null) && (szURL != "")) {
		edit.execCommand('CreateLink',szURL);
	}
	} else if (action == 'createimage') {
	imagePath = prompt('Enter Image URL:', 'http://');
	if ((imagePath != null) && (imagePath != "")) {
		edit.execCommand('InsertImage', imagePath);
	}
	} else {
	edit.execCommand(action, null);
	}
	ev.preventDefault();
	ev.stopPropagation();
	return false;
}
com_htmli_ui_RTButtonBar.prototype.select = function(select)
{
	var cursel = select.selectedIndex;
	if (cursel != 0) {
	var className = select.className;
	var command = className.substring(className.indexOf('__')+2,className.length);
	var selected = select.options[cursel].value;
	if (command=='formatblock') {
		selected = '<' + selected + '>';
	}
	this.getContainer().getElementById(this.getTarget()).execCommand(command, selected);
	select.selectedIndex = 0;
	}
};
com_htmli_ui_RTButtonBar.prototype.selectColor = function(select)
{
	var cursel = select.selectedIndex;
	if (cursel != 0) {
	var className = select.className;
	var command = className.substring(className.indexOf('__')+2,className.length);
	var selected = select.options[cursel].value;
	if (command=='hilitecolor' && document.all) {
		command='backcolor';
	}
	this.getContainer().getElementById(this.getTarget()).execCommand(command, selected);
	select.selectedIndex = 0;
	}
};
com_htmli_ui_RTButtonBar.prototype.createPalette = function(obj) {
	var palette = application.wrapNode(obj);
	if (palette.getChildNodes().getLength()==1) {
		var length = com_htmli_ui_RTButtonBar.colors.length;
		for (var i=0, cell; i<length; i++) {
			cell = document.createElement('option');
			cell.style.backgroundColor = com_htmli_ui_RTButtonBar.colors[i];
			cell.value = com_htmli_ui_RTButtonBar.colors[i];
			obj.appendChild(cell);
		}
	}
};
application.addEventListener('click', function(ev) {
	if (ev.getButton()!=2 && com_htmli_ui_RTButtonBar.active) {
		com_htmli_ui_RTButtonBar.active.style.visibility = 'hidden';
		com_htmli_ui_RTButtonBar.active = null;
	}
}, false);
function com_htmli_ui_Slide(outerNode) {
	this.init(outerNode, 'com.htmli.ui.Slide', 'Slide');
		this.innerNode = outerNode.childNodes[1];
}
com_htmli_ui_Slide.prototype = new HTMLiElement();
com_htmli_ui_Slide.prototype.getClickAction = function() {
				return this.getAttribute('clickaction');
	};
	com_htmli_ui_Slide.prototype.setClickAction = function(clickAction) {
					this.setAttribute('clickaction', clickAction);
		};
	com_htmli_ui_Slide.prototype.getDblClickAction = function() {
				return this.getAttribute('dblclickaction');
	};
	com_htmli_ui_Slide.prototype.setDblClickAction = function(dblClickAction) {
					this.setAttribute('dblclickaction', dblClickAction);
		};
	com_htmli_ui_Slide.prototype.getTitle = function() {
				return this.getAttribute('title');
	};
	com_htmli_ui_Slide.prototype.setTitle = function(title) {
					this.setAttribute('title', title);
		};
	com_htmli_ui_Slide.prototype.getNotes = function() {
				var me = this;
				var __value = this.getAttribute('');
				var notes = __value;
				return me.outerNode.childNodes[1].innerHTML;
				return __value;
	};
	com_htmli_ui_Slide.prototype.toggleNotes = function() {
		var me = this;
		if (this.outerNode.childNodes[1].style.display == 'none') {
			me.showNotes();
		} else {
			me.hideNotes();
		}
	};
com_htmli_ui_Slide.prototype.showNotes = function() {
		var me = this;
		this.outerNode.childNodes[1].style.display = 'block';
	};
com_htmli_ui_Slide.prototype.hideNotes = function() {
		var me = this;
		me.outerNode.childNodes[1].style.display = 'none';
	};
com_htmli_ui_Slide.prototype._addEventListener = com_htmli_ui_Slide.prototype.addEventListener;
	com_htmli_ui_Slide.prototype._dispatchEvent = com_htmli_ui_Slide.prototype.dispatchEvent;
	com_htmli_ui_Slide.prototype.addEventListener = function(event, func, capture) {
			if (event == 'show') {
				return this._addEventListenerFor(event, func);
			}
		return this._addEventListener(event, func, capture);
	};
	com_htmli_ui_Slide.prototype.dispatchEvent = function(event) {
			if (event.getType() == 'show') {
				var aux;
				eval('com_htmli_ui_Slide.prototype.aux = function(ev) {'  + this.getAttribute('onshow') + '};');
				this.aux(event);
				return;
			}
		return this._dispatchEvent(event);
	};
	com_htmli_ui_Slide.prototype._getListenersFor = function(event) {
		try {
			var ret = application.listeners[this.outerNode.id][event];
			return ret ? ret : new Array();
		} catch (e) {
			return new Array();
		}
	};
com_htmli_ui_Slide.state = 0;
com_htmli_ui_Slide.prototype.onClick = function(me, ev) {
	if (!me.outerNode.clickAction) {
		me.outerNode.clickAction = me.getClickAction();
	}
	this.takeAction(me.outerNode.clickAction);
};
com_htmli_ui_Slide.prototype.onDblClick = function(me, ev) {
	if (!me.outerNode.dblClickAction) {
		me.outerNode.dblClickAction = me.getDblClickAction();
	}
	this.takeAction(me.outerNode.dblClickAction);
};
com_htmli_ui_Slide.prototype.takeAction = function(action) {
	if (action == 'next') {
		this.getParentNode().goNext();
	} else if (action == 'notes') {
		this.toggleNotes();
	}
};
com_htmli_ui_Slide.prototype.dispatchShow = function() {
	var newEvent = application.createEvent('HTMLiEvents');
	newEvent.initHTMLiEvent('show', this);
	this.dispatchEvent(newEvent);
};
function com_htmli_ui_Slideshow(outerNode) {
	this.init(outerNode, 'com.htmli.ui.Slideshow', 'Slideshow');
}
com_htmli_ui_Slideshow.prototype = new HTMLiElement();
com_htmli_ui_Slideshow.prototype.getTransitionTime = function() {
				var value = this.getAttribute('transitiontime');
				return value == null ? 0 : value;
	};
	com_htmli_ui_Slideshow.prototype.setTransitionTime = function(transitionTime) {
					this.setAttribute('transitiontime', transitionTime);
		};
	com_htmli_ui_Slideshow.prototype.getTransition = function() {
				return this.getAttribute('transition');
	};
	com_htmli_ui_Slideshow.prototype.setTransition = function(transition) {
					this.setAttribute('transition', transition);
		};
	com_htmli_ui_Slideshow.prototype.getTime = function() {
				var value = this.getAttribute('time');
				return value == null ? 0 : value;
	};
	com_htmli_ui_Slideshow.prototype.setTime = function(time) {
					this.setAttribute('time', time);
		};
	com_htmli_ui_Slideshow.prototype.getState = function() {
				return this.getAttribute('');
	};
	com_htmli_ui_Slideshow.prototype.setState = function(state) {
					this.setAttribute('', state);
		};
	com_htmli_ui_Slideshow.prototype.getCurrent = function() {
				var me = this;
				var __value = this.getAttribute('');
				var current = __value;
				me.initSlides(); return me.currentSlide();
				return __value;
	};
	com_htmli_ui_Slideshow.prototype.play = function() {
		var me = this;
		me.initSlides();
		me.saveParams();
		if (me.outerNode.state != 'Playing') {
			if (me.getChildNodes().getLength() > 0) {
				me.outerNode.state = 'Playing';
				me.animate();
			}
		}
	};
com_htmli_ui_Slideshow.prototype.playAfter = function(time) {
		var me = this;
		var interval = (typeof(time) == 'undefined') ? me.getTime() : time;
		setTimeout(function() {me.play();}, interval);
	};
com_htmli_ui_Slideshow.prototype.pause = function() {
		var me = this;
		if (me.outerNode.state == 'Paused') {
			me.play();
		} else if (me.outerNode.state == 'Playing') {
			me.outerNode.state = 'Paused';
			me.finishTransition();
			clearTimeout(me.outerNode.active);
		}
	};
com_htmli_ui_Slideshow.prototype.stop = function() {
		var me = this;
		me.outerNode.state = 'Stopped';
		me.finishTransition();
		me.restartTransition();
		clearTimeout(me.outerNode.active);
	};
com_htmli_ui_Slideshow.prototype.last = function() {
		var me = this;
		if (!me.isPlaying()) {
			me.initSlides();
			me.cancelTransition();
			me.makeInvisible(me.currentSlide());
			me.gotoLastSlide();
			me.makeVisible(me.currentSlide());
			me.dispatchChangeEvent();
		}
	};
com_htmli_ui_Slideshow.prototype.first = function() {
		var me = this;
		if (!me.isPlaying()) {
			me.initSlides();
			me.cancelTransition();
			me.makeInvisible(me.currentSlide());
			me.gotoFirstSlide();
			me.makeVisible(me.currentSlide());
			me.dispatchChangeEvent();
		}
	};
com_htmli_ui_Slideshow.prototype.goNext = function() {
		var me = this;
		if (!me.isPlaying()) {
			me.initSlides();
			me.cancelTransition();
			me.makeInvisible(me.currentSlide());
			me.advance();
			me.makeVisible(me.currentSlide());
			me.dispatchChangeEvent();
		}
	};
com_htmli_ui_Slideshow.prototype.goBack = function() {
		var me = this;
		if (!me.isPlaying()) {
			me.initSlides();
			me.cancelTransition();
			me.getChildNodes().item(me.currentSlide()).fadeOut();
			me.back();
			me.makeVisible(me.currentSlide());
			me.dispatchChangeEvent();
		}
	};
com_htmli_ui_Slideshow.prototype._addEventListener = com_htmli_ui_Slideshow.prototype.addEventListener;
	com_htmli_ui_Slideshow.prototype._dispatchEvent = com_htmli_ui_Slideshow.prototype.dispatchEvent;
	com_htmli_ui_Slideshow.prototype.addEventListener = function(event, func, capture) {
			if (event == 'slidechange') {
				return this._addEventListenerFor(event, func);
			}
			if (event == 'change') {
				return this._addEventListenerFor(event, func);
			}
		return this._addEventListener(event, func, capture);
	};
	com_htmli_ui_Slideshow.prototype.dispatchEvent = function(event) {
			if (event.getType() == 'slidechange') {
				var aux;
				eval('com_htmli_ui_Slideshow.prototype.aux = function(ev) {'  + this.getAttribute('onslidechange') + '};');
				this.aux(event);
				return;
			}
			if (event.getType() == 'change') {
				var aux;
				eval('com_htmli_ui_Slideshow.prototype.aux = function(ev) {'  + this.getAttribute('onchange') + '};');
				this.aux(event);
				return;
			}
		return this._dispatchEvent(event);
	};
	com_htmli_ui_Slideshow.prototype._getListenersFor = function(event) {
		try {
			var ret = application.listeners[this.outerNode.id][event];
			return ret ? ret : new Array();
		} catch (e) {
			return new Array();
		}
	};
com_htmli_ui_Slideshow.TRANSITION_TIME = 500;
com_htmli_ui_Slideshow.TIME = 2000;
com_htmli_ui_Slideshow.STEP = 10;
com_htmli_ui_Slideshow.prototype.animate = function() {
	var me = this;
	var childNodes = me.getChildNodes();
	if (me.getTransition() == 'fade') {
		childNodes.item(this.nextSlide()).fadeOut();
		me.makeVisible(this.nextSlide());
		me.animateFade();
	} else if (me.getTransition() == 'box') {
	} else {
		me.animateShow();
	}
}
com_htmli_ui_Slideshow.prototype.animateShow = function() {
	var me = this;
	if (me.isPlaying()) {
		me.advance();
		me.makeInvisible(me.previousSlide());
		me.makeVisible(me.currentSlide());
		me.dispatchChangeEvent();
		this.outerNode.active = setTimeout(function() {me.animateShow();}, me.getTime());
	}
}
com_htmli_ui_Slideshow.prototype.restartShow = function() {
	var me = this;
	me.makeInvisible(me.currentSlide());
	me.gotoFirstSlide();
	me.makeVisible(me.currentSlide());
}
com_htmli_ui_Slideshow.prototype.animateFade = function() {
	var me = this;
	var childNodes = me.getChildNodes();
	if (me.isPlaying()) {
		var interval;
		var newFade = childNodes.item(me.currentSlide()).fadeOutBy(com_htmli_ui_Slideshow.STEP);
		childNodes.item(me.nextSlide()).fadeInBy(com_htmli_ui_Slideshow.STEP);
		if (newFade < 10) {
			me.dispatchChangeEvent();
			me.makeInvisible(me.currentSlide());
			childNodes.item(me.currentSlide()).fadeIn();
			me.advance();
			me.makeVisible(me.nextSlide());
			childNodes.item(me.nextSlide()).fadeOut();
			interval = me.getTime();
		} else {
			interval = me.getTransitionTime()/com_htmli_ui_Slideshow.STEP;
		}
		me.outerNode.active = setTimeout(function() {me.animateFade();}, interval);
	}
}
com_htmli_ui_Slideshow.prototype.finishFade = function() {
	var me = this;
	var childNodes = me.getChildNodes();
	if (childNodes.item(me.currentSlide()) && childNodes.item(me.currentSlide()).getFade()<100) {
		childNodes.item(me.currentSlide()).fadeIn();
		me.makeInvisible(me.currentSlide());
		childNodes.item(me.nextSlide()).fadeIn();
		me.advance();
		me.makeVisible(me.nextSlide());
		childNodes.item(me.nextSlide()).fadeOut();
	}
}
com_htmli_ui_Slideshow.prototype.finishTransition = function() {
	var me = this;
	if (me.getTransition() == 'fade') {
		me.finishFade();
	}
}
com_htmli_ui_Slideshow.prototype.cancelTransition = function() {
	var me = this;
	if (me.getTransition() == 'fade') {
		var me = this;
		var childNodes = me.getChildNodes();
		childNodes.item(me.nextSlide()).fadeIn();
		me.makeInvisible(me.nextSlide());
	}
}
com_htmli_ui_Slideshow.prototype.restartTransition = function() {
	var me = this;
	if (me.getTransition() == 'fade') {
		me.restartFade();
	} else {
		me.restartShow();
	}
	me.dispatchChangeEvent();
}
com_htmli_ui_Slideshow.prototype.restartFade = function() {
	var me = this;
	var childNodes = me.getChildNodes();
	if (childNodes.item(me.nextSlide())) {
		childNodes.item(me.nextSlide()).fadeIn();
	}
	me.makeInvisible(me.nextSlide());
	me.makeInvisible(me.currentSlide());
	me.gotoFirstSlide();
	me.makeVisible(me.currentSlide());
	childNodes.item(me.currentSlide()).fadeIn();
	me.makeVisible(me.nextSlide());
	childNodes.item(me.nextSlide()).fadeOut();
}
com_htmli_ui_Slideshow.prototype.makeVisible = function(slide) {
	if (this.getChildNodes().item(slide)) {
		this.getChildNodes().item(slide).getStyle().visibility = 'visible';
	}
}
com_htmli_ui_Slideshow.prototype.makeInvisible = function(slide) {
	if (this.getChildNodes().item(slide)) {
		this.getChildNodes().item(slide).getStyle().visibility = 'hidden';
	}
}
com_htmli_ui_Slideshow.prototype.initSlides = function() {
	if (typeof(this.outerNode.currentSlide) == 'undefined') {
			this.outerNode.currentSlide = 0;
	}
}
com_htmli_ui_Slideshow.prototype.isPlaying = function() {
	return this.outerNode.state == 'Playing';
}
com_htmli_ui_Slideshow.prototype.isStopped = function() {
	return this.outerNode.state == 'Stopped';
}
com_htmli_ui_Slideshow.prototype.isPaused = function() {
	return this.outerNode.state == 'Paused';
}
com_htmli_ui_Slideshow.prototype.previousSlide = function() {
	if (this.outerNode.currentSlide == 0) {
		return this.getChildNodes().getLength() - 1;
	} else {
		return this.outerNode.currentSlide-1;
	}
}
com_htmli_ui_Slideshow.prototype.nextSlide = function() {
	if (this.outerNode.currentSlide+1 == this.getChildNodes().getLength()) {
		return 0;
	}
	return this.outerNode.currentSlide +1;
}
com_htmli_ui_Slideshow.prototype.gotoFirstSlide = function() {
	return this.outerNode.currentSlide = 0;
}
com_htmli_ui_Slideshow.prototype.gotoLastSlide = function() {
	return this.outerNode.currentSlide = this.getChildNodes().getLength() - 1;
}
com_htmli_ui_Slideshow.prototype.gotoSlide = function(slide) {
	return this.outerNode.currentSlide = slide;
}
com_htmli_ui_Slideshow.prototype.currentSlide = function() {
	return this.outerNode.currentSlide;
}
com_htmli_ui_Slideshow.prototype.advance = function() {
	this.outerNode.currentSlide++;
	if (this.outerNode.currentSlide == this.getChildNodes().getLength()) {
		this.outerNode.currentSlide = 0;
	}
	return this.outerNode.currentSlide;
}
com_htmli_ui_Slideshow.prototype.back = function() {
	this.outerNode.currentSlide--;
	if (this.outerNode.currentSlide == -1) {
		this.outerNode.currentSlide = this.getChildNodes().getLength()-1;
	}
	return this.outerNode.currentSlide;
}
com_htmli_ui_Slideshow.prototype.saveParams = function() {
	if (this.getTime()) {
		this.outerNode.time = this.getTime();
	} else {
		this.outerNode.time = com_htmli_ui_Slideshow.TIME;
	}
	if (this.getTransitionTime()) {
		this.outerNode.transitionTime = this.getTransitionTime();
	} else {
		this.outerNode.transitionTime = com_htmli_ui_Slideshow.TRANSITION_TIME;
	}
}
com_htmli_ui_Slideshow.prototype.getTime = function() {
	return this.outerNode.time;
}
com_htmli_ui_Slideshow.prototype.getTransitionTime = function() {
	return this.outerNode.transitionTime;
}
com_htmli_ui_Slideshow.prototype.debug = function() {
	var me = this;
	var childNodes = me.getChildNodes();
	for (var i=0; i< childNodes.getLength(); i++) {
		alert(childNodes.item(i).getStyle().filter + ", " + childNodes.item(i).getStyle().visibility);
	}
}
com_htmli_ui_Slideshow.prototype.dispatchChangeEvent = function() {
	var me = this;
	setTimeout(function() {
		var newEvent = application.createEvent('HTMLiEvents');
		newEvent.initHTMLiEvent('slidechange', this);
		me.dispatchEvent(newEvent);
	}, 1);
};
function com_htmli_ui_SlideTitle(outerNode) {
	this.init(outerNode, 'com.htmli.ui.SlideTitle', 'SlideTitle');
		this.innerNode = outerNode.childNodes[1];
}
com_htmli_ui_SlideTitle.prototype = new HTMLiElement();
com_htmli_ui_SlideTitle.prototype.getClickAction = function() {
				return this.getAttribute('clickaction');
	};
	com_htmli_ui_SlideTitle.prototype.setClickAction = function(clickAction) {
					this.setAttribute('clickaction', clickAction);
		};
	com_htmli_ui_SlideTitle.prototype.getDblClickAction = function() {
				return this.getAttribute('dblclickaction');
	};
	com_htmli_ui_SlideTitle.prototype.setDblClickAction = function(dblClickAction) {
					this.setAttribute('dblclickaction', dblClickAction);
		};
	com_htmli_ui_SlideTitle.prototype.getTitle = function() {
				return this.getAttribute('title');
	};
	com_htmli_ui_SlideTitle.prototype.setTitle = function(title) {
					this.setAttribute('title', title);
		};
	com_htmli_ui_SlideTitle.prototype.getNotes = function() {
				var me = this;
				var __value = this.getAttribute('');
				var notes = __value;
				return me.outerNode.firstChild.childNodes[1].innerHTML;
				return __value;
	};
	com_htmli_ui_SlideTitle.prototype.getNotesOpacity = function() {
				var value = this.getAttribute('notesopacity');
				return value == null ? 0 : value;
	};
	com_htmli_ui_SlideTitle.prototype.setNotesOpacity = function(notesOpacity) {
					this.setAttribute('notesopacity', notesOpacity);
		};
	com_htmli_ui_SlideTitle.prototype.toggleNotes = function() {
		var me = this;
		if (this.outerNode.childNodes[1].style.display == 'none') {
			me.showNotes();
		} else {
			me.hideNotes();
		}
	};
com_htmli_ui_SlideTitle.prototype.showNotes = function() {
		var me = this;
		this.outerNode.childNodes[1].style.display = 'block';
	};
com_htmli_ui_SlideTitle.prototype.hideNotes = function() {
		var me = this;
		me.outerNode.childNodes[1].style.display = 'none';
	};
com_htmli_ui_SlideTitle.prototype._addEventListener = com_htmli_ui_SlideTitle.prototype.addEventListener;
	com_htmli_ui_SlideTitle.prototype._dispatchEvent = com_htmli_ui_SlideTitle.prototype.dispatchEvent;
	com_htmli_ui_SlideTitle.prototype.addEventListener = function(event, func, capture) {
			if (event == 'show') {
				return this._addEventListenerFor(event, func);
			}
		return this._addEventListener(event, func, capture);
	};
	com_htmli_ui_SlideTitle.prototype.dispatchEvent = function(event) {
			if (event.getType() == 'show') {
				var aux;
				eval('com_htmli_ui_SlideTitle.prototype.aux = function(ev) {'  + this.getAttribute('onshow') + '};');
				this.aux(event);
				return;
			}
		return this._dispatchEvent(event);
	};
	com_htmli_ui_SlideTitle.prototype._getListenersFor = function(event) {
		try {
			var ret = application.listeners[this.outerNode.id][event];
			return ret ? ret : new Array();
		} catch (e) {
			return new Array();
		}
	};
com_htmli_ui_SlideTitle.state = 0;
com_htmli_ui_SlideTitle.prototype.onClick = function(me, ev) {
	if (!me.outerNode.clickAction) {
		me.outerNode.clickAction = me.getClickAction();
	}
	this.takeAction(me.outerNode.clickAction);
};
com_htmli_ui_SlideTitle.prototype.onDblClick = function(me, ev) {
	if (!me.outerNode.dblClickAction) {
		me.outerNode.dblClickAction = me.getDblClickAction();
	}
	this.takeAction(me.outerNode.dblClickAction);
};
com_htmli_ui_SlideTitle.prototype.takeAction = function(action) {
	if (action == 'next') {
		this.getParentNode().goNext();
	} else if (action == 'notes') {
		this.toggleNotes();
	}
};
com_htmli_ui_SlideTitle.prototype.dispatchShow = function() {
	var newEvent = application.createEvent('HTMLiEvents');
	newEvent.initHTMLiEvent('show', this);
	this.dispatchEvent(newEvent);
};
function com_htmli_ui_Source(outerNode) {
	this.init(outerNode, 'com.htmli.ui.Source', 'Source');
}
com_htmli_ui_Source.prototype = new HTMLiElement();
com_htmli_ui_Source.prototype.getUrl = function() {
				return this.getAttribute('url');
	};
	com_htmli_ui_Source.prototype.setUrl = function(url) {
					this.setAttribute('url', url);
		};
	com_htmli_ui_Source.prototype.isOpened = function() {
		var me = this;
		return me.outerNode.innerHTML != '';
	};
com_htmli_ui_Source.prototype.open = function(handler) {
		var me = this;
		me.container = new Container(me.outerNode);
		me.container.open(me.getUrl() + '?' + new Date().getTime(), handler);
	};
com_htmli_ui_Source.prototype.close = function() {
		var me = this;
		me.outerNode.innerHTML = '';
	};
com_htmli_ui_Source.prototype.getChildContainer = function() {
		var me = this;
		return new Container(me.outerNode);
	};
function com_htmli_ui_Tab(outerNode) {
	this.init(outerNode, 'com.htmli.ui.Tab', 'Tab');
		this.innerNode = outerNode.childNodes[0];
}
com_htmli_ui_Tab.prototype = new HTMLiElement();
com_htmli_ui_Tab.prototype.getCaption = function() {
				return this.getAttribute('caption');
	};
	com_htmli_ui_Tab.prototype.getIcon = function() {
				return this.getAttribute('icon');
	};
	com_htmli_ui_Tab.prototype.focus = function() {
		var me = this;
		me.outerNode.className = 'com_htmli_ui_Tab__selected';
	};
com_htmli_ui_Tab.prototype.blur = function() {
		var me = this;
		me.outerNode.className = 'com_htmli_ui_Tab__disabled';
	};
com_htmli_ui_Tab.prototype._addEventListener = com_htmli_ui_Tab.prototype.addEventListener;
	com_htmli_ui_Tab.prototype._dispatchEvent = com_htmli_ui_Tab.prototype.dispatchEvent;
	com_htmli_ui_Tab.prototype.addEventListener = function(event, func, capture) {
			if (event == 'headerclick') {
				return this._addEventListenerFor(event, func);
			}
		return this._addEventListener(event, func, capture);
	};
	com_htmli_ui_Tab.prototype.dispatchEvent = function(event) {
			if (event.getType() == 'headerclick') {
				var aux;
				eval('com_htmli_ui_Tab.prototype.aux = function(ev) {'  + this.getAttribute('onheaderclick') + '};');
				this.aux(event);
				return;
			}
		return this._dispatchEvent(event);
	};
	com_htmli_ui_Tab.prototype._getListenersFor = function(event) {
		try {
			var ret = application.listeners[this.outerNode.id][event];
			return ret ? ret : new Array();
		} catch (e) {
			return new Array();
		}
	};
function com_htmli_ui_TabPane(outerNode) {
	this.init(outerNode, 'com.htmli.ui.TabPane', 'TabPane');
try {
	var aux = outerNode.childNodes[0].childNodes[0].childNodes[1];
	if (aux.getAttribute('htmliinner') != null) {
		this.innerNode = aux;
		return;
	}
} catch (e) {}
try {
	var aux = outerNode.childNodes[0].childNodes[0].childNodes[1];
	if (aux.getAttribute('htmliinner') != null) {
		this.innerNode = aux;
		return;
	}
} catch (e) {}
try {
	var aux = outerNode.childNodes[0].childNodes[0].childNodes[0];
	if (aux.getAttribute('htmliinner') != null) {
		this.innerNode = aux;
		return;
	}
} catch (e) {}
try {
	var aux = outerNode.childNodes[0].childNodes[0].childNodes[0];
	if (aux.getAttribute('htmliinner') != null) {
		this.innerNode = aux;
		return;
	}
} catch (e) {}
try {
	var aux = outerNode.childNodes[0].childNodes[1].childNodes[0];
	if (aux.getAttribute('htmliinner') != null) {
		this.innerNode = aux;
		return;
	}
} catch (e) {}
}
com_htmli_ui_TabPane.prototype = new HTMLiElement();
com_htmli_ui_TabPane.prototype.getPosition = function() {
				return this.getAttribute('position');
	};
	com_htmli_ui_TabPane.prototype.getEnd = function() {
				return this.getAttribute('end');
	};
	com_htmli_ui_TabPane.prototype.getSelectedIndex = function() {
				var value = this.getAttribute('selectedIndex');
				return value == null ? 0 : value;
	};
	com_htmli_ui_TabPane.prototype.setSelectedIndex = function(selectedIndex) {
					this.setAttribute('selectedIndex', selectedIndex);
		};
	com_htmli_ui_TabPane.prototype.focusChild = function(index) {
		var me = this;
		if (index >= 0 && index < me.getChildNodes().getLength()) {
			var children = me.getChildNodes();
			for (var i=0; i < children.getLength(); i++) {
				if (i == index) {
					children.item(i).focus();
					var newEvent = application.createEvent('HTMLiEvents');
					newEvent.initHTMLiEvent('headerclick', children.item(i));
					children.item(i).dispatchEvent(newEvent);
				} else {
					children.item(i).blur();
				}
			}
			var position = me.getPosition();
			if (!position) {
				position = 'top'
			}
			var vertical = (position=='left' || position=='right');
			if (position == 'bottom') {
				var children = me.outerNode.firstChild.lastChild.firstChild.firstChild.firstChild.firstChild.childNodes;
			} else if (position == 'left') {
				var children = me.outerNode.firstChild.childNodes;
			} else if (position == 'right') {
				var children = me.outerNode.lastChild.childNodes;
			} else {
				var children = me.outerNode.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.childNodes;
			}
			var i = me.getEnd()?1:0;
			for (; i < children.length-1; i+=2) {
				if (Math.floor(i/2) == index) {
					if (position=='left') {
						children.item(i).firstChild.className = 'com_htmli_ui_TabPane__selectedleft_' + position;
						children.item(i+1).firstChild.className = 'com_htmli_ui_TabPane__selectedright_' + position;
					} else if (position=='right') {
						children.item(i).lastChild.className = 'com_htmli_ui_TabPane__selectedleft_' + position;
						children.item(i+1).lastChild.className = 'com_htmli_ui_TabPane__selectedright_' + position;
					} else {
						children.item(i).className = 'com_htmli_ui_TabPane__selectedleft_' + position;
						children.item(i+1).className = 'com_htmli_ui_TabPane__selectedright_' + position;
					}
				} else {
					if (position=='left') {
						children.item(i).firstChild.className = 'com_htmli_ui_TabPane__itemleft_' + position;
						children.item(i+1).firstChild.className = 'com_htmli_ui_TabPane__itemright_' + position;
					} else if (position=='right') {
						children.item(i).lastChild.className = 'com_htmli_ui_TabPane__itemleft_' + position;
						children.item(i+1).lastChild.className = 'com_htmli_ui_TabPane__itemright_' + position;
					} else {
						children.item(i).className = 'com_htmli_ui_TabPane__itemleft_' + position;
						children.item(i+1).className = 'com_htmli_ui_TabPane__itemright_' + position;
					}
				}
			}
		}
	};
com_htmli_ui_TabPane.prototype._addEventListener = com_htmli_ui_TabPane.prototype.addEventListener;
	com_htmli_ui_TabPane.prototype._dispatchEvent = com_htmli_ui_TabPane.prototype.dispatchEvent;
	com_htmli_ui_TabPane.prototype.addEventListener = function(event, func, capture) {
			if (event == 'headerclick') {
				return this._addEventListenerFor(event, func);
			}
		return this._addEventListener(event, func, capture);
	};
	com_htmli_ui_TabPane.prototype.dispatchEvent = function(event) {
			if (event.getType() == 'headerclick') {
				var aux;
				eval('com_htmli_ui_TabPane.prototype.aux = function(ev) {'  + this.getAttribute('onheaderclick') + '};');
				this.aux(event);
				return;
			}
		return this._dispatchEvent(event);
	};
	com_htmli_ui_TabPane.prototype._getListenersFor = function(event) {
		try {
			var ret = application.listeners[this.outerNode.id][event];
			return ret ? ret : new Array();
		} catch (e) {
			return new Array();
		}
	};
com_htmli_ui_TabPane.prototype.onClick  = function(current, position, ev) {
	current.focusChild(position);
	this.setSelectedIndex(position);
	this.dispatchResize(ev);
	return false;
};
com_htmli_ui_TabPane.prototype.dispatchResize = function(ev) {
	var newEvent = application.createEvent('HTMLiEvents');
	newEvent.initHTMLiEvent('headerclick', this);
	this.dispatchEvent(newEvent);
};
function com_htmli_ui_Window(outerNode) {
	this.init(outerNode, 'com.htmli.ui.Window', 'Window');
try {
	var aux = outerNode.childNodes[3].childNodes[0].childNodes[0].childNodes[1].childNodes[1].childNodes[0];
	if (aux.getAttribute('htmliinner') != null) {
		this.innerNode = aux;
		return;
	}
} catch (e) {}
try {
	var aux = outerNode.childNodes[3].childNodes[0].childNodes[0].childNodes[1].childNodes[1].childNodes[0];
	if (aux.getAttribute('htmliinner') != null) {
		this.innerNode = aux;
		return;
	}
} catch (e) {}
}
com_htmli_ui_Window.prototype = new HTMLiElement();
com_htmli_ui_Window.prototype.getUrl = function() {
				return this.getAttribute('url');
	};
	com_htmli_ui_Window.prototype.setUrl = function(url) {
					this.setAttribute('url', url);
		};
	com_htmli_ui_Window.prototype.getIcon = function() {
				return this.getAttribute('icon');
	};
	com_htmli_ui_Window.prototype.setIcon = function(icon) {
					this.setAttribute('icon', icon);
		};
	com_htmli_ui_Window.prototype.getCaption = function() {
				return this.getAttribute('caption');
	};
	com_htmli_ui_Window.prototype.setCaption = function(caption) {
					var me = this;
					var __value = caption;
		me.outerNode.childNodes[3].firstChild.firstChild.firstChild.childNodes[1].firstChild.innerHTML = caption;
					this.setAttribute('caption', __value);
		};
	com_htmli_ui_Window.prototype.getResizeMode = function() {
				return this.getAttribute('resizemode');
	};
	com_htmli_ui_Window.prototype.setResizeMode = function(resizeMode) {
					this.setAttribute('resizemode', resizeMode);
		};
	com_htmli_ui_Window.prototype.getDndMode = function() {
				return this.getAttribute('dndmode');
	};
	com_htmli_ui_Window.prototype.setDndMode = function(dndMode) {
					this.setAttribute('dndmode', dndMode);
		};
	com_htmli_ui_Window.prototype.getState = function() {
				var me = this;
				var __value = this.getAttribute('state');
				var state = __value;
				if (__value == null) { __value = 'normal'; }
				return __value;
	};
	com_htmli_ui_Window.prototype.setState = function(state) {
					this.setAttribute('state', state);
		};
	com_htmli_ui_Window.prototype.getNoCloseButton = function() {
				return this.getAttribute('noclosebutton');
	};
	com_htmli_ui_Window.prototype.getNoMaxButton = function() {
				return this.getAttribute('nomaxbutton');
	};
	com_htmli_ui_Window.prototype.getNoMinButton = function() {
				return this.getAttribute('nominbutton');
	};
	com_htmli_ui_Window.prototype.getHelpButton = function() {
				return this.getAttribute('helpbutton');
	};
	com_htmli_ui_Window.prototype.getNotResizable = function() {
				var value = this.getAttribute('notresizable');
				return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
	};
	com_htmli_ui_Window.prototype.setNotResizable = function(notResizable) {
					this.setAttribute('notresizable', notResizable ? 'true' : 'false');
		};
	com_htmli_ui_Window.prototype.getNotDraggable = function() {
				var value = this.getAttribute('notdraggable');
				return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
	};
	com_htmli_ui_Window.prototype.setNotDraggable = function(notDraggable) {
					this.setAttribute('notdraggable', notDraggable ? 'true' : 'false');
		};
	com_htmli_ui_Window.prototype.getRememberSize = function() {
				var value = this.getAttribute('remembersize');
				return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
	};
	com_htmli_ui_Window.prototype.setRememberSize = function(rememberSize) {
					this.setAttribute('remembersize', rememberSize ? 'true' : 'false');
		};
	com_htmli_ui_Window.prototype.isOpened = function() {
		var me = this;
		return me.outerNode.style.display == 'block';
	};
com_htmli_ui_Window.prototype.open = function(handler) {
		var me = this;
		if (me.isOpened()) {
			me.top();
			return;
		}
		me.outerNode.style.display = 'block';
		if (!document.all) {
			me.outerNode.firstChild.style.display = "none";
		}
		//me.getCookies();
		var table = application.wrapNode(me.outerNode.childNodes[3].firstChild);
		var width = me.outerNode.width? me.outerNode.width : me.outerNode.style.width? me.outerNode.style.width: table.getWidth()? table.getWidth()+ 'px' :  com_htmli_ui_Window.MINIMIZED_WIDTH;
		var height = me.outerNode.height? me.outerNode.height : me.outerNode.style.height? me.outerNode.style.height : table.getHeight()? table.getHeight() + 'px' : com_htmli_ui_Window.MINIMIZED_HEIGHT;
		me.outerNode.closeButton = me.outerNode.childNodes[3].firstChild.firstChild.firstChild.childNodes[2].firstChild.childNodes[0];
		me.outerNode.maxButton = me.outerNode.childNodes[3].firstChild.firstChild.firstChild.childNodes[2].firstChild.childNodes[1];
		me.outerNode.restoreButton = me.outerNode.childNodes[3].firstChild.firstChild.firstChild.childNodes[2].firstChild.childNodes[2];
		me.outerNode.minButton = me.outerNode.childNodes[3].firstChild.firstChild.firstChild.childNodes[2].firstChild.childNodes[3];
		me.outerNode.helpButton = me.outerNode.childNodes[3].firstChild.firstChild.firstChild.childNodes[2].firstChild.childNodes[4];
		me.resizeTo(width, height, true, true);
		if (me.getIcon()) {
			me.outerNode.childNodes[3].firstChild.firstChild.firstChild.childNodes[1].childNodes[1].style.left = '20px';
		}
		var style = application.wrapNode(me.outerNode.childNodes[3].firstChild.firstChild.firstChild.childNodes[2].firstChild).getStyle();
		style.width = me.getButtonBarWidth() + "px";
		style = application.wrapNode(me.outerNode.childNodes[3].firstChild.firstChild.firstChild.childNodes[1]).getStyle();
		style.width = parseInt(width) - me.getButtonBarWidth() + "px";
		me.push();
		me.top();
		if (me.getUrl()) {
			var childContainer = new Container(me.innerNode);
			childContainer.open(me.getUrl() + '?' + new Date().getTime(), handler);
		}
		if (!me.outerNode.style.top && !me.outerNode.style.left) {
			me.outerNode.style.top = com_htmli_ui_Window.getNextTop(height) - me.getContainingBlock().getRelativeY() + "px";
			me.outerNode.style.left = com_htmli_ui_Window.getNextLeft(width) - me.getContainingBlock().getRelativeX()  + "px";
		}
		me.setState('normal');
	};
com_htmli_ui_Window.prototype.openExclusive = function(handler) {
		var me = this;
		me.open();
		me.center();
		var height = com_htmli_ui_Window.getMaxHeight() + "px";
		var width = com_htmli_ui_Window.getMaxWidth() + "px";
		var top = me.getY();
		var left = me.getX();
		var style = me.outerNode.childNodes[2].style;
		style.height = height;
		style.width = width;
		style.display = '';
		style.top = (-top) + "px";
		style.left = (-left) + "px";
		me.setNotDraggable(true);
	};
com_htmli_ui_Window.prototype.openMaximized = function(handler) {
		var me = this;
		me.open(handler);
		me.maximize();
	};
com_htmli_ui_Window.prototype.openMinimized = function(handler) {
		var me = this;
		me.open(handler);
		me.minimize();
	};
com_htmli_ui_Window.prototype.openCentered = function(handler) {
		var me = this;
		me.center();
		me.open(handler);
	};
com_htmli_ui_Window.prototype.close = function() {
		var me = this;
		if (me.getState().indexOf('minimized') >= 0) {
			me.loadSizeMin(me.getId());
		}
		me.outerNode.style.display = 'none';
		com_htmli_ui_Window.remove(me);
		com_htmli_ui_Window.refreshActive(true);
		if (me.getUrl()) {
			me.innerNode.innerHTML = '';
		}
		com_htmli_ui_Window.nextTop = 30;
		com_htmli_ui_Window.nextLeft = 30;
	};
com_htmli_ui_Window.prototype.getChildContainer = function() {
		var me = this;
		return new Container(this.innerNode);
	};
com_htmli_ui_Window.prototype.top = function(ev) {
		var me = this;
		if (!ev || !ev.isDefaultPrevented()) {
			me.outerNode.style.zIndex = application.nextZIndex++;
			com_htmli_ui_Window.remove(me);
			com_htmli_ui_Window.active.push(me);
			com_htmli_ui_Window.refreshActive();
		}
	};
com_htmli_ui_Window.prototype.minimize = function() {
		var me = this;
	var position = me.saveSizeMin(me.getX(), me.getY(),
					me.outerNode.childNodes[1].style.width, me.outerNode.childNodes[1].style.height, me.getId());
	this.outerNode.restoreButton.style.display = '';
	this.outerNode.minButton.style.display = 'none';
	var height = com_htmli_ui_Window.MINIMIZED_HEIGHT;
	var width = com_htmli_ui_Window.MINIMIZED_WIDTH;
	if (position >= 0) {
		var length = position;
	} else {
		var length = com_htmli_ui_Window.minimized.length-1;
	}
	var rowsize = Math.floor(application.getDocumentElement().getWidth()/parseFloat(width));
	var row = Math.floor(length / rowsize);
	var col = length % rowsize;
	var bottom = parseFloat(height) * row + 'px';
	var left = parseFloat(width) * col + 'px';
	var style = me.outerNode.style;
	style.top = null;
	style.bottom = bottom;
	style.left = left;
	me.resizeTo(width, height, true, true);
	me.dispatchMinimize();
	me.setState('minimized');
	com_htmli_ui_Window.shiftTop();
	com_htmli_ui_Window.refreshActive(true);
	};
com_htmli_ui_Window.prototype.restore = function() {
		var me = this;
	if (this.getState().indexOf('maximized') >= 0) {
		return this.restoreMax();
	} else if (this.getState().indexOf('minimized') >= 0) {
		return this.restoreMin();
	}
	};
com_htmli_ui_Window.prototype.maximize = function() {
		var me = this;
	this.saveSizeMax();
	this.outerNode.restoreButton.style.display = '';
	this.outerNode.maxButton.style.display = 'none';
	var height = com_htmli_ui_Window.getMaxHeight() + "px";
	var width = com_htmli_ui_Window.getMaxWidth() + "px";
	if (height!="0px" && width!="0px") {
		this.resizeTo(width, height, true, true);
		this.moveTo(0, 0);
		this.setState('maximized');
		me.dispatchMaximize();
	}
	};
com_htmli_ui_Window.prototype._addEventListener = com_htmli_ui_Window.prototype.addEventListener;
	com_htmli_ui_Window.prototype._dispatchEvent = com_htmli_ui_Window.prototype.dispatchEvent;
	com_htmli_ui_Window.prototype.addEventListener = function(event, func, capture) {
			if (event == 'helpclick') {
				return this._addEventListenerFor(event, func);
			}
			if (event == 'resizewindow') {
				return this._addEventListenerFor(event, func);
			}
			if (event == 'maxwindow') {
				return this._addEventListenerFor(event, func);
			}
			if (event == 'minwindow') {
				return this._addEventListenerFor(event, func);
			}
		return this._addEventListener(event, func, capture);
	};
	com_htmli_ui_Window.prototype.dispatchEvent = function(event) {
			if (event.getType() == 'helpclick') {
				var aux;
				eval('com_htmli_ui_Window.prototype.aux = function(ev) {'  + this.getAttribute('onhelpclick') + '};');
				this.aux(event);
				return;
			}
			if (event.getType() == 'resizewindow') {
				var aux;
				eval('com_htmli_ui_Window.prototype.aux = function(ev) {'  + this.getAttribute('onresizewindow') + '};');
				this.aux(event);
				return;
			}
			if (event.getType() == 'maxwindow') {
				var aux;
				eval('com_htmli_ui_Window.prototype.aux = function(ev) {'  + this.getAttribute('onmaxwindow') + '};');
				this.aux(event);
				return;
			}
			if (event.getType() == 'minwindow') {
				var aux;
				eval('com_htmli_ui_Window.prototype.aux = function(ev) {'  + this.getAttribute('onminwindow') + '};');
				this.aux(event);
				return;
			}
		return this._dispatchEvent(event);
	};
	com_htmli_ui_Window.prototype._getListenersFor = function(event) {
		try {
			var ret = application.listeners[this.outerNode.id][event];
			return ret ? ret : new Array();
		} catch (e) {
			return new Array();
		}
	};
com_htmli_ui_Window.resizingTable = null;
com_htmli_ui_Window.resizingAxis = null;
com_htmli_ui_Window.resizingBase = null;
com_htmli_ui_Window.dndTarget = null;
com_htmli_ui_Window.dndCoords = null;
com_htmli_ui_Window.minimized = null;
com_htmli_ui_Window.maximized = null;
com_htmli_ui_Window.nextTop = 30;
com_htmli_ui_Window.nextLeft = 30;
com_htmli_ui_Window.xAdd = true;
com_htmli_ui_Window.yAdd = true;
com_htmli_ui_Window.active = new Array();
com_htmli_ui_Window.MINIMIZED_HEIGHT = '34px';
com_htmli_ui_Window.MINIMIZED_WIDTH = '200px';
com_htmli_ui_Window.IFRAME_TOPMARGIN = '5px';
com_htmli_ui_Window.IFRAME_LEFTMARGIN = '4px';
com_htmli_ui_Window.prototype.click = function(obj, ev) {
	this.showMenu(ev);
	ev.stopPropagation();
};
com_htmli_ui_Window.prototype.saveSizeMax = function() {
	com_htmli_ui_Window.maximized = new Object();
	com_htmli_ui_Window.maximized.x = this.getRelativeX();
	com_htmli_ui_Window.maximized.y = this.getRelativeY();
	com_htmli_ui_Window.maximized.width = this.outerNode.childNodes[1].style.width;
	com_htmli_ui_Window.maximized.height = this.outerNode.childNodes[1].style.height;
};
com_htmli_ui_Window.prototype.restoreMax = function() {
	var x = com_htmli_ui_Window.maximized.x;
	var y = com_htmli_ui_Window.maximized.y;
	var width = com_htmli_ui_Window.maximized.width;
	var height = com_htmli_ui_Window.maximized.height;
	this.resizeTo(width, height, true, true);
	this.moveTo(x, y);
	this.outerNode.restoreButton.style.display = 'none';
	this.outerNode.maxButton.style.display = '';
	this.setState('normal');
	this.dispatchResize();
};
com_htmli_ui_Window.prototype.saveSizeMin = function(x, y, width, height, id) {
	var minimized = new Object();
	minimized.id = id;
	minimized.x = x;
	minimized.y = y;
	minimized.width = width;
	minimized.height = height;
	if (com_htmli_ui_Window.minimized == null || com_htmli_ui_Window.minimized.length == 0) {
		minimized.position = 0;
		com_htmli_ui_Window.minimized = new Array(minimized);
	} else {
		minimized.position = com_htmli_ui_Window.length;
		var position = this.searchFirstBlank();
		if (position >= 0) {
			com_htmli_ui_Window.minimized[position] = minimized;
			return position;
		} else {
			com_htmli_ui_Window.minimized.push(minimized);
			return -1;
		}
	}
};
com_htmli_ui_Window.prototype.loadSizeMin = function(id) {
	var length=com_htmli_ui_Window.minimized.length;
	for (var i=0; i<length; i++) {
		var win = com_htmli_ui_Window.minimized[i];
		if (win!=null && win.id == id) {
			com_htmli_ui_Window.minimized[i]=null;
			return win;
		}
	}
};
com_htmli_ui_Window.prototype.searchFirstBlank = function() {
	var length=com_htmli_ui_Window.minimized.length;
	for (var i = 0; i<length; i++) {
		if (com_htmli_ui_Window.minimized[i]==null) {
			return i;
		}
	}
	return -1;
};
com_htmli_ui_Window.prototype.restoreMin = function() {
	var win = this.loadSizeMin(this.getId());
	var x = win.x;
	var y = win.y;
	var width = win.width;
	var height = win.height;
	this.resizeTo(width, height, true, true);
	this.moveTo(x, y);
	this.outerNode.minButton.style.display = '';
	this.outerNode.restoreButton.style.display = 'none';
	this.setState('normal');
	com_htmli_ui_Window.active.push(this);
	com_htmli_ui_Window.refreshActive();
};
com_htmli_ui_Window.prototype.startDnd = function(x, y) {
	if (this.getState().indexOf('maximized') < 0  && this.getState().indexOf('minimized') < 0 &&
		(!this.getNotDraggable())) {
		com_htmli_ui_Window.dndTarget = this;
		com_htmli_ui_Window.dndCoords = [x, y];
		var style =  com_htmli_ui_Window.dndTarget.outerNode.style;
		if (!style.top && !style.left) {
			style.top =  com_htmli_ui_Window.dndTarget.getRelativeY() + "px";
			style.left =  com_htmli_ui_Window.dndTarget.getRelativeX() + "px";
		}
		if (!this.getDndMode() || this.getDndMode().indexOf('outline')>=0) {
			style =  com_htmli_ui_Window.dndTarget.outerNode.childNodes[1].style;
			if (!style.top && !style.left) {
				style.top =  "0px";
				style.left =  "0px";
			}
		}
	}
};
com_htmli_ui_Window.prototype.startResize = function(horizontal, vertical) {
	if (this.getState().indexOf('maximized') < 0  && this.getState().indexOf('minimized') < 0
		&& (this.getNotResizable()!=null && !this.getNotResizable()) ) {
		com_htmli_ui_Window.resizingTable = this;
		com_htmli_ui_Window.resizingBase = [this.getX(), this.getY()];
		com_htmli_ui_Window.resizingAxis = [horizontal, vertical];
	}
};
com_htmli_ui_Window.prototype.resizeTo = function(width, height, changeDashed, ignoreRememberSize) {
	this.resizeToW(width, changeDashed);
	this.resizeToH(height, changeDashed);
	/*
	if (!ignoreRememberSize && this.getRememberSize()) {
		var id = this.outerNode.id;
		var date = new Date();
		date.setTime(new Date().getTime()+(365*24*60*60*1000));
		var expires = 'expires=' + date.toGMTString() + ';';
		document.cookie = id + '_SZ='+ width + '*' + height +'; '+ expires;
	}
	*/
};
/*
com_htmli_ui_Window.prototype.getCookies = function() {
	if (this.getRememberSize()) {
		var cookies = document.cookie.split(';');
		var id = this.outerNode.id;
		var width, height;
		for (var i=0; i < cookies.length; i++) {
			var c = cookies[i];
			while (c.charAt(0)==' ') {
				c = c.substring(1, c.length);
			}
			if (c.indexOf(id + '_SZ=') == 0) {
				width = c.substring(id.length+4, c.indexOf('px'));
				height= c.substring(c.indexOf('px')+3, c.length-2);
			}
		}
		this.outerNode.width = parseInt(width);
		this.outerNode.height = parseInt(height);
	}
};*/
com_htmli_ui_Window.prototype.resizeToW = function(width, changeDashed) {
	if (parseInt(width) < (this.getButtonBarWidth()+ 10))
	{
		width = (this.getButtonBarWidth() + 10) + "px";
		this.outerNode.childNodes[1].style.width = width;
	}
	this.outerNode.style.width = (parseFloat(width)-8) + "px";
	this.outerNode.lastChild.style.width = width;
	this.outerNode.firstChild.style.width = (parseFloat(width)) + "px";
	if (changeDashed) {
		this.outerNode.childNodes[1].style.width = width;
	}
	if (this.getUrl()) {
		var style = this.innerNode.style;
		style.width = (parseFloat(width)-8 < 0)? "0px" : (parseFloat(width)-8) + "px";
	} else {
		var style = this.innerNode.style;
		style.width = (parseFloat(width)-8 < 0)? "0px" : (parseFloat(width)-8) + "px";
	}
	style = this.outerNode.childNodes[3].firstChild.firstChild.firstChild.childNodes[1].style;
	style.width = (parseFloat(width) - this.getButtonBarWidth()) + "px";
};
com_htmli_ui_Window.prototype.resizeToH = function(height, changeDashed) {
	if (parseInt(height) < 35)
	{
		height = "35px";
		this.outerNode.childNodes[1].style.height = height;
	}
	this.outerNode.style.height = height;
	this.outerNode.lastChild.style.height = height;
	if (parseFloat(height) > 5) {
		this.outerNode.firstChild.style.height = (parseFloat(height)) + "px";
	}
	if (changeDashed) {
		this.outerNode.childNodes[1].style.height = height;
	}
	if (this.getUrl()) {
		var style = this.innerNode.style;
		style.height = (parseFloat(height)-34 < 0)? "0px" : (parseFloat(height)-34) + "px";
	} else {
		var style = this.innerNode.style;
		style.height = (parseFloat(height)-34 < 0)? "0px" : (parseFloat(height)-34) + "px";
	}
};
com_htmli_ui_Window.prototype.moveTo = function(x, y) {
	var style = this.outerNode.style;
	style.top = y + "px";
	style.left = x + "px";
};
com_htmli_ui_Window.prototype.onTitleDown = function(obj, ev) {
	if (this.getState().indexOf('minimized') < 0) {
		this.startDnd(ev.getClientX(), ev.getClientY());
	}
	return false;
};
com_htmli_ui_Window.prototype.onTitleDblClick = function(obj, ev) {
	if (this.getNoMaxButton() == '') {
		if (this.getState().indexOf('minimized') >= 0) {
			this.restoreMin();
		}
		else if (this.getState().indexOf('normal') >= 0) {
			this.maximize();
		}
		else if (this.getState().indexOf('maximized') >= 0) {
			this.restoreMax();
		}
	}
};
com_htmli_ui_Window.prototype.onMaxClick = function() {
	if (this.getState().indexOf('minimized') >= 0) {
		this.restore();
		this.maximize();
	}
	else {
		this.maximize();
	}
};
com_htmli_ui_Window.prototype.onMinClick = function() {
	if (this.getState().indexOf('maximized') >= 0) {
		this.restore();
		this.minimize();
	}
	else {
		this.minimize();
	}
};
com_htmli_ui_Window.prototype.onHelpClick = function(obj, ev) {
	var newEvent = application.createEvent('HTMLiEvents');
	newEvent.initHTMLiEvent('helpclick', this);
	this.dispatchEvent(newEvent);
	return false;
};
com_htmli_ui_Window.prototype.getButtonBarWidth = function() {
	var closeWidth = (this.getNoCloseButton())? 0: 23;
	var maxWidth = (this.getNoMaxButton())? 0: 23;
	var minWidth = (this.getNoMinButton())? 0: 23;
	var helpWidth = (this.getHelpButton())? 23: 0;
	return (closeWidth + maxWidth + minWidth + helpWidth + 5);
};
com_htmli_ui_Window.remove = function(obj) {
	if (com_htmli_ui_Window.active.length>0) {
		var active = com_htmli_ui_Window.active;
		var length = active.length;
		for (var i=length-1; i>=0; i--) {
			var window = active[i];
			if (window.outerNode.id == obj.outerNode.id) {
				active.splice(i,1);
				return window;
			}
		}
	}
	return null;
};
com_htmli_ui_Window.prototype.push = function() {
	var active = com_htmli_ui_Window.active;
	var length = active.length;
	for (var i=length-1; i>=0; i--) {
		var window = active[i];
		if (!window.getContainer()) {
			active.splice(i,1);
		}
		if (window.outerNode.id  == this.outerNode.id ) {
			return;
		}
	}
	com_htmli_ui_Window.active.push(this);
};
com_htmli_ui_Window.shiftTop = function() {
	if (com_htmli_ui_Window.active.length>0) {
		var top = com_htmli_ui_Window.active.pop();
		com_htmli_ui_Window.active.splice(0,0,top);
	}
};
com_htmli_ui_Window.shiftBottom = function() {
	if (com_htmli_ui_Window.active.length>0) {
		var last = com_htmli_ui_Window.active[0];
		com_htmli_ui_Window.active.splice(0,1);
		com_htmli_ui_Window.active.splice(com_htmli_ui_Window.active.length,com_htmli_ui_Window.active.length,last);
	}
};
com_htmli_ui_Window.top = function() {
	if (com_htmli_ui_Window.active.length>0) {
		var top = com_htmli_ui_Window.active.pop();
		com_htmli_ui_Window.active.push(top);
		return top;
	}
};
com_htmli_ui_Window.bottom = function() {
	if (com_htmli_ui_Window.active.length>0) {
		var last = com_htmli_ui_Window.active[0];
		return last;
	}
};
com_htmli_ui_Window.refreshActive = function(onlyActivate) {
	if (com_htmli_ui_Window.active.length>0) {
		var act = com_htmli_ui_Window.active.pop();
		if (!onlyActivate && com_htmli_ui_Window.active.length>0) {
			var deact = com_htmli_ui_Window.active.pop();
			if (deact) {
				deact.deactivate();
				com_htmli_ui_Window.active.push(deact);
			}
		}
		if (act) {
			act.activate();
			com_htmli_ui_Window.active.push(act);
		}
	}
};
com_htmli_ui_Window.prototype.deactivate = function() {
	if (this.getState().indexOf('minimized') < 0 ) {
		if (this.outerNode.childNodes[1]) {
			this.outerNode.childNodes[1].style.display = '';
			this.outerNode.childNodes[1].style.height = '30px';
			this.outerNode.childNodes[1].className = 'com_htmli_ui_Window__faded';
		}
	}
};
com_htmli_ui_Window.prototype.activate = function() {
	if (this.outerNode.childNodes[1]) {
		this.outerNode.childNodes[1].style.height = this.outerNode.style.height;
		this.outerNode.childNodes[1].style.display = 'none';
		this.outerNode.childNodes[1].className = 'com_htmli_ui_Window__dashed';
	}
};
com_htmli_ui_Window.getMaxHeight = function() {
	if (document.all) {
		return application.getDocumentElement().getHeight()-4;
	} else {
		return application.getDocumentElement().getHeight();
	}
};
com_htmli_ui_Window.getMaxWidth = function() {
	if (document.all) {
		return application.getDocumentElement().getWidth()-22;
	} else {
		return application.getDocumentElement().getWidth();
	}
};
com_htmli_ui_Window.getNextTop = function(windowHeight) {
	var maxHeight = com_htmli_ui_Window.getMaxHeight();
	if (com_htmli_ui_Window.yAdd) {
		com_htmli_ui_Window.nextTop+=30;
	} else {
		com_htmli_ui_Window.nextTop-=30;
	}
	if (com_htmli_ui_Window.yAdd && com_htmli_ui_Window.nextTop+parseInt(windowHeight) >= maxHeight) {
		com_htmli_ui_Window.yAdd = false;
		com_htmli_ui_Window.nextTop -= 60;
		if (com_htmli_ui_Window.nextTop+parseInt(windowHeight) >= maxHeight) {
			com_htmli_ui_Window.nextTop = 30;
		}
	} else if (com_htmli_ui_Window.nextTop<30) {
		com_htmli_ui_Window.nextTop = 60;
		com_htmli_ui_Window.yAdd = true;
	}
	return com_htmli_ui_Window.nextTop;
};
com_htmli_ui_Window.getNextLeft = function(windowWidth) {
	var maxWidth = com_htmli_ui_Window.getMaxWidth();
	if (com_htmli_ui_Window.xAdd) {
		com_htmli_ui_Window.nextLeft+=30;
	} else {
		com_htmli_ui_Window.nextLeft-=30;
	}
	if (com_htmli_ui_Window.xAdd && com_htmli_ui_Window.nextLeft+parseInt(windowWidth) >= maxWidth) {
		com_htmli_ui_Window.xAdd = false;
		com_htmli_ui_Window.nextLeft -= 60;
		if (com_htmli_ui_Window.nextLeft+parseInt(windowWidth) >= maxWidth) {
			com_htmli_ui_Window.nextLeft = 30;
		}
	} else if (com_htmli_ui_Window.nextLeft<30) {
		com_htmli_ui_Window.nextLeft = 60;
		com_htmli_ui_Window.xAdd = true;
	}
	return com_htmli_ui_Window.nextLeft;
};
application.addEventListener('mousemove', function(ev) {
	if (com_htmli_ui_Window.resizingTable != null) {
		var obj = com_htmli_ui_Window.resizingTable;
		var div = obj.outerNode.childNodes[1];
		var axis = com_htmli_ui_Window.resizingAxis;
		var base = com_htmli_ui_Window.resizingBase;
		var x = ev.getClientX();
		var y = ev.getClientY();
		if (!obj.getResizeMode() || obj.getResizeMode().indexOf('outline')>=0) {
			div.style.display = '';
		}
		if (axis[0] && (x - base[0]) > 0) {
			var newWidth = (x - base[0]) + "px";
			div.style.width = newWidth;
			if (obj.getResizeMode() && obj.getResizeMode().indexOf('real')>=0) {
				obj.resizeToW(newWidth);
			}
		}
		if (axis[1] && (y - base[1]) > 0) {
			var newHeight = (y - base[1]) + "px";
			div.style.height = newHeight;
			if (obj.getResizeMode() && obj.getResizeMode().indexOf('real')>=0) {
				obj.resizeToH(newHeight);
			}
		}
	} else if (com_htmli_ui_Window.dndTarget != null) {
		var obj = com_htmli_ui_Window.dndTarget;
		var div = obj.outerNode.childNodes[1];
		var x = ev.getClientX();
		var y = ev.getClientY();
		var diff = [x - com_htmli_ui_Window.dndCoords[0], y - com_htmli_ui_Window.dndCoords[1]];
		if (!obj.getDndMode() || obj.getDndMode().indexOf('outline')>=0) {
			div.style.display = '';
			var style =  div.style;
			style.top = (parseInt(style.top) + diff[1]) + "px";
			style.left = (parseInt(style.left) + diff[0]) + "px";
		} else {
			var style = obj.outerNode.style;
			if ( (parseInt(style.top) + diff[1]) < 0) {
				style.top = "0px";
			} else {
				style.top = (parseInt(style.top) + diff[1]) + "px";
			}
			if ( (parseInt(style.left) + diff[0]) < 0) {
				style.left = "0px";
			} else {
				style.left = (parseInt(style.left) + diff[0]) + "px";
			}
		}
		com_htmli_ui_Window.dndCoords = [x, y];
	}
}, false);
com_htmli_ui_Window.prototype.dispatchResize = function(obj, ev) {
	var newEvent = application.createEvent('HTMLiEvents');
	newEvent.initHTMLiEvent('resizewindow', this);
	this.dispatchEvent(newEvent);
};
com_htmli_ui_Window.prototype.dispatchMinimize = function(obj, ev) {
	var newEvent = application.createEvent('HTMLiEvents');
	newEvent.initHTMLiEvent('minwindow', this);
	this.dispatchEvent(newEvent);
};
com_htmli_ui_Window.prototype.dispatchMaximize = function(obj, ev) {
	var newEvent = application.createEvent('HTMLiEvents');
	newEvent.initHTMLiEvent('maxwindow', this);
	this.dispatchEvent(newEvent);
};
application.addEventListener('mouseup', function() {
		if (com_htmli_ui_Window.resizingTable != null) {
			var drawingDiv = com_htmli_ui_Window.resizingTable.outerNode.childNodes[1];
			var width = drawingDiv.style.width;
			var height = drawingDiv.style.height;
			com_htmli_ui_Window.resizingTable.resizeTo(width, height);
			drawingDiv.style.display='none';
			com_htmli_ui_Window.resizingTable.dispatchResize();
		}
		else if (com_htmli_ui_Window.dndTarget != null) {
			var obj = com_htmli_ui_Window.dndTarget;
			if (!obj.getDndMode() || obj.getDndMode().indexOf('outline')>=0) {
				var drawingDiv = obj.outerNode.childNodes[1];
				var diff = [parseInt(drawingDiv.style.left), parseInt(drawingDiv.style.top)];
				var style = obj.outerNode.style;
				if ( (parseInt(style.top) + diff[1]) < 0) {
					style.top = "0px";
				} else {
					style.top = (parseInt(style.top) + diff[1]) + "px";
				}
				if ( (parseInt(style.left) + diff[0]) < 0) {
					style.left = "0px";
				} else {
					style.left = (parseInt(style.left) + diff[0]) + "px";
				}
				drawingDiv.style.top = "0px";
				drawingDiv.style.left = "0px";
				drawingDiv.style.display='none';
			}
		}
		com_htmli_ui_Window.resizingTable = null;
		com_htmli_ui_Window.dndTarget = null;
	}, false);
application.addEventListener('keyup', function(ev) {
	if (ev.getKeyCode()==37 && ev.getCtrlKey() && ev.getAltKey()) {
		com_htmli_ui_Window.shiftTop();
		com_htmli_ui_Window.bottom().deactivate();
		com_htmli_ui_Window.refreshActive(true);
		com_htmli_ui_Window.top().top();
	} else if (ev.getKeyCode()==39 && ev.getCtrlKey() && ev.getAltKey()) {
		com_htmli_ui_Window.shiftBottom();
		com_htmli_ui_Window.refreshActive();
		com_htmli_ui_Window.top().top();
	}
	ev.stopPropagation();
	ev.preventDefault();
}, false);
function com_htmli_xml_Xml(outerNode) {
	this.init(outerNode, 'com.htmli.xml.Xml', 'Xml');
}
com_htmli_xml_Xml.prototype = new HTMLiElement();
com_htmli_xml_Xml.prototype.getUrl = function() {
				return this.getAttribute('url');
	};
	com_htmli_xml_Xml.prototype.setUrl = function(url) {
					this.setAttribute('url', url);
		};
	com_htmli_xml_Xml.prototype.getXmlDocument = function() {
		var me = this;
		var xmlDocument = XmlDocument.create();
		xmlDocument.loadXML(me.outerNode.value);
		return xmlDocument;
	};
com_htmli_xml_Xml.prototype.post = function(handler) {
		var me = this;
		var httpRequest = HttpRequest.create();
		httpRequest.open("POST", me.getUrl(), true);
		httpRequest.onreadystatechange = function() {
			if (httpRequest.readyState == 4) {
				if (handler) {
					var x = XmlDocument.create();
					x.loadXML(httpRequest.responseText);
					handler(x);
				}
			}
		};
		var xmlDoc = XmlDocument.create();
		xmlDoc.loadXML(me.outerNode.value.replace('<?xml version="1.0"?>', '<?xml version="1.0" encoding="utf-8" ?>'));
		httpRequest.send(xmlDoc);
	};
com_htmli_xml_Xml.prototype.get = function(handler) {
		var me = this;
		var xmlDocument = XmlDocument.create();
		xmlDocument.async = true;
		xmlDocument.onreadystatechange = function () {
			if (xmlDocument.readyState == 4) {
				me.outerNode.value = xmlDocument.xml;
				if (handler) {
					handler();
				}
			}
		};
		xmlDocument.load(me.getUrl() + '?rand=' + new Date().getTime());
		me.dispatchChange();
	};
com_htmli_xml_Xml.prototype.setXml = function(xml) {
		var me = this;
		me.outerNode.value = xml;
		me.dispatchChange();
	};
com_htmli_xml_Xml.prototype.append = function(node,xmlChild) {
		var me = this;
		var xml = me.getXmlDocument();
		xml.selectSingleNode(node).appendChild(xmlChild.getXmlDocument().documentElement);
		me.setXml(xml.xml);
		me.dispatchChange();
	};
com_htmli_xml_Xml.prototype.replace = function(node,xmlChild) {
		var me = this;
		var xml = me.getXmlDocument();
		var node = xml.selectSingleNode(node);
		node.parentNode.appendChild(xmlChild.getXmlDocument().documentElement);
		node.parentNode.removeChild(node);
		me.setXml(xml.xml);
		me.dispatchChange();
	};
com_htmli_xml_Xml.prototype.remove = function(node) {
		var me = this;
		var xml = me.getXmlDocument();
		var node = xml.selectSingleNode(node);
		node.parentNode.removeChild(node);
		me.setXml(xml.xml);
		me.dispatchChange();
	};
com_htmli_xml_Xml.prototype._addEventListener = com_htmli_xml_Xml.prototype.addEventListener;
	com_htmli_xml_Xml.prototype._dispatchEvent = com_htmli_xml_Xml.prototype.dispatchEvent;
	com_htmli_xml_Xml.prototype.addEventListener = function(event, func, capture) {
			if (event == 'change') {
				return this._addEventListenerFor(event, func);
			}
		return this._addEventListener(event, func, capture);
	};
	com_htmli_xml_Xml.prototype.dispatchEvent = function(event) {
			if (event.getType() == 'change') {
				var aux;
				eval('com_htmli_xml_Xml.prototype.aux = function(ev) {'  + this.getAttribute('onchange') + '};');
				this.aux(event);
				return;
			}
		return this._dispatchEvent(event);
	};
	com_htmli_xml_Xml.prototype._getListenersFor = function(event) {
		try {
			var ret = application.listeners[this.outerNode.id][event];
			return ret ? ret : new Array();
		} catch (e) {
			return new Array();
		}
	};
com_htmli_xml_Xml.prototype.dispatchChange = function() {
	var newEvent = application.createEvent('HTMLiEvents');
	newEvent.initHTMLiEvent('change', this);
	this.dispatchEvent(newEvent);
	return false;
};
function com_htmli_xml_XmlMultiple(outerNode) {
	this.init(outerNode, 'com.htmli.xml.XmlMultiple', 'XmlMultiple');
}
com_htmli_xml_XmlMultiple.prototype = new HTMLiElement();
com_htmli_xml_XmlMultiple.prototype.getRoot = function() {
				return this.getAttribute('root');
	};
	com_htmli_xml_XmlMultiple.prototype.setRoot = function(root) {
					this.setAttribute('root', root);
		};
	com_htmli_xml_XmlMultiple.prototype.getXmlDocument = function() {
		var me = this;
		var xmlDocument = XmlDocument.create();
		xmlDocument.loadXML('<' + me.getRoot() + '/>');
		var children = me.getChildNodes();
		for (var i=0; i < children.getLength(); i++) {
			xmlDocument.documentElement.appendChild(children.item(i).getXmlDocument().documentElement);
		}
		return xmlDocument;
	};
com_htmli_xml_XmlMultiple.prototype.get = function(handler) {
		var me = this;
		var children = me.getChildNodes();
		var count = children.getLength();
		for (var i=0; i < count; i++) {
			children.item(i).get(function() {
					if(--count <= 0) {
						if (handler) {
							handler();
						}
					}
				});
		}
	};
function com_htmli_xml_XmlRpcServer(outerNode) {
	this.init(outerNode, 'com.htmli.xml.XmlRpcServer', 'XmlRpcServer');
}
com_htmli_xml_XmlRpcServer.prototype = new HTMLiElement();
com_htmli_xml_XmlRpcServer.prototype.getUrl = function() {
				return this.getAttribute('url');
	};
	com_htmli_xml_XmlRpcServer.prototype.setUrl = function(url) {
					this.setAttribute('url', url);
		};
	com_htmli_xml_XmlRpcServer.prototype.execute = function(service) {
		var me = this;
		var server = XMLRPC.getService(me.getUrl());
		server.add(service, 'aux');
		XMLRPC.onerror = function(e){
			throw e;
		}
		var args = '';
		for (var i=1; i < arguments.length ;i++) {
			args += (i>1?',':'') + 'arguments[' + i + ']';
		}
		return eval('server.aux(' + args + ')');
	};
Object.prototype.toXMLRPC = function(){
var wo = this.valueOf();
if(wo.toXMLRPC == this.toXMLRPC){
retstr = "<struct>";
for(prop in this){
	if(typeof wo[prop] != "function"){
		retstr += "<member><name>" + prop + "</name><value>" + XMLRPC.getXML(wo[prop]) + "</value></member>";
	}
}
retstr += "</struct>";
return retstr;
}
else{
return wo.toXMLRPC();
}
};
String.prototype.toXMLRPC = function(){
return "<string><![CDATA[" + this.replace(/\]\]/g, "] ]") + "]]></string>";
};
Number.prototype.toXMLRPC = function(){
if(this == parseInt(this)){
return "<int>" + this + "</int>";
}
else if(this == parseFloat(this)){
return "<double>" + this + "</double>";
}
else{
return false.toXMLRPC();
}
};
Boolean.prototype.toXMLRPC = function(){
if(this == true) return "<boolean>1</boolean>";
else return "<boolean>0</boolean>";
};
Date.prototype.toXMLRPC = function(){
return "<dateTime.iso8601>" + doYear(this.getUTCFullYear()) + doZero(this.getMonth()) + doZero(this.getUTCDate()) + "T" + doZero(this.getHours()) + ":" + doZero(this.getMinutes()) + ":" + doZero(this.getSeconds()) + "</dateTime.iso8601>";
function doZero(nr) {
nr = String("0" + nr);
return nr.substr(nr.length-2, 2);
}
function doYear(year) {
if(year > 9999 || year < 0)
	XMLRPC.handleError(new Error("Unsupported year: " + year));
year = String("0000" + year)
return year.substr(year.length-4, 4);
}
};
Array.prototype.toXMLRPC = function(){
var retstr = "<array><data>";
for(var i=0;i<this.length;i++){
retstr += "<value>" + XMLRPC.getXML(this[i]) + "</value>";
}
return retstr + "</data></array>";
};
function VirtualService(servername, oRPC){
this.version = '0.91';
this.URL = servername;
this.multicall = false;
this.autoroute = true;
this.onerror = null;
this.rpc = oRPC;
this.receive = {};
this.purge = function(receive){
return this.rpc.purge(this, receive);
}
this.revert = function(){
this.rpc.revert(this);
}
this.add = function(name, alias, receive){
this.rpc.validateMethodName();if(this.rpc.stop){this.rpc.stop = false;return false}
if(receive) this.receive[name] = receive;
this[(alias || name)] = new Function('var args = new Array(), i;for(i=0;i<arguments.length;i++){args.push(arguments[i]);};return this.call("' + name + '", args);');
return true;
}
this.call = function(name, args){
var info = this.rpc.send(this.URL, name, args, this.receive[name], this.multicall, this.autoroute);
if(info){
	if(!this.multicall) this.autoroute = info[0];
	return info[1];
}
else{
	if(this.onerror) this.onerror(XMLRPC.lastError);
	return false;
}
}
}
XMLRPC = {
routeServer : "http://www.vcdn.org/cgi-bin/rpcproxy.cgi",
autoroute : true,
multicall : false,
services : {},
stack : {},
queue : new Array(),
timers : new Array(),
timeout : 30000,
ontimeout : null,
getService : function(serviceName){
if(/[\/\.]/.test(serviceName)){
	return new VirtualService(serviceName, this);
}
else if(this.services[serviceName]){
	return this.services[serviceName];
}
else{
	try{
		var ct = eval(serviceName);
		this.services[serviceName] = new ct(this);
	}
	catch(e){
		return false;
	}
}
},
purge : function(modConst, receive){
if(this.stack[modConst.URL].length){
	var info = this.send(modConst.URL, "system.multicall", [this.stack[modConst.URL]], receive, false, modConst.autoroute);
	modConst.autoroute = info[0];
	this.revert(modConst);
	if(info){
		modConst.autoroute = info[0];
		return info[1];
	}
	else{
		if(modConst.onerror) modConst.onerror(this.lastError);
		return false;
	}
}
},
revert : function(modConst){
this.stack[modConst.URL] = new Array();
},
call : function(){
var args = new Array(), i, a = arguments;
var servername, methodname, receive, service, info, autoroute, multicall;
if(typeof a[0] == "object"){
	receive = a[0][0];
	servername = a[0][1].URL;
	methodname = a[1];
	multicall = (a[0][1].supportsMulticall && a[0][1].multicall);
	autoroute = a[0][1].autoroute;
	service = a[0][1];
}
else if(typeof a[0] == "function"){
	i = 3;
	receive = a[0];
	servername = a[1];
	methodname = a[2];
}
else{
	i = 2;
	servername = a[0];
	methodname = a[1];
}
for(i=i;i<a.length;i++){
	args.push(a[i]);
}
info = this.send(servername, methodname, args, receive, multicall, autoroute);
if(info){
	(service || this).autoroute = info[0];
	return info[1];
}
else{
	if(service && service.onerror) service.onerror(this.lastError);
	return false;
}
},
typematch : function (vDunno, nCase){
var nMask;
switch(typeof(vDunno)){
	case 'number'  : nMask = 2;  break;
	case 'boolean' : nMask = 4;  break;
	case 'string'  : nMask = 8;  break;
	case 'function': nMask = 16; break;
	case 'object'  : nMask = 32; break;
	default	     : nMask = 1;  break;
}
return Boolean(nMask & (nCase || 62));
},
getNode : function(data, tree){
var nc = 0;
if(data != null){
	for(i=0;i<data.childNodes.length;i++){
		if(data.childNodes[i].nodeType == 1){
			if(nc == tree[0]){
				data = data.childNodes[i];
				if(tree.length > 1){
					tree.shift();
					data = this.getNode(data, tree);
				}
				return data;
			}
			nc++
		}
	}
}
return false;
},
toObject : function(data){
var ret, i;
switch(data.tagName){
	case "string":
		return (data.firstChild) ? new String(data.firstChild.nodeValue) : "";
		break;
	case "int":
	case "i4":
	case "double":
		return (data.firstChild) ? new Number(data.firstChild.nodeValue) : 0;
		break;
	case "dateTime.iso8601":
		var sn = (isIE) ? "-" : "/";
		if(/^(\d{4})(\d{2})(\d{2})T(\d{2}):(\d{2}):(\d{2})/.test(data.firstChild.nodeValue)){;
	    return new Date(RegExp.$2 + sn + RegExp.$3 + sn +
	      					RegExp.$1 + " " + RegExp.$4 + ":" +
	      					RegExp.$5 + ":" + RegExp.$6);
	}
	    else{
	    	return new Date();
	    }
		break;
	case "array":
		data = this.getNode(data, [0]);
		if(data && data.tagName == "data"){
			ret = new Array();
			var i = 0;
			while(child = this.getNode(data, [i++])){
      		ret.push(this.toObject(child));
			}
			return ret;
		}
		else{
			this.handleError(new Error("Malformed XMLRPC Message1"));
			return false;
		}
		break;
	case "struct":
		ret = {};
		var i = 0;
		while(child = this.getNode(data, [i++])){
			if(child.tagName == "member"){
				ret[this.getNode(child, [0]).firstChild.nodeValue] = this.toObject(this.getNode(child, [1]));
			}
			else{
				this.handleError(new Error("Malformed XMLRPC Message2"));
				return false;
			}
		}
		return ret;
		break;
	case "boolean":
		return Boolean(isNaN(parseInt(data.firstChild.nodeValue)) ? (data.firstChild.nodeValue == "true") : parseInt(data.firstChild.nodeValue))
		break;
	case "base64":
		return this.decodeBase64(data.firstChild.nodeValue);
		break;
	case "value":
		child = this.getNode(data, [0]);
		return (!child) ? ((data.firstChild) ? new String(data.firstChild.nodeValue) : "") : this.toObject(child);
		break;
	default:
		this.handleError(new Error("Malformed XMLRPC Message: " + data.tagName));
		return false;
		break;
}
},
decodeBase64 : function(sEncoded){
if(!sEncoded || (sEncoded.length % 4) > 0)
	return sEncoded;
else if(typeof(atob) != 'undefined')
	return atob(sEncoded);
var nBits, i, sDecoded = '';
var base64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
sEncoded = sEncoded.replace(/\W|=/g, '');
for(i=0; i < sEncoded.length; i += 4){
	nBits =
		(base64.indexOf(sEncoded.charAt(i))   & 0xff) << 18 |
		(base64.indexOf(sEncoded.charAt(i+1)) & 0xff) << 12 |
		(base64.indexOf(sEncoded.charAt(i+2)) & 0xff) <<  6 |
		base64.indexOf(sEncoded.charAt(i+3)) & 0xff;
	sDecoded += String.fromCharCode(
		(nBits & 0xff0000) >> 16, (nBits & 0xff00) >> 8, nBits & 0xff);
}
return sDecoded.substring(0, sDecoded.length -
	((sEncoded.charCodeAt(i - 2) == 61) ? 2 :
	(sEncoded.charCodeAt(i - 1) == 61 ? 1 : 0)));
},
getObject : function(type, message){
if(type == "HTTP"){
	if(isIE)
		obj = new ActiveXObject("microsoft.XMLHTTP");
	else if(isNS)
		obj = new XMLHttpRequest();
}
else if(type == "XMLDOM"){
	if(isIE){
		obj = new ActiveXObject("microsoft.XMLDOM");
		obj.loadXML(message)
	}else if(isNS){
		obj = new DOMParser();
		obj = obj.parseFromString(message, "text/xml");
	}
}
else{
	this.handleError(new Error("Unknown Object"));
}
return obj;
},
validateMethodName : function(name){
if(/^[A-Za-z0-9\._\/:]+$/.test(name))
	return true
else
	this.handleError(new Error("Incorrect method name"));
},
getXML : function(obj){
if(typeof obj == "function"){
	this.handleError(new Error("Cannot Parse functions"));
}else if(obj == null || obj == undefined || (typeof obj == "number" && !isFinite(obj)))
	return false.toXMLRPC();
else
	return obj.toXMLRPC();
},
handleError : function(e){
if(!this.onerror || !this.onerror(e)){
	throw e;
}
this.stop = true;
this.lastError = e;
},
cancel : function(id){
if(!this.queue[id]) return false;
this.queue[id][0].abort();
return true;
},
send : function(serverAddress, functionName, args, receive, multicall, autoroute){
var id, http;
this.validateMethodName();
if(this.stop){this.stop = false; return false;}
multicall = (multicall != null) ? multicall : this.multicall;
if(multicall){
	if(!this.stack[serverAddress]) this.stack[serverAddress] = new Array();
	this.stack[serverAddress].push({methodName : functionName, params : args});
	return true;
}
var http = this.getObject("HTTP");
if(!receive || isNS){;
	async = false;
}
else{
	async = true;
	id = this.queue.push([http, receive, null, new Date()])-1;
	this.queue[id][2] = new Function("var id='" + id + "';var dt = new Date(new Date().getTime() - XMLRPC.queue[id][3].getTime());diff = parseInt(dt.getSeconds()*1000 + dt.getMilliseconds());if(diff > XMLRPC.timeout){if(XMLRPC.ontimeout) XMLRPC.ontimeout(); clearInterval(XMLRPC.timers[id]);XMLRPC.cancel(id);return};if(XMLRPC.queue[id][0].readyState == 4){XMLRPC.queue[id][0].onreadystatechange = function(){};XMLRPC.receive(id);clearInterval(XMLRPC.timers[id])}");
	this.timers[id] = setInterval("XMLRPC.queue[" + id + "][2]()", 20);
}
autoroute = (autoroute || this.autoroute);
var srv = (autoroute == "active") ? this.routeServer : serverAddress;
try{
	http.open('POST', srv, async);
	http.setRequestHeader("User-Agent", "vcXMLRPC v0.91 (" + navigator.userAgent + ")");
	http.setRequestHeader("Content-type", "text/xml");
	if(autoroute == "active"){
		http.setRequestHeader("X-Proxy-Request", serverAddress);
		http.setRequestHeader("X-Compress-Response", "gzip");
	}
}
catch(e){
	if(autoroute == true){
		autoroute = "active";
		if(id){
			delete this.queue[id];
			clearInterval(this.timers[id]);
		}
		return this.send(serverAddress, functionName, args, receive, multicall, autoroute);
	}
	this.handleError(new Error("Could not sent XMLRPC Message (Reason: Access Denied on client)"));
	if(this.stop){this.stop = false;return false}
}
var message = '<?xml version="1.0" encoding="iso-8859-1" ?><methodCall><methodName>' + functionName + '</methodName><params>';
for(i=0;i<args.length;i++){
message += '<param><value>' + this.getXML(args[i]) + '</value></param>';
}
message += '</params></methodCall>';
var xmldom = this.getObject('XMLDOM', message);
if(self.DEBUG)
	alert(message);
try{
	http.send(xmldom);
}
catch(e){
	this.handleError(new Error("XMLRPC Message not Sent(Reason: " + e.message + ")"));
	if(this.stop){this.stop = false;return false}
}
if(!async && receive)
	return [autoroute, receive(this.processResult(http))];
else if(receive)
	return [autoroute, id];
else
	return [autoroute, this.processResult(http)];
},
receive : function(id){
if(this.queue[id]){
	var data = this.processResult(this.queue[id][0]);
	this.queue[id][1](data);
	delete this.queue[id];
}
else{
	this.handleError(new Error("Error while processing queue"));
}
},
processResult : function(http){
if(http.status == 200){
	dom = http.responseXML;
	if(dom){
	var rpcErr, main;
	rpcErr = dom.getElementsByTagName("fault");
	if(rpcErr.length > 0){
		rpcErr = this.toObject(rpcErr[0].firstChild);
		this.handleError(new Error(rpcErr.faultCode, rpcErr.faultString));
		return false
	}
	main = dom.getElementsByTagName("param");
		if(main.length == 0) this.handleError(new Error("Malformed XMLRPC Message"));
		data = this.toObject(this.getNode(main[0], [0]));
		if(this.onreceive) this.onreceive(data);
		return data;
	}
	else{
		this.handleError(new Error("Malformed XMLRPC Message"));
	}
}
else{
	this.handleError(new Error("HTTP Exception: (" + http.status + ") " + http.statusText + "\n\n" + http.responseText));
}
}
};
ver = navigator.appVersion;
app = navigator.appName;
isNS = Boolean(navigator.productSub)
isIE = (ver.indexOf("MSIE 5") != -1 || ver.indexOf("MSIE 6")!= -1 || ver.indexOf("MSIE 7") != -1 || ver.indexOf("MSIE 8") != -1) ? 1 : 0;
isIE55 = (ver.indexOf("MSIE 5.5") != -1) ? 1 : 0;
isOTHER = (!isNS && !isIE) ? 1 : 0;
if(isOTHER) alert("Sorry your browser doesn't support the features of vcXMLRPC");
function com_htmli_xml_Xsl(outerNode) {
	this.init(outerNode, 'com.htmli.xml.Xsl', 'Xsl');
		this.innerNode = outerNode.childNodes[1];
}
com_htmli_xml_Xsl.prototype = new HTMLiElement();
com_htmli_xml_Xsl.prototype.getUrl = function() {
				return this.getAttribute('url');
	};
	com_htmli_xml_Xsl.prototype.setUrl = function(url) {
					this.setAttribute('url', url);
		};
	com_htmli_xml_Xsl.prototype.getSrc = function() {
				return this.getAttribute('src');
	};
	com_htmli_xml_Xsl.prototype.setSrc = function(src) {
					this.setAttribute('src', src);
		};
	com_htmli_xml_Xsl.prototype.refresh = function(handler) {
		var me = this;
		var url;
		var xmlDocument;
		var xsl = '<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform" xmlns:xslt2="http://www.htmli.com/1999/XSL/Transform">';
		xsl += '<xslt:namespace-alias stylesheet-prefix="xslt2" result-prefix="xslt"/>';
		xsl += '<xslt:output method="html" omit-xml-declaration="yes" /><xslt:template match="/">';
		xsl += me.outerNode.childNodes[0].value;
		xsl += '</xslt:template></xslt:stylesheet>';
		var xslDocument = XmlDocument.create();
		xslDocument.async = false;
		xslDocument.loadXML(xsl);
		if (url=me.getUrl()) {
			xmlDocument = XmlDocument.create();
			xmlDocument.async = true;
			xmlDocument.onreadystatechange = function () {
				if (xmlDocument.readyState == 4) {
					me.outerNode.childNodes[1].innerHTML = xmlDocument.transformNode(xslDocument);
					if (handler) {
						handler();
					}
					var refreshEvent = application.createEvent('HTMLiEvents');
					refreshEvent.initHTMLiEvent('refresh', me);
					me.dispatchEvent(refreshEvent);
				}
			};
			xmlDocument.load(url + '?rand=' + new Date().getTime());
		} else {
			var xml = me.getContainer().getElementById(me.getSrc());
			xmlDocument = xml.getXmlDocument();
			if (!xml) {
				throw new Error("Source " +  me.getSrc() + " for XSL " + me.getId() + " doesn't exist");
			}
			me.outerNode.childNodes[1].innerHTML = xmlDocument.transformNode(xslDocument);
			var refreshEvent = application.createEvent('HTMLiEvents');
			refreshEvent.initHTMLiEvent('refresh', me);
			me.dispatchEvent(refreshEvent);
		}
	};
com_htmli_xml_Xsl.prototype.getXslt = function() {
		var me = this;
		var xsl = '<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform" xmlns:xslt2="http://www.htmli.com/1999/XSL/Transform">';
		xsl += '<xslt:namespace-alias stylesheet-prefix="xslt2" result-prefix="xslt"/>';
		xsl += '<xslt:output method="html" omit-xml-declaration="yes" /><xslt:template match="/">';
		xsl += me.outerNode.childNodes[0].value;
		xsl += '</xslt:template></xslt:stylesheet>';
		var xslDocument = XmlDocument.create();
		xslDocument.async = false;
		xslDocument.loadXML(xsl);
		return xslDocument;
	};
com_htmli_xml_Xsl.prototype.populate = function(XmlDocument) {
		var me = this;
		var xsl = '<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform" xmlns:xslt2="http://www.htmli.com/1999/XSL/Transform">';
		xsl += '<xslt:namespace-alias stylesheet-prefix="xslt2" result-prefix="xslt"/>';
		xsl += '<xslt:output method="html" omit-xml-declaration="yes" /><xslt:template match="/">';
		xsl += me.outerNode.childNodes[0].value;
		xsl += '</xslt:template></xslt:stylesheet>';
		var xslDocument = XmlDocument.create();
		xslDocument.async = false;
		xslDocument.loadXML(xsl);
		me.outerNode.childNodes[1].innerHTML = xmlDocument.transformNode(xslDocument);
	};
com_htmli_xml_Xsl.prototype._addEventListener = com_htmli_xml_Xsl.prototype.addEventListener;
	com_htmli_xml_Xsl.prototype._dispatchEvent = com_htmli_xml_Xsl.prototype.dispatchEvent;
	com_htmli_xml_Xsl.prototype.addEventListener = function(event, func, capture) {
			if (event == 'refresh') {
				return this._addEventListenerFor(event, func);
			}
		return this._addEventListener(event, func, capture);
	};
	com_htmli_xml_Xsl.prototype.dispatchEvent = function(event) {
			if (event.getType() == 'refresh') {
				var aux;
				eval('com_htmli_xml_Xsl.prototype.aux = function(ev) {'  + this.getAttribute('onrefresh') + '};');
				this.aux(event);
				return;
			}
		return this._dispatchEvent(event);
	};
	com_htmli_xml_Xsl.prototype._getListenersFor = function(event) {
		try {
			var ret = application.listeners[this.outerNode.id][event];
			return ret ? ret : new Array();
		} catch (e) {
			return new Array();
		}
	};
