
		
		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.getSelectFunc = function() {
				
						return this.getAttribute('selectfunc');
					
				
			};
			
			com_htmli_forms_Input.prototype.setSelectFunc = function(selectFunc) {
					
							this.setAttribute('selectfunc', selectFunc);	
											
				};		
			com_htmli_forms_Input.prototype.getSelectExpr = function() {
				
						return this.getAttribute('selectexpr');
					
				
			};
			
			com_htmli_forms_Input.prototype.setSelectExpr = function(selectExpr) {
					
							this.setAttribute('selectexpr', selectExpr);	
											
				};		
			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.getChecked = function() {
							
						var me = this;
						var __value = this.getAttribute('checked');
						var checked = __value;
				
						return me.outerNode.checked;
						return __value;
					
				
			};
			
			com_htmli_forms_Input.prototype.setChecked = function(checked) {
					
							var me = this;
							var __value = checked;
							
			
				me.outerNode.checked = checked;
				if (!com_htmli_forms_Input.dontDispatchChangeEvent) {
					me.dispatchChangeEvent();				
				}
			
			
							this.setAttribute('checked', __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;
				if (!com_htmli_forms_Input.dontDispatchChangeEvent) {
					me.dispatchChangeEvent();				
				}
			
			
							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());
				if (!xml) {
					return;
				}
				var xmlDoc = xml.getXmlDocument();
				var node;
				var info;
				var path;
				
				/* select node to sync */
				if (select) {
					info = path = select;
				} else if (me.getSelectFunc()) {
					try {
						path = eval(me.getSelectFunc());
					} catch (e) { 
						throw application.logError(302, 'Cannot set value.', '"selectfunc" expression failed to evaluate: ' + me.getSelectFunc() + '.'); 
					}
					info = path + ';' + me.getSelectFunc();
				} else if (me.getSelectExpr()) {
					try {
						path = eval(me.getSelectExpr() + ';');
					} catch (e) {
						throw application.logError(303, 'Cannot set value.', '"selectexpr" expression failed to evaluate: ' + me.getSelectExpr() + '.');
					}
					info = path + ';' + me.getSelectExpr();
				} else {
					info = path = me.getSelect();
				}
				node = xmlDoc.selectSingleNode(path);
					
				/* if node is null, check if it's an attribute and create it */
				if (node == null && path.indexOf('/@') != -1) {
					var parent = path.substring(0, path.lastIndexOf('/@'));
					node = xmlDoc.selectSingleNode(parent);
					if (node == null) {
						throw application.logError(304, 'Cannot set value.', 'Invalid attribute xpath: ' + info + '. Parent node (' + parent + ') is null.');
					}
					node.setAttribute(path.substring(path.lastIndexOf('/@')+2),0);
					node = xmlDoc.selectSingleNode(path);
				}
				
				/* if node doesn't exists, throw error */
				if (!node) {
					throw application.logError(301, 'Cannot set value', 'Invalid xpath: ' + info + '.');
				}
				
				/* get new value */
				var value = me.outerNode.type == 'checkbox' ? (me.outerNode.checked ? 'true':'false') : me.getValue();
				
				/* set new value */
				try {
					if (node.childNodes.length > 0) {
						node.replaceChild(xmlDoc.createTextNode(value), node.childNodes[0]);
					} else {
						node.appendChild(xmlDoc.createTextNode(value));
					}
				} catch(e) {				
					/* set as attr if it fails (needed in firefox) */
					if (path.indexOf('/@') != -1) {
						var parent = path.substring(0, path.lastIndexOf('/@'));
						node = xmlDoc.selectSingleNode(parent);
						var attrName = path.substring(path.lastIndexOf('/@')+2);
						node.setAttribute(attrName, value);
					}
				}

				/* save xml */
				xml.setXml(xmlDoc.xml);
			
			
			};				
		com_htmli_forms_Input.prototype.focus = function() {
				var me = this;
				
			
				me.outerNode.focus();
			
			
			};				
		
	
		com_htmli_forms_Input.prototype.dispatchChangeEvent = function() {
			var myEvent = application.createEvent('HTMLEvents');
			myEvent.initEvent('change');
			this.dispatchEvent(myEvent);
		};
		
	
		
		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.getSelectExpr = function() {
				
						return this.getAttribute('selectexpr');
					
				
			};
			
			com_htmli_forms_Select.prototype.setSelectExpr = function(selectExpr) {
					
							this.setAttribute('selectexpr', selectExpr);	
											
				};		
			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.setSelectedIndex = function(selectedIndex) {
					
							var me = this;
							var __value = selectedIndex;
							
			
				me.outerNode.selectedIndex = selectedIndex;
			
			
							this.setAttribute('', __value);	
											
				};		
			com_htmli_forms_Select.prototype.getOptions = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var options = __value;
				
						return new NodeListWrapper(me.outerNode.options);
						return __value;
					
				
			};
			
			com_htmli_forms_Select.prototype.sync = function(select,value) {
				var me = this;
				
			
				var xml = me.getContainer().getElementById(me.getSrc());
				if (!xml) {
					return;
				}
				var xmlDoc = xml.getXmlDocument();
				var info;
				var sel;

				/* select node to sync */
				if (select) {
					info = sel = select.split(';');
				} else if (me.getSelectExpr()) {
					try {
						sel = eval(me.getSelectExpr()).split(';');
					} catch (e) {
						throw application.logError(305, 'Cannot set value', '"selectexpr" expression failed to evaluate: ' + me.getSelectExpr() + '.'); 
					}
					info = sel + ';' + me.getSelectExpr();				
				} else {
					sel = me.getSelect().split(';');					
					info = sel + ';' + me.getSelectExpr();
				}
				var node = xmlDoc.selectSingleNode(sel[0]);				
				
				/* if node doesn't exists, throw error */
				if (!node) {
					throw application.logError(306, 'Cannot set value', 'Invalid xpath: ' + info + '.');
				}
				
				/* get and set new value */
				if (value) {
					if (node.childNodes.length > 0) {
						node.childNodes[0].nodeValue = value;
					} else {
						node.appendChild(xmlDoc.createTextNode(value));
					}
				} else {
					if (node.nodeType == 2) {
						node.value = me.getValue();
					} else {
						if (node.childNodes.length > 0) {
							for (var i=node.childNodes.length-1; i >= 0; i--) {
								node.removeChild(node.childNodes[i]);
							}	
						} 
						node.appendChild(xmlDoc.createTextNode(me.getValue()));
					}
				}
				
				/* if display node must be updated too */
				if (sel.length >= 2) {
					try {
						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));
						}
					} catch (e) {
						/* we assume it is not a fatal error */
					}
				}
				
				/* save updated xml */
				xml.setXml(xmlDoc.xml);
			
			
			};				
		
		
		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.getSelectExpr = function() {
				
						return this.getAttribute('selectexpr');
					
				
			};
			
			com_htmli_forms_Textarea.prototype.setSelectExpr = function(selectExpr) {
					
							this.setAttribute('selectexpr', selectExpr);	
											
				};		
			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.getMaxLength = function() {
				
						var value = this.getAttribute('maxlength');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_forms_Textarea.prototype.setMaxLength = function(maxLength) {
					
							this.setAttribute('maxlength', maxLength);	
											
				};		
			com_htmli_forms_Textarea.prototype.sync = function(select) {
				var me = this;
				
			
				var xml = me.getContainer().getElementById(me.getSrc());
				if (!xml) {
					return;
				}
				var xmlDoc = xml.getXmlDocument();
				var node;
				var info;
				var path;
				
				/* select node to sync */
				if (select) {
					path = info = select;
				} else if (me.getSelectExpr()) {
					try {
						path = eval(me.getSelectExpr());
						info = path + ";" + me.getSelectExpr();
					} catch (e) {
						throw application.logError(307, 'Cannot set value', '"selectexpr" expression failed to evaluate: ' + me.getSelectExpr() + '.'); 
					}
				} else {
					path = info = me.getSelect();
				}
				node = xmlDoc.selectSingleNode(path);
				
				/* if node doesn't exists, throw error */
				if (!node) {
					throw application.logError(308, 'Cannot set value', 'Invalid xpath: ' + info + '.');
				}
				
				/* get and set new value */
				var value = me.getValue();
				if (node.childNodes.length > 0) {
					node.childNodes[0].nodeValue = value;
				} else {
					node.appendChild(xmlDoc.createTextNode(value));
				}
				
				/* save updated xml */
				xml.setXml(xmlDoc.xml);
			
			
			};				
		
	

		com_htmli_forms_Textarea.checkMaxLength = function(current, max) {
			if (current.value.length > max) {
				current.value = current.value.substr(0,max); 
				return false;
			}	
			return true;
		}
		
		
	
		
		function com_htmli_ui_Accordeon(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Accordeon', 'Accordeon');
			
			
			
		}
		
		
		com_htmli_ui_Accordeon.prototype = new HTMLiElement();
		
		com_htmli_ui_Accordeon.prototype.getExclusive = function() {
				
						var value = this.getAttribute('exclusive');
						return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
					
				
			};
			
			com_htmli_ui_Accordeon.prototype.setExclusive = function(exclusive) {
					
							this.setAttribute('exclusive', exclusive ? 'true' : 'false');	
											
				};		
			com_htmli_ui_Accordeon.prototype.hideAll = function() {
				var me = this;
				
			
				var children = me.getChildren();
				var length = children.getLength();				
				
				for (var i=0; i < length; i++) {
					children.item(i).hide();
				}				
			
			
			};				
		com_htmli_ui_Accordeon.prototype.hideAllExcept = function(which) {
				var me = this;
				
			
				var children = me.getChildren();
				var length = children.getLength();				
				
				for (var i=0; i < length; i++) {
					var item = children.item(i);
					if (item.outerNode != which.outerNode) {
						item.hide();
					}
				}				
			
			
			};				
		com_htmli_ui_Accordeon.prototype.showAll = function() {
				var me = this;
				
			
				if (me.getExclusive() == null || !me.getExclusive()) {
					var children = me.getChildren();
					var length = children.getLength();
	
					for (var i=0; i < length; i++) {
						children.item(i).show();
					}				
				}
			
			
			};				
		
		
		function com_htmli_ui_AccordeonItem(outerNode) {
			this.init(outerNode, 'com.htmli.ui.AccordeonItem', 'AccordeonItem');
			
			
				this.innerNode = outerNode.children[1];
			
			
		}
		
		
		com_htmli_ui_AccordeonItem.prototype = new HTMLiElement();
		
		com_htmli_ui_AccordeonItem.prototype.getCaption = function() {
							
						var me = this;
						var __value = this.getAttribute('caption');
						var caption = __value;
				
						return me.outerNode.children[0].innerHTML;
						return __value;
					
				
			};
			
			com_htmli_ui_AccordeonItem.prototype.setCaption = function(caption) {
					
							var me = this;
							var __value = caption;
							
			
				me.outerNode.children[0].innerHTML = caption;
			
			
							this.setAttribute('caption', __value);	
											
				};		
			com_htmli_ui_AccordeonItem.prototype.getHidden = function() {
				
						var value = this.getAttribute('hidden');
						return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
					
				
			};
			
			com_htmli_ui_AccordeonItem.prototype.setHidden = function(hidden) {
					
							this.setAttribute('hidden', hidden ? 'true' : 'false');	
											
				};		
			com_htmli_ui_AccordeonItem.prototype.getTriggerHide = function() {
				
						var value = this.getAttribute('triggerHide');
						return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
					
				
			};
			
			com_htmli_ui_AccordeonItem.prototype.setTriggerHide = function(triggerHide) {
					
							this.setAttribute('triggerHide', triggerHide ? 'true' : 'false');	
											
				};		
			com_htmli_ui_AccordeonItem.prototype.show = function() {
				var me = this;
				
			
				var parentNode = me.getParentNode();
				if (parentNode.getExclusive()) {
					parentNode.hideAllExcept(me);
				}
				me.innerNode.style.display = '';
				me.setHidden(false);
				me.dispatchShow();				
			
			
			};				
		com_htmli_ui_AccordeonItem.prototype.hide = function() {
				var me = this;
				
			
				me.innerNode.style.display = 'none';
				me.setHidden(true);
				me.dispatchHide();								
			
			
			};				
		com_htmli_ui_AccordeonItem.prototype.toggle = function() {
				var me = this;
				
			
				var parentNode = me.getParentNode();			
				var hidden = me.getHidden();
				if (hidden) {
					me.show();
				} else if (!parentNode.getExclusive()) {
					me.hide();
				}
			
			
			};				
		com_htmli_ui_AccordeonItem.prototype._addEventListener = com_htmli_ui_AccordeonItem.prototype.addEventListener;
		
			com_htmli_ui_AccordeonItem.prototype._dispatchEvent = com_htmli_ui_AccordeonItem.prototype.dispatchEvent;
		
		
			com_htmli_ui_AccordeonItem.prototype.addEventListener = function(event, func, capture) {
				
					if (event == 'headerclick') {
						return this._addEventListenerFor(event, func);
					}				
				
					if (event == 'show') {
						return this._addEventListenerFor(event, func);
					}				
				
					if (event == 'hide') {
						return this._addEventListenerFor(event, func);
					}				
				
			
				return this._addEventListener(event, func, capture);
			};
		
			com_htmli_ui_AccordeonItem.prototype.dispatchEvent = function(event) {
				
					if (event.getType() == 'headerclick') {
						var aux;
						eval('com_htmli_ui_AccordeonItem.prototype.aux = function(ev) {'  + this.getAttribute('onheaderclick') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
					if (event.getType() == 'show') {
						var aux;
						eval('com_htmli_ui_AccordeonItem.prototype.aux = function(ev) {'  + this.getAttribute('onshow') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
					if (event.getType() == 'hide') {
						var aux;
						eval('com_htmli_ui_AccordeonItem.prototype.aux = function(ev) {'  + this.getAttribute('onhide') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
				
				return this._dispatchEvent(event);
			};
			
			com_htmli_ui_AccordeonItem.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_AccordeonItem.prototype.dispatchHeaderClick = function(ev) {
			var newEvent = application.createEvent('HTMLiEvents');
			newEvent.initHTMLiEvent('headerclick', this);
			this.dispatchEvent(newEvent);
		};
	
		com_htmli_ui_AccordeonItem.prototype.dispatchShow = function(ev) {
			var newEvent = application.createEvent('HTMLiEvents');
			newEvent.initHTMLiEvent('show', this);
			this.dispatchEvent(newEvent);
		};

		com_htmli_ui_AccordeonItem.prototype.dispatchHide = function(ev) {
			var newEvent = application.createEvent('HTMLiEvents');
			newEvent.initHTMLiEvent('hide', this);
			this.dispatchEvent(newEvent);
		};
		
		
	
		
		function main_Content(outerNode) {
			this.init(outerNode, 'main.Content', 'Content');
			
			
				this.innerNode = outerNode.children[0];
			
			
		}
		
		
		main_Content.prototype = new HTMLiElement();
		
		main_Content.prototype.getCaption = function() {
				
						return this.getAttribute('caption');
					
				
			};
			
			
		
		function com_htmli_ui_DatePicker(outerNode) {
			this.init(outerNode, 'com.htmli.ui.DatePicker', 'DatePicker');
			
			
			
		}
		
		
		com_htmli_ui_DatePicker.prototype = new HTMLiElement();
		
		com_htmli_ui_DatePicker.prototype.getLang = function() {
							
						var me = this;
						var __value = this.getAttribute('lang');
						var lang = __value;
				
						return lang? lang : 'en';
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setLang = function(lang) {
					
							this.setAttribute('lang', lang);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getFirstYear = function() {
							
						var me = this;
						var __value = this.getAttribute('firstyear');
						var firstYear = __value;
				
						return firstYear? firstYear : com_htmli_ui_DatePicker.FIRSTYEAR;
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setFirstYear = function(firstYear) {
					
							this.setAttribute('firstyear', firstYear);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getLastYear = function() {
							
						var me = this;
						var __value = this.getAttribute('lastyear');
						var lastYear = __value;
				
						return lastYear? lastYear : com_htmli_ui_DatePicker.LASTYEAR;
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setLastYear = function(lastYear) {
					
							this.setAttribute('lastyear', lastYear);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getDate = function() {
							
						var me = this;
						var __value = this.getAttribute('date');
						var date = __value;
				
						var day = me.getDay(); var month = me.getMonth(); day = (day<10)? ('0'+day): day; month = (month<10)? ('0'+month): month; return day + com_htmli_ui_DatePicker.SEPARATOR + month + com_htmli_ui_DatePicker.SEPARATOR + me.getYear();
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setDate = function(date) {
					
							var me = this;
							var __value = date;
							
			
				if (date) {
					var day = date.substring(0,date.indexOf(com_htmli_ui_DatePicker.SEPARATOR));
					day = (day.indexOf('0') == 0)? parseInt(day.substring(1,2)) : parseInt(day);
					me.setDay(day);
					
					if (date.indexOf(com_htmli_ui_DatePicker.SEPARATOR) > 0) {
						var month = parseInt(date.substring(date.indexOf(com_htmli_ui_DatePicker.SEPARATOR)+1,
							date.lastIndexOf(com_htmli_ui_DatePicker.SEPARATOR)));				
						me.setMonth(month);
					}
					
					if (date.indexOf(com_htmli_ui_DatePicker.SEPARATOR) > 0 && 
						date.indexOf(com_htmli_ui_DatePicker.SEPARATOR) < date.lastIndexOf(com_htmli_ui_DatePicker.SEPARATOR)) {
		
						var year = parseInt(date.substring(date.lastIndexOf(com_htmli_ui_DatePicker.SEPARATOR)+1,date.length));				
						if (year>me.getFirstYear()) {
							me.setYear(year);	
						}
					}			
					return;							
				}
			
			
							this.setAttribute('date', __value);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getDay = function() {
							
						var me = this;
						var __value = this.getAttribute('day');
						var day = __value;
				
						if (!day || day < 1 || day > 31) { var today = new Date(); return today.getDate(); }
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setDay = function(day) {
					
							var me = this;
							var __value = day;
							
			
				if (typeof day != 'number' || isNaN(day) || day < 1 || day > 31) {
					return;
				}
			
			
							this.setAttribute('day', __value);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getMonth = function() {
							
						var me = this;
						var __value = this.getAttribute('month');
						var month = __value;
				
						if (!month) { var today = new Date(); return today.getMonth()+1; }
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setMonth = function(month) {
					
							var me = this;
							var __value = month;
							
			
				if (typeof month != 'number' || isNaN(month) || month<1 || month>12) {
					return;
				}
			
			
							this.setAttribute('month', __value);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getYear = function() {
							
						var me = this;
						var __value = this.getAttribute('year');
						var year = __value;
				
						if (!year || year<0 || year>3000) { var today = new Date(); return today.getFullYear(); }
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setYear = function(year) {
					
							var me = this;
							var __value = year;
							
				if (typeof year != 'number' || isNaN(year)) {
					return;
				}
			
							this.setAttribute('year', __value);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getFromYear = function() {
				
						var value = this.getAttribute('fromyear');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setFromYear = function(fromYear) {
					
							this.setAttribute('fromyear', fromYear);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getFromMonth = function() {
				
						var value = this.getAttribute('frommonth');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setFromMonth = function(fromMonth) {
					
							this.setAttribute('frommonth', fromMonth);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getFromDay = function() {
				
						var value = this.getAttribute('fromday');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setFromDay = function(fromDay) {
					
							this.setAttribute('fromday', fromDay);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getToYear = function() {
				
						var value = this.getAttribute('toyear');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setToYear = function(toYear) {
					
							this.setAttribute('toyear', toYear);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getToMonth = function() {
				
						var value = this.getAttribute('tomonth');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setToMonth = function(toMonth) {
					
							this.setAttribute('tomonth', toMonth);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getToDay = function() {
				
						var value = this.getAttribute('today');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setToDay = function(toDay) {
					
							this.setAttribute('today', toDay);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getFromDate = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var fromDate = __value;
				
						var day = me.getFromDay(); var month = me.getFromMonth(); day = (day<10)? ('0'+day): day; month = (month<10)? ('0'+month): month; return day + com_htmli_ui_DatePicker.SEPARATOR + month + com_htmli_ui_DatePicker.SEPARATOR + me.getFromYear();
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setFromDate = function(fromDate) {
					
							this.setAttribute('', fromDate);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getToDate = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var toDate = __value;
				
						var day = me.getToDay(); var month = me.getToMonth(); day = (day<10)? ('0'+day): day; month = (month<10)? ('0'+month): month; return day + com_htmli_ui_DatePicker.SEPARATOR + month + com_htmli_ui_DatePicker.SEPARATOR + me.getToYear();
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setToDate = function(toDate) {
					
							this.setAttribute('', toDate);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getMode = function() {
				
						return this.getAttribute('mode');
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setMode = function(mode) {
					
							this.setAttribute('mode', mode);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getCalendar = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var calendar = __value;
				
						return new Date(this.getYear(), this.getMonth()-1, this.getDay());
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setCalendar = function(calendar) {
					
							this.setAttribute('', calendar);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getMonthName = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var monthName = __value;
				
						return this.getMonths()[this.getMonth()-1];
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setMonthName = function(monthName) {
					
							this.setAttribute('', monthName);	
											
				};		
			com_htmli_ui_DatePicker.prototype.getWeekDayName = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var weekDayName = __value;
				
						return this.getWeekdays()[this.getCalendar().getDay()];
						return __value;
					
				
			};
			
			com_htmli_ui_DatePicker.prototype.setWeekDayName = function(weekDayName) {
					
							this.setAttribute('', weekDayName);	
											
				};		
			com_htmli_ui_DatePicker.prototype.showIn = function(top,left) {
				var me = this;
				
			

				if (!me.hasYearList()) {
					me.fillYearList();
					me.fillMonthList();			
					me.createHeader();					
				}
				me.createCalendar(true);	
				var style =	me.outerNode.style;
				style.display = 'block';
				if (top) {
					style.top = top + "px";
				}
				if (left) {
					style.left = left + "px";
				}
				style.zIndex = application.nextZIndex++;
				if (document.all) {
					this.resizeIframe();			
					/* TODO: solve problem when clicking in header 
					var prev = this.outerNode.childNodes[1].firstChild.firstChild.firstChild.childNodes[0];
					prev.style.display = 'none';			
					var next = this.outerNode.childNodes[1].firstChild.firstChild.firstChild.childNodes[3];
					next.style.display = 'none';					
					*/				
				} else {
					me.outerNode.children[0].style.display = 'none';
				}
				
				me.outerNode.visible = true;
				if (me.getMode() && me.getMode().indexOf('quick') >= 0) {
					com_htmli_ui_DatePicker.current = me;
				}
			
			
			};				
		com_htmli_ui_DatePicker.prototype.show = function(date,top,left) {
				var me = this;
				
			
				me.setDate(date);
				me.showIn(top, left);
			
			
			};				
		com_htmli_ui_DatePicker.prototype.hide = function() {
				var me = this;
				
			
				var style =	me.outerNode.style;
				style.display = 'none';
				me.outerNode.visible = false;
			
			
			};				
		com_htmli_ui_DatePicker.prototype.nextDay = function() {
				var me = this;
				
			
				var next = me.outerNode.selected.getNextSibling();
								
				if (next && next.getTagName()=='TD') {
					me.changeTo(next, true);				
				} else {
					var date = new Date(me.getYear(), me.getMonth()-1, me.getDay());
					date.setDate(date.getDate()+1);
					me.setDay(date.getDate());
					me.setMonth(date.getMonth()+1);
					me.setYear(date.getFullYear());
					me.createCalendar(true);
				}
			
			
			};				
		com_htmli_ui_DatePicker.prototype.previousDay = function() {
				var me = this;
				
			
				var previous = me.outerNode.selected.getPreviousSibling();
				
				if (previous && previous.getTagName()=='TD') {
					me.changeTo(previous,true);				
				} else {
					var date = new Date(me.getYear(), me.getMonth()-1, me.getDay());
					date.setDate(date.getDate()-1);
					me.setDay(date.getDate());
					me.setMonth(date.getMonth()+1);
					me.setYear(date.getFullYear());
					me.createCalendar(true);
				}
			
			
			};				
		com_htmli_ui_DatePicker.prototype.previousMonth = function() {
				var me = this;
				
			
				var month = parseInt(me.getMonth())-1;
				if (month<1) {
					me.setYear(parseInt(me.getYear())-1);
					month = 12;
				}
				me.setMonth(month);	
				me.createCalendar(true);			
			
			
			};				
		com_htmli_ui_DatePicker.prototype.nextMonth = function() {
				var me = this;
				
			
				var month = parseInt(me.getMonth())+1;
				if (month>12) {
					me.setYear(parseInt(me.getYear())+1);
					month = 1;
				}
				me.setMonth(month);	
				me.createCalendar(true);			
			
			
			};				
		com_htmli_ui_DatePicker.prototype.toMonth = function(month) {
				var me = this;
				
			
				me.setMonth(month);	
				me.createCalendar(true);			
			
			
			};				
		com_htmli_ui_DatePicker.prototype.toYear = function(year) {
				var me = this;
				
			
				me.setYear(year);	
				me.createCalendar(true);			
			
			
			};				
		com_htmli_ui_DatePicker.prototype.addHoliday = function(holiday) {
				var me = this;
				
			
				if (holiday.length == 3 && parseInt(holiday[0]) > 0 && parseInt(holiday[1]) > 0
					&&  holiday[2])  {
					com_htmli_ui_DatePicker.holidays.push(holiday);
				}
			
			
			};				
		com_htmli_ui_DatePicker.prototype.setHolidays = function(holidays) {
				var me = this;
				
			
				var length = holidays.length;
				for (var i = 0; i< length; i++)
				{
					var holiday = holidays[i];
					if (holidays.length != 3 || parseInt(holiday[0]) <= 0 || parseInt(holiday[1]) <= 0
						||  !holiday[2])  {
						return;
						}
				}
				com_htmli_ui_DatePicker.holidays = holidays;
			
			
			};				
		com_htmli_ui_DatePicker.prototype.onFormKeyUp = function(ev) {
				var me = this;
				
			
				var keycode = ev.getKeyCode();
				if (keycode==33 || keycode==34 || keycode==38 || keycode==40
					 || keycode==13) {
					me.registerFormTarget(ev.getTarget());			
				}

				if (keycode==33 || keycode==34 || keycode==38 || keycode==40) {
					me.dispatchChangeEvent();	
				}

				if(keycode==33) {
					me.previousMonth();
				} else if(keycode==34) {
					me.nextMonth();
				} else if(keycode==38) {
					if (!me.outerNode.visible) {
						var target = ev.getTarget();
						me.show(target.getValue(), me.getYPosition(target),
								target.getRelativeX());
					} else {
						me.previousDay();
					}
				} else if(keycode==40) {
					if (!me.outerNode.visible) {
						var target = ev.getTarget();
						me.show(target.getValue(), me.getYPosition(target),
								target.getRelativeX());
					} else { 
						me.nextDay();
					}

				} else if(keycode==27) {
					me.hide();
				} else if(keycode==13) {
					if (me.getMode() && me.getMode().indexOf('quick') >= 0) {
						me.hide();
					}
					me.dispatchPickEvent();						
				}
			
			
			};				
		com_htmli_ui_DatePicker.prototype.onFormClick = function(ev) {
				var me = this;
				
			
				var target = ev.getTarget();

				me.registerFormTarget(target);	
				me.show(target.getValue(), me.getYPosition(target),
					 target.getRelativeX());
			
			
			};				
		com_htmli_ui_DatePicker.prototype.onFormKeyDown = function(ev) {
				var me = this;
				
			
				if (ev.getKeyCode()==13) {
					ev.preventDefault();
				} 
				
			
			};				
		com_htmli_ui_DatePicker.prototype.getFormTarget = function() {
				var me = this;
				
			
				return com_htmli_ui_DatePicker.formTarget;
			
			
			};				
		com_htmli_ui_DatePicker.prototype.registerFormTarget = function(target) {
				var me = this;
				
			
				com_htmli_ui_DatePicker.formTarget = target;					
			
			
			};				
		com_htmli_ui_DatePicker.prototype._addEventListener = com_htmli_ui_DatePicker.prototype.addEventListener;
		
			com_htmli_ui_DatePicker.prototype._dispatchEvent = com_htmli_ui_DatePicker.prototype.dispatchEvent;
		
		
			com_htmli_ui_DatePicker.prototype.addEventListener = function(event, func, capture) {
				
					if (event == 'change') {
						return this._addEventListenerFor(event, func);
					}				
				
					if (event == 'pick') {
						return this._addEventListenerFor(event, func);
					}				
				
					if (event == 'change') {
						return this._addEventListenerFor(event, func);
					}				
				
			
				return this._addEventListener(event, func, capture);
			};
		
			com_htmli_ui_DatePicker.prototype.dispatchEvent = function(event) {
				
					if (event.getType() == 'change') {
						var aux;
						eval('com_htmli_ui_DatePicker.prototype.aux = function(ev) {'  + this.getAttribute('onchange') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
					if (event.getType() == 'pick') {
						var aux;
						eval('com_htmli_ui_DatePicker.prototype.aux = function(ev) {'  + this.getAttribute('onpick') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
					if (event.getType() == 'change') {
						var aux;
						eval('com_htmli_ui_DatePicker.prototype.aux = function(ev) {'  + this.getAttribute('onchange') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
				
				return this._dispatchEvent(event);
			};
			
			com_htmli_ui_DatePicker.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_DatePicker.SEPARATOR = '/';	
		com_htmli_ui_DatePicker.LANG_EN = 0;				
		com_htmli_ui_DatePicker.LANG_ES = 1;		
		com_htmli_ui_DatePicker.LANG_DE = 2;
		com_htmli_ui_DatePicker.MONTHS = [['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
										  ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre']];
		com_htmli_ui_DatePicker.WEEKDAYS = [['S', 'M', 'T', 'W', 'T', 'F', 'S'],
											['D', 'L', 'M', 'M', 'J', 'V', 'S']];
		com_htmli_ui_DatePicker.FIRSTYEAR = 1970;		
		com_htmli_ui_DatePicker.LASTYEAR = 2020;
		
		com_htmli_ui_DatePicker.holidays = [];
		
		com_htmli_ui_DatePicker.current;

		com_htmli_ui_DatePicker.prototype.created = false;			

		com_htmli_ui_DatePicker.prototype.monthChange = function(obj) {
			this.toMonth(obj.selectedIndex+1);
		};
		
		com_htmli_ui_DatePicker.prototype.yearChange = function(obj) {
			this.toYear(parseInt(obj.options[1].value) + obj.selectedIndex - 1);
		};
		
		com_htmli_ui_DatePicker.prototype.fillYearList = function() {
			var firstYear = this.getFirstYear();
			var lastYear = this.getLastYear();			
			var selectList = this.outerNode.children[1].children[0].children[0].children[0].children[2];
			
			for (var i = firstYear; i<=lastYear; i++) {
				var node = document.createElement('option');
				node.innerHTML = i;
				node.value = i;
				selectList.appendChild(node);
			}
		};

		com_htmli_ui_DatePicker.prototype.hasYearList = function() {
			var selectList = this.outerNode.children[1].children[0].children[0].children[0].children[2];
			return selectList.childNodes.length>0;			
		};
		
		com_htmli_ui_DatePicker.prototype.fillMonthList = function() {
			var months = this.getMonths(); 
			var selectList = this.outerNode.children[1].children[0].children[0].children[0].children[1];
			for (var i = 0; i<12; i++) {
				var node = document.createElement('option');
				node.innerHTML = months[i];
				node.value = i+1;
				selectList.appendChild(node);
			}
		};

		com_htmli_ui_DatePicker.prototype.getMonths = function() {
			return (this.getLang() == "es" || this.getLang() == "ES") ?  
				com_htmli_ui_DatePicker.MONTHS[com_htmli_ui_DatePicker.LANG_ES] : com_htmli_ui_DatePicker.MONTHS[com_htmli_ui_DatePicker.LANG_EN];
		};
		
		com_htmli_ui_DatePicker.prototype.selectMonth = function(month) {
			var selectList = this.outerNode.children[1].children[0].children[0].children[0].children[1];
			for (var i = 0; i<12; i++) {
				var node = selectList[i];
				if (i==month-1) {
					node.selected = 'selected';
				}
			}
		};

		com_htmli_ui_DatePicker.prototype.selectYear = function(year) {
			var firstYear = this.getFirstYear();
			var lastYear = this.getLastYear();			
			var selectList = this.outerNode.children[1].children[0].children[0].children[0].children[2];
			
			for (var i=firstYear; i<=lastYear; i++) {
				var node = selectList[i-firstYear];
				if (i==year) {
					node.selected = 'selected';
				}
			}
		};


	
		com_htmli_ui_DatePicker.prototype.createHeader = function() {
			var calendar = this.outerNode.children[1].children[0];			
			var week = calendar.insertRow(-1);					
			
			var weekdays = this.getWeekdays(); 
			
			
			for (i = 0; i < 7; i++) {
				var td = week.insertCell(-1);
				td.innerHTML = weekdays[i];
				td.className = 'com_htmli_ui_DatePicker__header';
			}
		};
		
		com_htmli_ui_DatePicker.prototype.getWeekdays = function() {
			return (this.getLang() == "es" || this.getLang() == "ES") ? 
				com_htmli_ui_DatePicker.WEEKDAYS[com_htmli_ui_DatePicker.LANG_ES] : com_htmli_ui_DatePicker.WEEKDAYS[com_htmli_ui_DatePicker.LANG_EN];
		}
		
		com_htmli_ui_DatePicker.prototype.createCalendar = function(notifyChange) {

			var today = new Date();
			
			var day = this.getDay();
			var	month = this.getMonth();
			var	year = this.getYear();
			
			var holidays = com_htmli_ui_DatePicker.getHolidays(month);
			var nHolidays = holidays.length;
			this.removeCalendar();
			var didselect = false;
			var thisMonth = month-1;
			var firstDay = new Date(year, thisMonth, 1);
			var firstWeekDay = firstDay.getDay();
			if (firstWeekDay>0) {
				firstDay.setDate(firstDay.getDate()-(firstWeekDay));			
			}

			this.selectMonth(month);
			this.selectYear(year);

			var calendar = this.outerNode.children[1].children[0];
			var fromDate, toDate;
			if (this.getFromDay() && this.getFromMonth() && this.getFromYear() && 
				this.getToDay() && this.getToMonth() && this.getToYear()) {
				fromDate = new Date(this.getFromYear(), this.getFromMonth()-1, this.getFromDay());
				toDate = new Date(this.getToYear(), this.getToMonth()-1, this.getToDay());
			}
						
			for (var date = firstDay, weekday = 0; ; 
				date.setDate(date.getDate()+1), weekday++) {
				
				if (weekday % 7 == 0) {
					var week = calendar.insertRow(-1);					
					if (date.getMonth() == thisMonth+1 || date.getFullYear() > year) {
						break;
					}
				}				


				var td = week.insertCell(-1);
				var myTd = application.wrapNode(td);				
				td.innerHTML = date.getDate();
				if (date.getMonth() == thisMonth) {
					if (date.getDate() == day) {
						td.className = 'com_htmli_ui_DatePicker__selected';					
						this.outerNode.selected = myTd;
						didselect = true;
					} else {
						td.className = 'com_htmli_ui_DatePicker__thismonth';
					}
				} else {
					td.className = 'com_htmli_ui_DatePicker__othermonth';				
				}
				if (weekday % 7 == 0 || weekday % 7 == 6) {
					td.className = 	td.className + ' com_htmli_ui_DatePicker__weekend';
				}
				
				if (date.getDate() == today.getDate() && date.getMonth() == today.getMonth() && date.getFullYear() == today.getFullYear()) {
					td.className = 	td.className + ' com_htmli_ui_DatePicker__today';
				}
				if ( (fromDate && date.getTime() >=fromDate.getTime()) && (toDate && date.getTime() <=toDate.getTime())) {
					td.className = 	td.className + ' com_htmli_ui_DatePicker__period';
				}

				for (var i = 0; i<nHolidays; i++) {
					if (holidays[i][0] == date.getDate() && holidays[i][1] == date.getMonth()+1) {
						td.className = 	td.className + ' com_htmli_ui_DatePicker__holiday';
						td.title = holidays[i][2];						
					}
				}
				td.setAttribute('month',date.getMonth());
				td.setAttribute('day',date.getDate());				
				td.setAttribute('year',date.getFullYear());				
		
				myTd.addEventListener('mousedown', function(ev) {
					var target = ev.getTarget();
					
					var datepicker = target.getParentNode().getParentNode().getParentNode().getParentNode();
					if (parseInt(target.getAttribute('month'))+1 == datepicker.getMonth()) {
						datepicker.changeTo(target, true, true, ev.getShiftKey());
						if (datepicker.getMode() && datepicker.getMode().indexOf('quick') >= 0) {
							datepicker.hide();
						}
					} else {
						/* If a day of another month is clicked, change the calendar but don-t hide it */
						datepicker.changeTo(target, true, false, ev.getShiftKey());
					}

				});
				myTd.addEventListener('click', function(ev) {
					ev.stopPropagation();
				});
				
			}

			if (!notifyChange || notifyChange != false) {
				this.dispatchChangeEvent();		
			}
			
			if(!didselect && this.getDay()>28 && this.getYear()>0 && this.getMonth()>0) {
				for (var newDay = parseInt(this.getDay()); 
				new Date(this.getYear(),parseInt(this.getMonth())-1,newDay).getMonth() == this.getMonth();
				newDay--);
				this.setDay(newDay);
				this.createCalendar(notifyChange);
			}
			this.resizeIframe();							
		};
		
		com_htmli_ui_DatePicker.prototype.resizeIframe = function() {
			var table = application.wrapNode(this.outerNode.children[1]);
			var iframe = this.outerNode.children[0];
			iframe.style.height = table.getHeight() + "px";			
		};
					
		com_htmli_ui_DatePicker.prototype.dispatchChangeEvent = function() {
			var myEvent = application.createEvent('HTMLEvents');
			myEvent.initEvent('change');
			this.dispatchEvent(myEvent);
		};


		com_htmli_ui_DatePicker.prototype.dispatchPickEvent = function() {
			var newEvent = application.createEvent('HTMLiEvents');
			newEvent.initHTMLiEvent('pick', this);
			this.dispatchEvent(newEvent);
		};


		com_htmli_ui_DatePicker.prototype.removeCalendar = function() {
			var calendar = this.outerNode.children[1].children[0];			
			var length = calendar.children.length;
			for (var i = length; i>2; i--) {
				calendar.removeChild(calendar.childNodes[calendar.childNodes.length-1]);
			}				
		};

		com_htmli_ui_DatePicker.getHolidays = function(month) {
			var holidays = com_htmli_ui_DatePicker.holidays;
			var length = holidays.length;
			var result = new Array();
			for (var i = 0; i<length; i++) {
				if (holidays[i][1] == month) {
					result.push(holidays[i]);
				}
			}
			return result;
		};
		
		com_htmli_ui_DatePicker.prototype.getYPosition = function(target) {
			var y = target.getRelativeY() + target.getHeight();
			if ((y + 150) > com_htmli_ui_Window.getMaxHeight()) {
				y = y - 150 - target.getHeight();
			}
			return y;
		}
		
		com_htmli_ui_DatePicker.prototype.changeTo = function(target, notifyChange, notifyPick, multiple) {

			var day = parseInt(target.getAttribute('day'));
			var month = parseInt(target.getAttribute('month'))+1;
			var year = parseInt(target.getAttribute('year'));
			
			
			/* Multiple Dates */
			this.setMultiple(multiple,day,month,year);
			
						
			this.setDay(day);

			
			if (this.getMonth() != month) {
				this.setMonth(month);
				this.setYear(year);						
				this.createCalendar(notifyChange);							
				this.dispatchChangeEvent();		
				return;
			}
			this.setMonth(month);
			this.setYear(year);
			var className = this.outerNode.selected.getClassName();
			if (className.indexOf('weekend')>=0) {
				this.outerNode.selected.setClassName('com_htmli_ui_DatePicker__weekend com_htmli_ui_DatePicker__thismonth');
			} else {
				this.outerNode.selected.setClassName('com_htmli_ui_DatePicker__thismonth');
			}
			if (className.indexOf('holiday')>=0) {
				this.outerNode.selected.setClassName(this.outerNode.selected.getClassName() + ' com_htmli_ui_DatePicker__holiday');
			}
				
			className = target.getClassName();
			if (className.indexOf('weekend')>=0) {
				target.setClassName('com_htmli_ui_DatePicker__weekend com_htmli_ui_DatePicker__selected');
			} else {
				target.setClassName('com_htmli_ui_DatePicker__selected');
			}
			if (className.indexOf('holiday')>=0) {
				target.setClassName(target.getClassName() + ' com_htmli_ui_DatePicker__holiday');
			}
				
			/* Mark today when selecting and deselecting */
			var today = new Date();
			var date = new Date(year, month-1, day);
			if (date.getDate() == today.getDate() && date.getMonth() == today.getMonth() && date.getFullYear() == today.getFullYear()) {
				target.setClassName(target.getClassName() + ' com_htmli_ui_DatePicker__today');
			}
			date = new Date(this.outerNode.selected.getAttribute('year'), this.outerNode.selected.getAttribute('month'), this.outerNode.selected.getAttribute('day'));
			if (date.getDate() == today.getDate() && date.getMonth() == today.getMonth() && date.getFullYear() == today.getFullYear()) {
				this.outerNode.selected.setClassName(this.outerNode.selected.getClassName() + ' com_htmli_ui_DatePicker__today');
			}
			

			this.outerNode.selected = target;




			/* Default behaviour is to notify changes */
			if (!notifyChange || notifyChange != false) {
				this.dispatchChangeEvent();		
			}
			/* Default behaviour is not to notify pick */
			if (notifyPick) {
				this.dispatchPickEvent();		
			}
			
			
			
			
		};
		
		com_htmli_ui_DatePicker.prototype.setMultiple = function(multiple, day, month, year) {
			if (multiple) {
				var fromDate = new Date(this.getYear(),this.getMonth()-1,this.getDay());
				var toDate = new Date(year,month-1,day);
				if (toDate.getTime() < fromDate.getTime()) {
					var d = fromDate;
					fromDate = toDate;
					toDate = d;
				}
				this.setFromDay(fromDate.getDate());
				this.setFromMonth(fromDate.getMonth()+1);
				this.setFromYear(fromDate.getFullYear());
				this.setToDay(toDate.getDate());
				this.setToMonth(toDate.getMonth()+1);
				this.setToYear(toDate.getFullYear());
			} else {
				this.setFromDay(null);
				this.setFromMonth(null);
				this.setFromYear(null);
				this.setToDay(null);
				this.setToMonth(null);
				this.setToYear(null);
			}
		};
		
		application.addEventListener('click', function(ev) {			
			var current = com_htmli_ui_DatePicker.current;
			if (current) {
				current.hide();
			}
		}, false);
		
		
	
		
		function com_htmli_ui_DragAndDrop(outerNode) {
			this.init(outerNode, 'com.htmli.ui.DragAndDrop', 'DragAndDrop');
			
			
			
		}
		
		
		com_htmli_ui_DragAndDrop.prototype = new HTMLiElement();
		
		com_htmli_ui_DragAndDrop.prototype.getHtmlFor = function() {
				
						return this.getAttribute('for');
					
				
			};
			
			com_htmli_ui_DragAndDrop.prototype.setHtmlFor = function(htmlFor) {
					
							this.setAttribute('for', htmlFor);	
											
				};		
			com_htmli_ui_DragAndDrop.prototype.top = function() {
				var me = this;
				
				me.outerNode.zIndex = application.nextZIndex++;
			
			};				
		com_htmli_ui_DragAndDrop.prototype._addEventListener = com_htmli_ui_DragAndDrop.prototype.addEventListener;
		
			com_htmli_ui_DragAndDrop.prototype._dispatchEvent = com_htmli_ui_DragAndDrop.prototype.dispatchEvent;
		
		
			com_htmli_ui_DragAndDrop.prototype.addEventListener = function(event, func, capture) {
				
					if (event == 'dragelement') {
						return this._addEventListenerFor(event, func);
					}				
				
					if (event == 'dropelement') {
						return this._addEventListenerFor(event, func);
					}				
				
			
				return this._addEventListener(event, func, capture);
			};
		
			com_htmli_ui_DragAndDrop.prototype.dispatchEvent = function(event) {
				
					if (event.getType() == 'dragelement') {
						var aux;
						eval('com_htmli_ui_DragAndDrop.prototype.aux = function(ev) {'  + this.getAttribute('ondragelement') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
					if (event.getType() == 'dropelement') {
						var aux;
						eval('com_htmli_ui_DragAndDrop.prototype.aux = function(ev) {'  + this.getAttribute('ondropelement') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
				
				return this._dispatchEvent(event);
			};
			
			com_htmli_ui_DragAndDrop.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_DragAndDrop.dnd = null;
			
		com_htmli_ui_DragAndDrop.target = null;
		com_htmli_ui_DragAndDrop.coords = null;
		com_htmli_ui_DragAndDrop.zIndex = 1;
		 
		/**
		 * Private function called when drag and drop begins
		 */
		com_htmli_ui_DragAndDrop.prototype.start = function(x, y, ev) {		
			var targetId, target;
			
			com_htmli_ui_DragAndDrop.dnd = this;
			this.dispatchDrag(ev);			

			if (this.getHtmlFor() == "" || !this.getHtmlFor()) {
				target = this;
			} else {
				target = this.getContainer().getElementById(this.getHtmlFor());
			}
			
			com_htmli_ui_DragAndDrop.coords = [x, y];
			var currentStyle = target.outerNode.currentStyle ? target.outerNode.currentStyle : target.outerNode.runtimeStyle ;
			
			if (currentStyle.position != 'absolute') {
				target.outerNode.style.position = 'absolute';
			}
			if (isNaN(parseInt(currentStyle.top)) || isNaN(parseInt(currentStyle.left))) {
				target.outerNode.style.top = application.getScrollTop() + target.getRelativeY() + 'px';
				target.outerNode.style.left = application.getScrollLeft() + target.getRelativeX() + 'px';					
			}
			target.outerNode.style.zIndex = application.nextZIndex++;
			com_htmli_ui_DragAndDrop.target = target;
		};
		
		com_htmli_ui_DragAndDrop.prototype.dispatchDrag = function(ev) {
			var newEvent = application.createEvent('HTMLiEvents');
			newEvent.initHTMLiEvent('dragelement', this);
			this.dispatchEvent(newEvent);
		};
		
		com_htmli_ui_DragAndDrop.prototype.dispatchDrop = function(ev) {
			var newEvent = application.createEvent('HTMLiEvents');
			newEvent.initHTMLiEvent('dropelement', this);
			this.dispatchEvent(newEvent);
		};
		
		/**
		 * Called when drag and drop begins
		 */
		com_htmli_ui_DragAndDrop.zoom = 1;
		
		application.addEventListener('mousemove', function(ev) {
			var target = com_htmli_ui_DragAndDrop.target;
			var coords = com_htmli_ui_DragAndDrop.coords;

			if (target != null && coords != null) {
				var x = ev.getClientX();
				var y = ev.getClientY();
				var diff = [x - coords[0], y - coords[1]];
				var style =  target.outerNode.style;
				var currentStyle = target.outerNode.currentStyle ? target.outerNode.currentStyle : target.outerNode.runtimeStyle ;
				
				var t = parseInt(currentStyle.top);
				var l = parseInt(currentStyle.left);

				style.top = ((isNaN(t) ? 0 : t) + diff[1]/com_htmli_ui_DragAndDrop.zoom) + "px";
				style.left = ((isNaN(l) ? 0 : l) + diff[0]/com_htmli_ui_DragAndDrop.zoom) + "px";
				com_htmli_ui_DragAndDrop.coords = [x, y];
			}
		}, false);
		
		/**
		 * Called when drag and drop ends
		 */
		application.addEventListener('mouseup', function(ev) {
				if(com_htmli_ui_DragAndDrop.dnd) {
					com_htmli_ui_DragAndDrop.dnd.dispatchDrop(ev);
					com_htmli_ui_DragAndDrop.dnd = null;				
				}
				com_htmli_ui_DragAndDrop.target = null;
			}, false);
			
		
		
		
	
		
		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.children[0].children[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;
				/* remove non children */
				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();							
						}
					}					
				}	

				/* add to the stack */
				try {
					if (length) {
						for (var i=length-1; i >= 0; i--) {
							if (com_htmli_ui_Menu.active[i].outerNode == me.outerNode) {
								return;
							}
						}							
					}
				}
				/*Only to ignore opening of 2 context menus in a row*/
				catch(e) { }
				com_htmli_ui_Menu.active.push(me);

				/* set style */
				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.children[0]);
				var outer = application.wrapNode(this.outerNode);				
				var shadow = me.outerNode.children[me.outerNode.children.length-1];
				shadow.style.height = table.getHeight() + "px";			
				shadow.style.width = outer.getWidth() + "px";			
				
			
			
			};				
		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;
					}
				}
				var items = me.getChildren();
				var length = items.getLength();
				for (var i=0; i<length; i++) {
					if (items.item(i).getClass() == 'com.htmli.ui.MenuItem') {
						items.item(i).turnOff();
					}
				}
			
			
			};				
		
	
		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;	
		};
		
		com_htmli_ui_Menu.hideAll = 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_MenuBarItem.open = null;
				if(com_htmli_ui_MenuItem.active) {
					com_htmli_ui_MenuItem.active.turnOff();
					com_htmli_ui_MenuItem.active = null;				
				}
			}
			com_htmli_ui_Menu.clickedDisabled = false;		
		}
		
		application.addEventListener('click', function(ev) {			
			com_htmli_ui_Menu.hideAll(ev);			
		}, 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.prototype.open = function() {
				var me = this;
				
			
				me.getChildren().item(0).showMenu();
			
			
			};				
		
	
		com_htmli_ui_MenuBar.open = false;
		com_htmli_ui_MenuBar.defaultMenu = null;
		
		application.addEventListener('keyup', function(ev) {	

			if (ev.getKeyCode() == 40 && ev.getCtrlKey() && ev.getAltKey()) {
				/*Shows the menu bar*/
				com_htmli_ui_MenuBar.defaultMenu.open();
			} 
			ev.stopPropagation();
			ev.preventDefault();		
			return false;	
		}, false);
		
	
		
		function com_htmli_ui_MenuBarItem(outerNode) {
			this.init(outerNode, 'com.htmli.ui.MenuBarItem', 'MenuBarItem');
			
			
				this.innerNode = outerNode.children[1];
			
			
		}
		
		
		com_htmli_ui_MenuBarItem.prototype = new HTMLiElement();
		
		com_htmli_ui_MenuBarItem.prototype.showMenu = function(selectFirst) {
				var me = this;
				
			
				me.highlight();
				var child = me.getChildren().item(0);
				if (child != null) {
					com_htmli_ui_MenuBarItem.open = me;
					child.show(me.getHeight());
				}
				me.selectFirst(selectFirst);
			
			
			};				
		com_htmli_ui_MenuBarItem.prototype.hideMenu = function() {
				var me = this;
				
			
				me.turnOff();
				var child = me.getChildren().item(0);
				if (child != null) {
					com_htmli_ui_MenuBarItem.open = null;				
					child.hide();
				}
				child = null;
			
			
			};				
		
	

		
		com_htmli_ui_MenuBarItem.prototype.mouseOver = function(ev) {

			this.highlight();
			if (com_htmli_ui_Menu.flag && com_htmli_ui_MenuBarItem.open) {
				this.showMenu(); 
				ev.stopPropagation();	
			}
		};
		
		com_htmli_ui_MenuBarItem.prototype.highlight = function() {
			this.getParentNode().getStyle().zIndex = application.nextZIndex++;
			
			/* Turn off other items */
			var menuBarItems = this.getParentNode().getChildren();
			var length = menuBarItems.getLength();

			for (var i=0; i<length; i++) {
				var menuBarItem = menuBarItems.item(i);
				menuBarItem.setClassName('com_htmli_ui_MenuBarItem');
			}
			this.setClassName('com_htmli_ui_MenuBarItem__hover');
			
			com_htmli_ui_MenuBarItem.active = this;
		};
		
		com_htmli_ui_MenuBarItem.prototype.turnOff = function() {
			this.setClassName('com_htmli_ui_MenuBarItem');
			com_htmli_ui_MenuBarItem.active = null;			
		}
		
		com_htmli_ui_MenuBarItem.prototype.click = function(ev) {
			if (!com_htmli_ui_MenuBarItem.open) {
				com_htmli_ui_MenuBarItem.open = this;
				this.showMenu(); 
				ev.stopPropagation();	
			} else {
				com_htmli_ui_MenuBarItem.open = null;			
				this.hideMenu(); 
				ev.stopPropagation();	
			}
		};
		
		com_htmli_ui_MenuBarItem.prototype.selectFirst = function(highlight) {
			if (this.getChildren().getLength() > 0) {
				var mi = this.getFirstElementChild().getFirstElementChild();
				
				if (highlight) {
					mi.highlight();
				}
				com_htmli_ui_MenuItem.active = mi;
			}
		};			
		
		application.addEventListener('keyup', function(ev) {	
			/* Left cursor pressed */
			
			if (ev.getKeyCode()==37 && !ev.getCtrlKey() && !ev.getAltKey()) {
				if (com_htmli_ui_MenuItem.active && com_htmli_ui_MenuItem.active.getParentNode().getParentNode()
				&& com_htmli_ui_MenuItem.active.getParentNode().getParentNode().getClass() == 'com.htmli.ui.MenuItem') {
					com_htmli_ui_MenuItem.active.getParentNode().getParentNode().hideMenu();
				} else if (com_htmli_ui_MenuBarItem.active) {
					var mbi = com_htmli_ui_MenuBarItem.active.getPreviousElementSibling();
					if (mbi) {
						if (com_htmli_ui_MenuBarItem.open) {
							com_htmli_ui_MenuBarItem.open.hideMenu();
							mbi.showMenu(true);
						}/* else {
							com_htmli_ui_MenuBarItem.active.turnOff();
							mbi.highlight();
						}*/
					}
				}
			} 
			/* Right cursor pressed */
			if (ev.getKeyCode()==39 && !ev.getCtrlKey() && !ev.getAltKey()) {
				/*If it is submenu*/
				if (com_htmli_ui_MenuItem.active && com_htmli_ui_MenuItem.active.getFirstElementChild() && 
					com_htmli_ui_MenuItem.active.getFirstElementChild().getClass() == 'com.htmli.ui.Menu') {
					com_htmli_ui_MenuItem.active.showMenu();
				} else if (com_htmli_ui_MenuBarItem.active) {
					var mbi = com_htmli_ui_MenuBarItem.active.getNextElementSibling();
					if (mbi && mbi.getClass() == 'com.htmli.ui.MenuBarItem') {
						if (com_htmli_ui_MenuBarItem.open) {
							com_htmli_ui_MenuBarItem.open.hideMenu();
							mbi.showMenu(true);
						} /*else {
							com_htmli_ui_MenuBarItem.active.turnOff();
							mbi.highlight();
						}*/
					}
				}
			} 
			/* Down cursor pressed */
			/*if (ev.getKeyCode()==40 && !ev.getCtrlKey() && !ev.getAltKey()) {
				if (com_htmli_ui_MenuBarItem.active) {
					if (!com_htmli_ui_MenuBarItem.open) {
						var mbi = com_htmli_ui_MenuBarItem.active;
						mbi.showMenu(false);
					}
				}
			} */
			/* Escape pressed */
			if (ev.getKeyCode()==27) {
				if (com_htmli_ui_MenuBarItem.active) {
					com_htmli_ui_MenuBarItem.active.hideMenu();
				}
			} 

		}, false);
		
	
		
		function com_htmli_ui_MenuItem(outerNode) {
			this.init(outerNode, 'com.htmli.ui.MenuItem', 'MenuItem');
			
			
				this.innerNode = outerNode.children[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.children[0].children[0].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.children[0].children[0].className = 'com_htmli_ui_MenuItem__check com_htmli_ui_MenuItem__faded';
					me.outerNode.children[1].children[0].className = 'com_htmli_ui_MenuItem__icon com_htmli_ui_MenuItem__faded';
					me.outerNode.className = 'com_htmli_ui_MenuItem__disabled';
				} else {
					me.outerNode.children[0].children[0].className = 'com_htmli_ui_MenuItem__check';					
					me.outerNode.children[1].children[0].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.getFirstElementChild();
				if (firstChild != null) {
					firstChild.show(me.getHeight() * me.outerNode.rowIndex);
					com_htmli_ui_MenuItem.active = firstChild.getFirstElementChild();
					com_htmli_ui_MenuItem.active.highlight();
				}
				firstChild = null;
			
			
			};				
		com_htmli_ui_MenuItem.prototype.hideMenu = function() {
				var me = this;
				
			
				var firstChild = me.getFirstElementChild();
				if (firstChild != null) {
					firstChild.hide();
				}
				firstChild = null;
				com_htmli_ui_MenuItem.active = me;
				com_htmli_ui_MenuItem.active.highlight();
			
			
			};				
		
	
		com_htmli_ui_MenuItem.prototype.mouseover = function() {
			this.highlight();	
			if (com_htmli_ui_Menu.flag)
			{
				com_htmli_ui_Menu.flag = false;
				if (this.getFirstElementChild() != null) {
					this.showMenu();
				} else {
					this.getParentNode().hideChildren();
				}
				
			}
		};
		com_htmli_ui_MenuItem.prototype.mouseout = function() {
			com_htmli_ui_Menu.flag = true;
			this.turnOff();
		};
		
		com_htmli_ui_MenuItem.prototype.highlight = function() {		
			this.setClassName('com_htmli_ui_MenuItem_highlight');
		};

		com_htmli_ui_MenuItem.prototype.turnOff = function() {		
			this.setClassName('');
		};
		
		com_htmli_ui_MenuItem.prototype.clickDisabled = function(ev) {		
			com_htmli_ui_Menu.clickedDisabled = true; 
			ev.stopPropagation();
		};
		
		com_htmli_ui_MenuItem.prototype.click = function(ev) {
			var child = this.getFirstElementChild();
			if (child && child.getClass() == 'com.htmli.ui.Menu') {
				this.clickDisabled(ev);				
			}
			if (!this.getDisabled()) {
				var length = com_htmli_ui_Menu.active.length;
				if (length && !child) {
					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_MenuBarItem.open = null;
					if(com_htmli_ui_MenuItem.active) {
						com_htmli_ui_MenuItem.active.turnOff();
						com_htmli_ui_MenuItem.active = null;				
					}
					ev.stopPropagation();
				}
	
				if (this.getType() == 'check') {
					this.toggleCheck();
				}
			}
		};
		
		com_htmli_ui_MenuItem.prototype.toggleCheck = function() {
			var style = this.outerNode.children[0].children[0].style;
			if (style.display == '') {
				this.setChecked(false);
			} else {
				this.setChecked(true);
			}
		};
		
		
		application.addEventListener('keyup', function(ev) {	
			/* Right cursor pressed */
			if (ev.getKeyCode()==38 && !ev.getCtrlKey() && !ev.getAltKey()) {
				if (com_htmli_ui_MenuItem.active) {
					var mi = com_htmli_ui_MenuItem.active;
					/* In case there is an active menuitem but it is not highlighted, stay in that item */
					if (mi.getClassName() == 'com_htmli_ui_MenuItem_highlight') {
						mi = com_htmli_ui_MenuItem.active.getPreviousElementSibling();
					} 
					if (mi && mi.getClass() == 'com.htmli.ui.MenuSeparator') {
						mi = mi.getPreviousElementSibling();						
					}
					if (mi && mi.getClass() == 'com.htmli.ui.MenuItem') {
						com_htmli_ui_MenuItem.active.turnOff();
						mi.highlight();
						com_htmli_ui_MenuItem.active = mi;
					}
				}
			} 
			if (ev.getKeyCode()==40 && !ev.getCtrlKey() && !ev.getAltKey()) {
				if (com_htmli_ui_MenuItem.active) {
					var mi = com_htmli_ui_MenuItem.active;
					if (mi.getClassName() == 'com_htmli_ui_MenuItem_highlight') {
						mi = com_htmli_ui_MenuItem.active.getNextElementSibling();
					} 
					if (mi && mi.getClass() == 'com.htmli.ui.MenuSeparator') {
						mi = mi.getNextElementSibling();						
					}
					if (mi && mi.getClass() == 'com.htmli.ui.MenuItem') {
						com_htmli_ui_MenuItem.active.turnOff();
						mi.highlight();
						com_htmli_ui_MenuItem.active = mi;
					}
				}
			} 
			if (ev.getKeyCode()==13) {
				if (com_htmli_ui_MenuItem.active) {
					var myEvent = application.createEvent('MouseEvents');
					myEvent.initEvent('click');
					com_htmli_ui_MenuItem.active.dispatchEvent(myEvent);
				}
			} 
			
		
		}, false);
		
		
	
		
		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_Prefix(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Prefix', 'Prefix');
			
			
			
		}
		
		
		com_htmli_ui_Prefix.prototype = new HTMLiElement();
		
		
		
		function com_htmli_ui_Progress(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Progress', 'Progress');
			
			
			
		}
		
		
		com_htmli_ui_Progress.prototype = new HTMLiElement();
		
		com_htmli_ui_Progress.prototype.getProgress = function() {
				
						var value = this.getAttribute('progress');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_Progress.prototype.setProgress = function(progress) {
					
							var me = this;
							var __value = progress;
							
			
				if (isNaN(progress)) {
					me.setProgress(0);
				} 
				else {
					if (me.getMinimum() && me.getMaximum()) {
						progress = progress/(me.getMaximum() - me.getMinimum());
					}
					var value = progress * 100;

					if (value>100) {
						value=100;
					}
					if (value<0) {
						value=0;
					}
					me.outerNode.children[me.outerNode.children.length-1].style.width = value + "%";
				}
			
			
							this.setAttribute('progress', __value);	
											
				};		
			com_htmli_ui_Progress.prototype.getMinimum = function() {
				
						var value = this.getAttribute('minimum');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_Progress.prototype.setMinimum = function(minimum) {
					
							this.setAttribute('minimum', minimum);	
											
				};		
			com_htmli_ui_Progress.prototype.getMaximum = function() {
				
						var value = this.getAttribute('maximum');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_Progress.prototype.setMaximum = function(maximum) {
					
							this.setAttribute('maximum', maximum);	
											
				};		
			com_htmli_ui_Progress.prototype.getSpeed = function() {
				
						var value = this.getAttribute('speed');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_Progress.prototype.setSpeed = function(speed) {
					
							this.setAttribute('speed', speed);	
											
				};		
			com_htmli_ui_Progress.prototype.getInterval = function() {
				
						var value = this.getAttribute('interval');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_Progress.prototype.setInterval = function(interval) {
					
							this.setAttribute('interval', interval);	
											
				};		
			com_htmli_ui_Progress.prototype.animate = function() {
				var me = this;
				
			
				var progress = me.getProgress();
				var speed = me.getSpeed();
				var interval = me.getInterval();
				if (!speed) {
					speed = com_htmli_ui_Progress.ANIMATE_SPEED;
				}
				if (!interval) {
					interval = com_htmli_ui_Progress.ANIMATE_INTERVAL;
				}
	
				var normProgress = progress;
				if (me.getMaximum() && me.getMinimum()) {
					var size = me.getMaximum() - me.getMinimum();
					normProgress = progress / size;
					progress =  parseFloat(progress) + (parseFloat(speed)*size);
				} else {
					progress = parseFloat(progress) + parseFloat(speed);
				}
				
				if (normProgress < 1) {
					me.setProgress(progress);
					setTimeout(function() {
						me.animate(false);
					}, interval);
				} else {
					var newEvent = application.createEvent('HTMLiEvents');
					newEvent.initHTMLiEvent('finish', this);
					this.dispatchEvent(newEvent);			
				}

			
			
			};				
		com_htmli_ui_Progress.prototype.reset = function() {
				var me = this;
				
			
				me.setProgress(0);
			
			
			};				
		com_htmli_ui_Progress.prototype.grow = function(amount) {
				var me = this;
				
			
				var progress = me.getProgress();
				progress = parseFloat(progress) + parseFloat(amount);
				me.setProgress(progress);
			
			
			};				
		com_htmli_ui_Progress.prototype.fill = function() {
				var me = this;
				
			
				if (me.getMaximum()) {
					me.setProgress(me.getMaximum());				
				} else {			
					me.setProgress(1);
				}
			
			
			};				
		com_htmli_ui_Progress.prototype._addEventListener = com_htmli_ui_Progress.prototype.addEventListener;
		
			com_htmli_ui_Progress.prototype._dispatchEvent = com_htmli_ui_Progress.prototype.dispatchEvent;
		
		
			com_htmli_ui_Progress.prototype.addEventListener = function(event, func, capture) {
				
					if (event == 'finish') {
						return this._addEventListenerFor(event, func);
					}				
				
			
				return this._addEventListener(event, func, capture);
			};
		
			com_htmli_ui_Progress.prototype.dispatchEvent = function(event) {
				
					if (event.getType() == 'finish') {
						var aux;
						eval('com_htmli_ui_Progress.prototype.aux = function(ev) {'  + this.getAttribute('onfinish') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
				
				return this._dispatchEvent(event);
			};
			
			com_htmli_ui_Progress.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_Progress.ANIMATE_SPEED = 0.20;
		com_htmli_ui_Progress.ANIMATE_INTERVAL = 1000;		

		
	
		
		function com_htmli_ui_Resizable(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Resizable', 'Resizable');
			
			
				this.innerNode = outerNode.children[0].children[0].children[0];
			
			
		}
		
		
		com_htmli_ui_Resizable.prototype = new HTMLiElement();
		
		com_htmli_ui_Resizable.prototype.resizeTo = function(width,height) {
				var me = this;
				
			
				var targetStyle = me.getFirstChild().getStyle();
				targetStyle.width = width + "px";
				targetStyle.height = height + "px";
				
				var myStyle = me.outerNode.style;
				myStyle.width = (width+3) + "px";
				myStyle.height = (height+3) + "px";
			
			
			};				
		com_htmli_ui_Resizable.prototype._addEventListener = com_htmli_ui_Resizable.prototype.addEventListener;
		
			com_htmli_ui_Resizable.prototype._dispatchEvent = com_htmli_ui_Resizable.prototype.dispatchEvent;
		
		
			com_htmli_ui_Resizable.prototype.addEventListener = function(event, func, capture) {
				
					if (event == 'resizeelement') {
						return this._addEventListenerFor(event, func);
					}				
				
			
				return this._addEventListener(event, func, capture);
			};
		
			com_htmli_ui_Resizable.prototype.dispatchEvent = function(event) {
				
					if (event.getType() == 'resizeelement') {
						var aux;
						eval('com_htmli_ui_Resizable.prototype.aux = function(ev) {'  + this.getAttribute('onresizeelement') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
				
				return this._dispatchEvent(event);
			};
			
			com_htmli_ui_Resizable.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_Resizable.targetStyle = null;
		com_htmli_ui_Resizable.target = null;
		com_htmli_ui_Resizable.base = null;
		com_htmli_ui_Resizable.axis = null;
		com_htmli_ui_Resizable.realStyle = null;
		com_htmli_ui_Resizable.resize = null;		
		
		/**
		 * Private function called when resize begins
		 */
		com_htmli_ui_Resizable.prototype.start = function(horizontal, vertical) {		
			com_htmli_ui_Resizable.realStyle = this.outerNode.style;
			com_htmli_ui_Resizable.resize = this;			
			com_htmli_ui_Resizable.target = this.getFirstChild();
			com_htmli_ui_Resizable.targetStyle = this.getFirstChild().getStyle();
			com_htmli_ui_Resizable.base = [com_htmli_ui_Resizable.target.getX(), com_htmli_ui_Resizable.target.getY()];
			com_htmli_ui_Resizable.axis = [horizontal, vertical];
		/*	com_htmli_ui_Resizable.real.parentNode.style.width = (com_htmli_ui_Resizable.target.getWidth()-2) + "px";
			com_htmli_ui_Resizable.target.outerNode.parentNode.style.height = (com_htmli_ui_Resizable.target.getHeight()) + "px";*/
			
		};
		
		com_htmli_ui_Resizable.prototype.dispatchResize = function(ev) {
			var newEvent = application.createEvent('HTMLiEvents');
			newEvent.initHTMLiEvent('resizeelement', this);
			this.dispatchEvent(newEvent);
		};
		
		
		
		/**
		 * Called when drag and drop begins
		 */
		application.addEventListener('mousemove', function(ev) {
			if (com_htmli_ui_Resizable.target != null) {
				var axis = com_htmli_ui_Resizable.axis;
				var base = com_htmli_ui_Resizable.base;
				
				var x = ev.getClientX();
				var y = ev.getClientY();
				
				if (axis[0] && (x - base[0]) > 0) {
					com_htmli_ui_Resizable.realStyle.width = (3 + x - base[0]) + "px";
					com_htmli_ui_Resizable.targetStyle.width = (x - base[0]) + "px";
				}
				if (axis[1] && (y - base[1]) > 0) {
					com_htmli_ui_Resizable.realStyle.height = (3 + y - base[1]) + "px";
					com_htmli_ui_Resizable.targetStyle.height = (y - base[1]) + "px";
				}
			}
		}, false);
		
		/**
		 * Called when drag and drop ends
		 */
		application.addEventListener('mouseup', function(ev) {
				if (com_htmli_ui_Resizable.target != null) {
					com_htmli_ui_Resizable.target = null;
					com_htmli_ui_Resizable.real = null;
					com_htmli_ui_Resizable.resize.dispatchResize(ev);	
				}				
			}, false);
		
	
		
		function com_htmli_ui_RichText(outerNode) {
			this.init(outerNode, 'com.htmli.ui.RichText', 'RichText');
			
			
				this.innerNode = outerNode.children[1];
			
			
		}
		
		
		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.setReadonly = function(readonly) {
					
							var me = this;
							var __value = readonly;
							
								if (__value == true) {
									__value = 'true';
								}
								if (__value == false) {
									__value = 'false';
								}						
							
				var edit = me.outerNode.children[0];
				edit.contentWindow.document.execCommand("readonly", false, readonly);
			
							this.setAttribute('readonly', __value);	
											
				};		
			com_htmli_ui_RichText.prototype.getFrameStyle = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var frameStyle = __value;
				
						return this.outerNode.children[0].style;
						return __value;
					
				
			};
			
			com_htmli_ui_RichText.prototype.stop = function() {
				var me = this;
				
				
				var doc = me.outerNode.children[0].contentWindow.document;
				doc.designMode = "off";
				doc.contentEditable = "false";
			
			
			};				
		com_htmli_ui_RichText.prototype.start = function() {
				var me = this;
				
				
				var child =	me.outerNode.children[0];
				child.contentWindow.document.designMode = "on";
				child.contentWindow.document.contentEditable = "true";
				child.style.width = me.outerNode.style.width;
				child.style.height = me.outerNode.style.height;	
				
				if (me.getReadonly()) {
					child.contentWindow.document.execCommand("readonly", false, true); 
				}
			
			
			};				
		com_htmli_ui_RichText.prototype.startWith = function(contents) {
				var me = this;
				
				
				var doc = me.outerNode.children[0].contentWindow.document;
				doc.designMode = "on";
				doc.contentEditable = "true";
				
				me.setHTMLContents(contents);
												
				if (me.getReadonly()) {
					doc.execCommand("readonly", false, true); 
				}

			
			
			};				
		com_htmli_ui_RichText.prototype.execCommand = function(command,value) {
				var me = this;
				
				
				me.outerNode.firstChild.contentWindow.document.execCommand(command, false, value);
			
			
			};				
		com_htmli_ui_RichText.prototype.focus = function() {
				var me = this;
				
				
				me.outerNode.children[0].contentWindow.focus();
			
			
			};				
		com_htmli_ui_RichText.prototype.getDocument = function() {
				var me = this;
				
				
					return me.outerNode.children[0].contentWindow.document;
			
			
			};				
		com_htmli_ui_RichText.prototype.getHTMLContents = function() {
				var me = this;
				
				
				var contents = me.outerNode.children[0].contentWindow.document.body.innerHTML;
				return contents;
			
			
			};				
		com_htmli_ui_RichText.prototype.setHTMLContents = function(contents) {
				var me = this;
				
				
					/* IE bug: innerHTML must be set in a separate thread */
					if (document.all) {
						setTimeout(function() {
							me.outerNode.children[0].contentWindow.document.body.innerHTML = contents;}, 1);			
					} else {
						var script = me.outerNode.children[me.outerNode.children.length-1];
						script.parentNode.removeChild(script);
					
						me.outerNode.children[0].contentWindow.document.body.innerHTML = contents;
					}
				
			
			};				
		com_htmli_ui_RichText.prototype.toSource = function() {
				var me = this;
				
				var edit = me.outerNode.children[0];
				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.children[0];
				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: /* NODE_ELEMENT */
				 		var newNode = doc.createElement(node.nodeName); /* does the node have any attributes to add? */
				 		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.children && node.children.length > 0) {
			 				for (var i = 0, il = node.children.length; i < il;) {
								newNode.appendChild(importNode(node.children[i++], allChildren)); 
							 }
						}
						return newNode; 
						break; 
					case 3: /* NODE_TEXT */ 
					case 4: /* NODE_CDATA_SECTION */ 
					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 = ["#000000", "#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" , "#330000" , "#663300" , 
			"#663333" , "#333300" , "#003300" , "#003333" , "#000066" , "#330099" , "#330033"];

		com_htmli_ui_RTButtonBar.active = null;
	
	
/*		In IE, when clicking outside the iframe, selection is lost unless you have an alert()+ev.preventDefault call
**		or an exception. Restore this methods when you find a workaround for this problem 
**

		com_htmli_ui_RTButtonBar.prototype.showPalette = function(top, left) {
			var palette = document.getElementById(this.outerNode.id + '__palette');
			var length = palette.childNodes.length;
			if (length==0) {
				this.createPalette();
			}
			var palette = document.getElementById(this.outerNode.id + '__colorpalette');
			palette.style.left = left + 'px';
		    palette.style.top = top  + 'px';
			palette.style.visibility = 'visible';
			com_htmli_ui_RTButtonBar.active = palette;
		};

		com_htmli_ui_RTButtonBar.prototype.createPalette = function() {
			var palette = document.getElementById(this.outerNode.id + '__palette');
			var length = com_htmli_ui_RTButtonBar.colors.length;

			for (var i=0, row; i<length; i++) {
				if (i % 10 == 0) {
					row = palette.insertRow(-1);
				}				
				cell = row.insertCell(-1);
				cell.style.backgroundColor = com_htmli_ui_RTButtonBar.colors[i];
				cell.style.width = '20px';				
				cell.style.height = '20px';			
				cell.style.border = '1px solid black';
				cell.id = com_htmli_ui_RTButtonBar.colors[i];				
				cell.innerHTML = '&nbsp;';
				cell.onmouseover = function() {this.style.border='1px dotted white';};
				cell.onmouseout = function() {this.style.border='1px solid black';};
				cell.onmouseup = function() {
					var buttonbar = application.wrapNode(this.parentNode.parentNode.parentNode.parentNode.parentNode);
					buttonbar.selectColor(this.id);
				};				
			}
		};
		
		com_htmli_ui_RTButtonBar.prototype.selectColor = function(color) 
		{
			var edit = this.getTarget()? this.getContainer().getElementById(this.getTarget()) : this.getNextSibling();
			var palette = document.getElementById(this.outerNode.id + '__colorpalette');
			edit.execCommand(this.outerNode.command, color);
			palette.style.visibility = 'hidden';
		};
				
	*/	
		
		com_htmli_ui_RTButtonBar.prototype.onMouseDown = function(me, ev)
		{
		  var edit = this.getTarget()? this.getContainer().getElementById(this.getTarget()) : this.getNextSibling();
		  var className = me.className.split(' ')[1];
		  var action = className.substring(className.indexOf('__')+2,className.length);

		  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 if (action == 'source') {
			if (!edit.outerNode.isSource) {
				edit.toSource();
				edit.outerNode.isSource = true;
			} else {
				edit.toRegular();
				edit.outerNode.isSource = false;
			}
		  } else {
		    edit.execCommand(action, null);
		  }
			ev.preventDefault();
	  		ev.stopPropagation();
			return false;
		}
		
		com_htmli_ui_RTButtonBar.prototype.select = function(select)
		{
		var edit = this.getTarget()? this.getContainer().getElementById(this.getTarget()) : this.getNextSibling();
		  var cursel = select.selectedIndex;
		  /* First one is always a label */
		  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 + '>';		  		
		  	}
			edit.execCommand(command, selected);
		    select.selectedIndex = 0;
		  }
		};
		
		com_htmli_ui_RTButtonBar.prototype.selectColor = function(select)
		{
		var edit = this.getTarget()? this.getContainer().getElementById(this.getTarget()) : this.getNextSibling();
		  var cursel = select.selectedIndex;
		  /* First one is always a label */
		  if (cursel != 0) {
		  	var className = select.className;
		    var command = className.substring(className.indexOf('__')+2,className.length);
		  	
		    var selected = select.options[cursel].value;
			/*cross-browser hack*/
		    if (command=='hilitecolor' && document.all) {
		    	command='backcolor';
		    }
		    edit.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.children[0].children[0].children[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);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						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_Slider(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Slider', 'Slider');
			
			
			
		}
		
		
		com_htmli_ui_Slider.prototype = new HTMLiElement();
		
		com_htmli_ui_Slider.prototype.getName = function() {
							
						var me = this;
						var __value = this.getAttribute('name');
						var name = __value;
				
						return me.outerNode.children[me.outerNode.children.length-1].name;
						return __value;
					
				
			};
			
			com_htmli_ui_Slider.prototype.setName = function(name) {
					
							var me = this;
							var __value = name;
							
			
				me.outerNode.children[me.outerNode.children.length-1].name = name;
			
			
							this.setAttribute('name', __value);	
											
				};		
			com_htmli_ui_Slider.prototype.getVertical = function() {
				
						return this.getAttribute('vertical');
					
				
			};
			
			com_htmli_ui_Slider.prototype.getMinimum = function() {
				
						var value = this.getAttribute('minimum');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_Slider.prototype.setMinimum = function(minimum) {
					
							this.setAttribute('minimum', minimum);	
											
				};		
			com_htmli_ui_Slider.prototype.getMaximum = function() {
				
						var value = this.getAttribute('maximum');
						return value == null ? 0 : value;
					
				
			};
			
			com_htmli_ui_Slider.prototype.setMaximum = function(maximum) {
					
							this.setAttribute('maximum', maximum);	
											
				};		
			com_htmli_ui_Slider.prototype.getDiscrete = function() {
				
						return this.getAttribute('discrete');
					
				
			};
			
			com_htmli_ui_Slider.prototype.setDiscrete = function(discrete) {
					
							this.setAttribute('discrete', discrete);	
											
				};		
			com_htmli_ui_Slider.prototype.getValue = function() {
				var me = this;
				
			
				var button = me.outerNode.children[1];
				var style = me.getStyle();
				var height = style.height.substring(0, style.height.length-2);
				var width = style.width.substring(0, style.width.length-2);				
				
				if (me.getVertical()) {
					var absValue = parseFloat(button.style.bottom.substring(0, button.style.bottom.length-2));
					var normValue = absValue / (height-11);				
				}
				else {
					var absValue = parseFloat(button.style.left.substring(0, button.style.left.length-2));
					var normValue = absValue / (width-11);
				}
				if (me.getMinimum() && me.getMaximum()) {
					if (me.getDiscrete()) {
						return Math.ceil(parseFloat(me.getMinimum()) + ((me.getMaximum() - me.getMinimum()) * normValue));
					}
					else {
						return parseFloat(me.getMinimum()) + ((me.getMaximum() - me.getMinimum())*normValue);
					}
				}
				return normValue;
				
			
			
			};				
		com_htmli_ui_Slider.prototype.setValue = function(value) {
				var me = this;
				
			
				var button = me.outerNode.children[1];
				if (me.getMinimum() && me.getMaximum()) {
					var size = me.getMaximum() - me.getMinimum();
					value = (value-me.getMinimum())/size;
				}
	
				var style = me.getStyle();
				var height = style.height.substring(0, style.height.length-2);
				var width = style.width.substring(0, style.width.length-2);				
				if (me.getVertical()) {
					var x = 0;
					var y = (height-11) * value;
				}
				else {
					var x = (width-11) * value;
					var y = 0;
				}
				me.moveAbs(x, y);
				me.outerNode.children[me.outerNode.children.length-1].value = value;
			
			
			};				
		com_htmli_ui_Slider.prototype._addEventListener = com_htmli_ui_Slider.prototype.addEventListener;
		
			com_htmli_ui_Slider.prototype._dispatchEvent = com_htmli_ui_Slider.prototype.dispatchEvent;
		
		
			com_htmli_ui_Slider.prototype.addEventListener = function(event, func, capture) {
				
					if (event == 'change') {
						return this._addEventListenerFor(event, func);
					}				
				
			
				return this._addEventListener(event, func, capture);
			};
		
			com_htmli_ui_Slider.prototype.dispatchEvent = function(event) {
				
					if (event.getType() == 'change') {
						var aux;
						eval('com_htmli_ui_Slider.prototype.aux = function(ev) {'  + this.getAttribute('onchange') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
				
				return this._dispatchEvent(event);
			};
			
			com_htmli_ui_Slider.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_Slider.target = null;
		com_htmli_ui_Slider.xcoord = null;
		com_htmli_ui_Slider.ycoord = null;
		 
		/**
		 * Private function called when drag and drop begins
		 */
		com_htmli_ui_Slider.prototype.start = function(x, y) {		
			com_htmli_ui_Slider.target = this;
			com_htmli_ui_Slider.xcoord = x;
			com_htmli_ui_Slider.ycoord = y;			
		};
		
		/**
		 * Private function to move the slider x or y pixels from left or bottom
		 */
		com_htmli_ui_Slider.prototype.moveAbs = function(x, y) {		
			var button = this.outerNode.children[1];
			
			if (this.getVertical() && y != null) {
				button.style.bottom =  y + "px";
			}
			else if (x != null) {
				button.style.left =  x + "px";
			}
			this.dispatchChange();											
		};
		
		/**
		 * Private function called when ruler is clicked
		 */
		com_htmli_ui_Slider.prototype.move = function(x, y) {		
			var slider = application.wrapNode(this.outerNode);
			button = this.outerNode.children[1];
			
			if (this.getVertical() && y) {
				var top =  (y-slider.getY()+application.getScrollTop()) ;
				button.style.bottom = (slider.getHeight()-top) + "px"
			}
			else if (x) {
				button.style.left =  (x-slider.getX()+application.getScrollLeft()) + "px";
			}

			this.dispatchChange();		
		};


		
		/**
		 * Called when mouse is moved
		 */
		application.addEventListener('mousemove', function(ev) {
			with (com_htmli_ui_Slider) {
				if (target != null && target.getVertical()=='vertical' && ycoord != null) {

					var diff = ev.getClientY() - ycoord;
					var button = target.outerNode.children[1];
					var slider = target.outerNode;
					
					var value = (parseFloat(button.style.bottom.substring(0, button.style.bottom.length-2)) - diff);
					var y_limit = slider.style.height.substring(0,slider.style.height.length-2)-11;

					if (value < 0) {
						value = 0;
					} else if (value > y_limit) {
						value = y_limit;
					}					
					button.style.bottom =  value + "px";
					ycoord = ev.getClientY();
					
					/* debug
					var value = button.style.bottom.substring(0,button.style.bottom.length-2)/(y_limit);
					if (target.getMinimum() && target.getMaximum()) {
						value = (toFloat(target.getMinimum()) + toFloat(target.getMaximum()));
					}	
					application.wrapNode(button).getNextElementSibling().setValue(value);*/
					target.dispatchChange();											
				}
				else if (target != null && xcoord != null) {
					var diff = ev.getClientX() - xcoord;
					var button = target.outerNode.children[1];
					
					var value = (parseFloat(button.style.left.substring(0, button.style.left.length-2)) + diff);
					var x_limit = target.outerNode.style.width.substring(0,target.outerNode.style.width.length-2)-11;

					if (value < 0) {
						value = 0;
					} else if (value > x_limit) {
						value = x_limit;
					}	
					button.style.left =  value + "px";
					xcoord = ev.getClientX();
					
					var sliderValue = value/target.outerNode.style.height;
					application.wrapNode(button).getNextElementSibling().setValue(value);
					target.dispatchChange();
				}
			}
		}, false);

		/**
		 * Called when drag and drop ends
		 */
		application.addEventListener('mouseup', function() {
				com_htmli_ui_Slider.target = null;
			}, false);

		
		com_htmli_ui_Slider.prototype.dispatchChange = function(obj, ev) {
			var newEvent = application.createEvent('HTMLiEvents');
			newEvent.initHTMLiEvent('change', this);
			this.dispatchEvent(newEvent);
			return false;
		};
		
	
		
		function com_htmli_ui_Slideshow(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Slideshow', 'Slideshow');
			
			
				this.innerNode = outerNode.children[0];
			
			
		}
		
		
		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') ? (typeof(me.getTime()) == 'undefined' ? com_htmli_ui_Slideshow.TIME : 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);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
					if (event.getType() == 'change') {
						var aux;
						eval('com_htmli_ui_Slideshow.prototype.aux = function(ev) {'  + this.getAttribute('onchange') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						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());			

				/*Next slide was already visible, but faded*/
				childNodes.item(me.nextSlide()).fadeIn();				
				me.advance();

				/*Prepare next transition*/
				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();
			
			/* Cancel next transition preparation */
			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.children[0].children[0].children[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);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						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.getAuto = function() {
				
						return this.getAttribute('auto');
					
				
			};
			
			com_htmli_ui_Source.prototype.setAuto = function(auto) {
					
							this.setAttribute('auto', auto);	
											
				};		
			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.outerNode.style.display = '';
				me.container = new Container(me.outerNode);
				var connector = me.getUrl().indexOf('?') >= 0 ? '&' : '?';
				me.container.open(me.getUrl() + (com_htmli_ui_Source.cache ? '' : (connector + new Date().getTime())), 
					function() {
						me.dispatchOpenEvent();
						if (handler) handler();
					});				
			
			
			};				
		com_htmli_ui_Source.prototype.close = function() {
				var me = this;
				
			
				me.outerNode.style.display = 'none';
				me.outerNode.innerHTML = '';
			
			
			};				
		com_htmli_ui_Source.prototype.getChildContainer = function() {
				var me = this;
				
			
				return new Container(me.outerNode);
			
			
			};				
		com_htmli_ui_Source.prototype._addEventListener = com_htmli_ui_Source.prototype.addEventListener;
		
			com_htmli_ui_Source.prototype._dispatchEvent = com_htmli_ui_Source.prototype.dispatchEvent;
		
		
			com_htmli_ui_Source.prototype.addEventListener = function(event, func, capture) {
				
					if (event == 'open') {
						return this._addEventListenerFor(event, func);
					}				
				
			
				return this._addEventListener(event, func, capture);
			};
		
			com_htmli_ui_Source.prototype.dispatchEvent = function(event) {
				
					if (event.getType() == 'open') {
						var aux;
						eval('com_htmli_ui_Source.prototype.aux = function(ev) {'  + this.getAttribute('onopen') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
				
				return this._dispatchEvent(event);
			};
			
			com_htmli_ui_Source.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_Source.cache = false;
		
		com_htmli_ui_Source.prototype.dispatchOpenEvent = function() {
			var openEvent = application.createEvent('HTMLiEvents');
			openEvent.initHTMLiEvent('open', this);
			this.dispatchEvent(openEvent);
		}
		
	
		
		function com_htmli_ui_SplitItem(outerNode) {
			this.init(outerNode, 'com.htmli.ui.SplitItem', 'SplitItem');
			
			
			
		try {
			var aux = outerNode.children[0].children[0];
			if (aux.getAttribute('htmliinner') != null) {
				this.innerNode = aux;
				return;
			}
		} catch (e) {}
			
			
		try {
			var aux = outerNode.children[0].children[0].children[0];
			if (aux.getAttribute('htmliinner') != null) {
				this.innerNode = aux;
				return;
			}
		} catch (e) {}
			
			
		}
		
		
		com_htmli_ui_SplitItem.prototype = new HTMLiElement();
		
		
		
		function com_htmli_ui_SplitPane(outerNode) {
			this.init(outerNode, 'com.htmli.ui.SplitPane', 'SplitPane');
			
			
			
		try {
			var aux = outerNode.children[1].children[0].children[0].children[0];
			if (aux.getAttribute('htmliinner') != null) {
				this.innerNode = aux;
				return;
			}
		} catch (e) {}
			
			
		try {
			var aux = outerNode.children[1].children[0].children[0];
			if (aux.getAttribute('htmliinner') != null) {
				this.innerNode = aux;
				return;
			}
		} catch (e) {}
			
			
		}
		
		
		com_htmli_ui_SplitPane.prototype = new HTMLiElement();
		
		com_htmli_ui_SplitPane.prototype.getVertical = function() {
				
						return this.getAttribute('vertical');
					
				
			};
			
			com_htmli_ui_SplitPane.prototype.setVertical = function(vertical) {
					
							this.setAttribute('vertical', vertical);	
											
				};		
			com_htmli_ui_SplitPane.prototype.getResizeMode = function() {
				
						return this.getAttribute('resizemode');
					
				
			};
			
			com_htmli_ui_SplitPane.prototype.setResizeMode = function(resizeMode) {
					
							this.setAttribute('resizemode', resizeMode);	
											
				};		
			com_htmli_ui_SplitPane.prototype.showOutline = function() {
				var me = this;
				
			
				if (me.outerNode.firstChild.className.indexOf('com_htmli_ui_SplitPane__dashed_vertical')>=0) {
					me.outerNode.firstChild.style.height = me.outerNode.style.height;
				}
				else {
					me.outerNode.firstChild.style.width = me.outerNode.style.width;
				}
				me.outerNode.firstChild.style.display = 'block';
			
			
			};				
		com_htmli_ui_SplitPane.prototype.hideOutline = function() {
				var me = this;
				
			
				me.outerNode.firstChild.style.display = 'none';
			
			
			};				
		com_htmli_ui_SplitPane.prototype.moveOutlineToX = function(x) {
				var me = this;
				
			
				
				me.outerNode.firstChild.style.left = x + 'px';
			
			
			};				
		com_htmli_ui_SplitPane.prototype.moveOutlineToY = function(y) {
				var me = this;
				
			
				
				me.outerNode.firstChild.style.top = y + 'px';
			
			
			};				
		com_htmli_ui_SplitPane.prototype.getOutlineX = function() {
				var me = this;
				
			
				return parseInt(me.outerNode.firstChild.style.left);
			
			
			};				
		com_htmli_ui_SplitPane.prototype.getOutlineY = function() {
				var me = this;
				
			
				return parseInt(me.outerNode.firstChild.style.top);
			
			
			};				
		
		
		function com_htmli_ui_Splitter(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Splitter', 'Splitter');
			
			
			
		}
		
		
		com_htmli_ui_Splitter.prototype = new HTMLiElement();
		
		
	
		
		com_htmli_ui_Splitter.target = null;
		
		com_htmli_ui_Splitter.xcoord = 0;
		com_htmli_ui_Splitter.ycoord = 0;

		com_htmli_ui_Splitter.prototype.base = 0;		
		com_htmli_ui_Splitter.prototype.limitprevious = 0;		
		com_htmli_ui_Splitter.prototype.limitnext = 0;		
		
		com_htmli_ui_Splitter.prototype.mousedown = function(ev) {		
			this.start(ev.getClientX(), ev.getClientY()); 
		}
		/**
		 * Private function called when drag and drop begins
		 */
		com_htmli_ui_Splitter.prototype.start = function(x, y) {		
			com_htmli_ui_Splitter.target = this;
			com_htmli_ui_Splitter.xcoord = x;
			com_htmli_ui_Splitter.ycoord = y;	

			var previousSibling = this.getPreviousSibling();
			var nextSibling = this.getNextSibling();			
			if (this.getParentNode().getResizeMode()==null || this.getParentNode().getResizeMode().indexOf('outline') < 0) {
					/*Normalize height if vertical, width if horizontal*/
					if (this.getParentNode().getVertical()) {
						previousSibling.outerNode.firstChild.style.height = nextSibling.getHeight() + "px";
						nextSibling.outerNode.firstChild.style.height = nextSibling.getHeight() + "px";
					} else {
						previousSibling.outerNode.firstChild.firstChild.style.width = nextSibling.getWidth();
						nextSibling.outerNode.firstChild.firstChild.style.width = nextSibling.getWidth();				
					}
			} else {
				this.getParentNode().showOutline();				
				if (this.getParentNode().getVertical()) {

					this.base = this.getX();
					this.getParentNode().moveOutlineToX(this.base);
					this.limitprevious = this.base - this.getPreviousSibling().getWidth();					
					this.limitnext = this.base + this.getNextSibling().getWidth();										
		
				} else {
					this.base = this.getY();
					this.limitprevious = this.base - this.getPreviousSibling().getHeight();
					if (this.getNextSibling().getNextSibling()) {
						this.limitnext = this.base + this.getNextSibling().getHeight();	
					} else {
						/*To avoid problems when splitpane's height differs from the sum of splitpane's height
						plus splitters height, as user doesn't have to know splitter's height*/
						this.limitnext = this.getParentNode().getHeight()-6;	
					}
					this.getParentNode().moveOutlineToY(this.base);
				}
			}
		};
		
		
		/**
		 * Called when drag and drop occurs
		 */
		application.addEventListener('mousemove', function(ev) {
								
			var target = com_htmli_ui_Splitter.target;
			var xcoord = com_htmli_ui_Splitter.xcoord;
			var ycoord = com_htmli_ui_Splitter.ycoord;			
			var parent = target? target.getParentNode() : null;
			
			/*Code for vertical resizing */
			if (target != null && parent.getVertical()=='vertical' && xcoord != null) {
				var x = ev.getClientX();
				var diff = parseFloat(x - xcoord);

				if (parent.getResizeMode()==null || parent.getResizeMode().indexOf('outline') < 0) {
					com_htmli_ui_Splitter.resizeToW(target, diff);
					com_htmli_ui_Splitter.xcoord = x;
				} else	{
					com_htmli_ui_Splitter.moveOutlineToX(target, diff);
				}
					
			/*Code for horizontal resizing */
			} else if (target != null && ycoord != null) {
				var y = ev.getClientY();
				var diff = parseFloat(y - ycoord);

				if (parent.getResizeMode()==null || parent.getResizeMode().indexOf('outline') < 0) {
					com_htmli_ui_Splitter.resizeToH(target, diff);
					com_htmli_ui_Splitter.ycoord = y;											
				} else {
					com_htmli_ui_Splitter.moveOutlineToY(target, diff);
				}
	

			}
			ev.stopPropagation();


		}, false);
		
		/**
		 * Called when drag and drop ends
		 */
		application.addEventListener('mouseup', function(ev) {
				var target = com_htmli_ui_Splitter.target;
				var parent = target? target.getParentNode() : null;
			
				if (target!=null && parent.getResizeMode()!=null && 
					parent.getResizeMode().indexOf('outline') >= 0) {
					if (parent.getVertical()=='vertical') {
						var diff = parent.getOutlineX()+target.getWidth()+2-com_htmli_ui_Splitter.xcoord;
						com_htmli_ui_Splitter.resizeToW(target, diff);
					} else {
						var diff = ev.getClientY()-com_htmli_ui_Splitter.ycoord;
						com_htmli_ui_Splitter.resizeToH(target, diff);
					}
					parent.hideOutline();
				} 
				com_htmli_ui_Splitter.target = null;
			}, false);


		com_htmli_ui_Splitter.resizeToW = function(target, diff) {		
			var splitterwidth = target.getWidth();
			var leftwidth = target.getPreviousSibling().getWidth();
			var rightwidth = target.getNextSibling().getWidth();
			if (diff<0 && (leftwidth + diff)>=0) {
				target.getNextSibling().outerNode.firstChild.style.width = parseFloat(rightwidth - diff) + "px";
				target.getPreviousSibling().outerNode.firstChild.style.width = parseFloat(leftwidth + diff) + "px";
				target.getNextSibling().outerNode.style.width = parseFloat(rightwidth - diff) + "px";
				target.getPreviousSibling().outerNode.style.width = parseFloat(leftwidth + diff) + "px";
				
			} else if (diff>0 && (rightwidth - diff)>=0) {
				target.getPreviousSibling().outerNode.firstChild.style.width = parseFloat(leftwidth + diff) + "px";
				target.getNextSibling().outerNode.firstChild.style.width = parseFloat(rightwidth - diff) + "px";
				target.getPreviousSibling().outerNode.style.width = parseFloat(leftwidth + diff) + "px";
				target.getNextSibling().outerNode.style.width = parseFloat(rightwidth - diff) + "px";
			}
		};


		com_htmli_ui_Splitter.resizeToH = function(target, diff) {		
		
			var splitterheight = target.getHeight();
			var leftheight = target.getPreviousSibling().getHeight();
			var rightheight = target.getNextSibling().getHeight();
			
			if (diff<0 && (leftheight + diff)>=0) {
				target.getNextSibling().outerNode.style.height = parseFloat(rightheight - diff) + "px";
				target.getPreviousSibling().outerNode.style.height = parseFloat(leftheight + diff) + "px";
				target.getNextSibling().outerNode.firstChild.firstChild.style.height = parseFloat(rightheight - diff) + "px";
				target.getPreviousSibling().outerNode.firstChild.firstChild.style.height = parseFloat(leftheight + diff) + "px";					
			} else if (diff>0 && (rightheight - diff)>=0) {
				target.getPreviousSibling().outerNode.style.height = parseFloat(leftheight + diff) + "px";
				target.getNextSibling().outerNode.style.height = parseFloat(rightheight - diff) + "px";
				target.getPreviousSibling().outerNode.firstChild.firstChild.style.height = parseFloat(leftheight + diff) + "px";
				target.getNextSibling().outerNode.firstChild.firstChild.style.height = parseFloat(rightheight - diff) + "px";				
			}
		};
		
		com_htmli_ui_Splitter.moveOutlineToY = function(target, diff) {		
			var top = target.base+diff;
			if (top>=target.limitprevious && top<=target.limitnext) {
				target.getParentNode().moveOutlineToY(top);
			}
		};

		com_htmli_ui_Splitter.moveOutlineToX = function(target, diff) {		
			var left = target.base+diff;
			if (left>=target.limitprevious && left<=target.limitnext) {
				target.getParentNode().moveOutlineToX(left);
			}
		};


		com_htmli_ui_Splitter.prototype.getX = function() {		
			var splitItems = this.getParentNode().getChildNodes();
			var length = splitItems.getLength();
			var x = 0;
			
			for (var i=0; i<length; i++) {
				var item = splitItems.item(i);
				if (item.outerNode == this.outerNode) {
					return x;
				}
				x+=item.getWidth();
			}			
			return x;			
		};
		
		com_htmli_ui_Splitter.prototype.getY = function() {		
			var splitItems = this.getParentNode().getChildNodes();
			var length = splitItems.getLength();
			var y = 0;
			
			for (var i=0; i<length; i++) {
				var item = splitItems.item(i);
				if (item.outerNode == this.outerNode) {
					return y;
				}
				y+=item.getHeight();
			}	
			return y;
		};

		
	
		
		function com_htmli_ui_StatusBar(outerNode) {
			this.init(outerNode, 'com.htmli.ui.StatusBar', 'StatusBar');
			
			
				this.innerNode = outerNode.children[1];
			
			
		}
		
		
		com_htmli_ui_StatusBar.prototype = new HTMLiElement();
		
		com_htmli_ui_StatusBar.prototype.getNowindow = function() {
				
						var value = this.getAttribute('nowindow');
						return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
					
				
			};
			
			
	
			com_htmli_ui_StatusBar.open = false;
		
	
		
		function com_htmli_ui_StatusBarItem(outerNode) {
			this.init(outerNode, 'com.htmli.ui.StatusBarItem', 'StatusBarItem');
			
			
				this.innerNode = outerNode.children[0];
			
			
		}
		
		
		com_htmli_ui_StatusBarItem.prototype = new HTMLiElement();
		
		com_htmli_ui_StatusBarItem.prototype.getNoseparator = function() {
				
						var value = this.getAttribute('noseparator');
						return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
					
				
			};
			
			com_htmli_ui_StatusBarItem.prototype.setNoseparator = function(noseparator) {
					
							this.setAttribute('noseparator', noseparator ? 'true' : 'false');	
											
				};		
			
		
		function com_htmli_ui_Step(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Step', 'Step');
			
			
			
		}
		
		
		com_htmli_ui_Step.prototype = new HTMLiElement();
		
		com_htmli_ui_Step.prototype.show = function() {
				var me = this;
				
			
				var containerDiv = me.getParentNode().getChildNodes().item(0).outerNode.lastChild;
				containerDiv.innerHTML = me.outerNode.childNodes[1].innerHTML;
				me.getFirstChild().outerNode.className = 'com_htmli_ui_StepTitle_highlight';
			
			
			};				
		com_htmli_ui_Step.prototype.hide = function() {
				var me = this;
				
			
				var containerDiv = me.getParentNode().getChildNodes().item(0).outerNode.lastChild;
				containerDiv.innerHTML = '';
				me.getFirstChild().outerNode.className = 'com_htmli_ui_Step';
			
			
			};				
		
		
		function com_htmli_ui_StepBody(outerNode) {
			this.init(outerNode, 'com.htmli.ui.StepBody', 'StepBody');
			
			
			
		}
		
		
		com_htmli_ui_StepBody.prototype = new HTMLiElement();
		
		
		
		function com_htmli_ui_StepTitle(outerNode) {
			this.init(outerNode, 'com.htmli.ui.StepTitle', 'StepTitle');
			
			
			
		}
		
		
		com_htmli_ui_StepTitle.prototype = new HTMLiElement();
		
		
		
		function com_htmli_ui_Tab(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Tab', 'Tab');
			
			
				this.innerNode = outerNode.children[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);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						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_Table(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Table', 'Table');
			
			
				this.innerNode = outerNode.children[0];
			
			
		}
		
		
		com_htmli_ui_Table.prototype = new HTMLiElement();
		
		com_htmli_ui_Table.prototype.getSelectedRows = function() {
				var me = this;
				
			
				return me.getChildNodes().item(1).getSelectedRows();
			
			
			};				
		com_htmli_ui_Table.prototype._addEventListener = com_htmli_ui_Table.prototype.addEventListener;
		
			com_htmli_ui_Table.prototype._dispatchEvent = com_htmli_ui_Table.prototype.dispatchEvent;
		
		
			com_htmli_ui_Table.prototype.addEventListener = function(event, func, capture) {
				
					if (event == 'headerclick') {
						return this._addEventListenerFor(event, func);
					}				
				
			
				return this._addEventListener(event, func, capture);
			};
		
			com_htmli_ui_Table.prototype.dispatchEvent = function(event) {
				
					if (event.getType() == 'headerclick') {
						var aux;
						eval('com_htmli_ui_Table.prototype.aux = function(ev) {'  + this.getAttribute('onheaderclick') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
				
				return this._dispatchEvent(event);
			};
			
			com_htmli_ui_Table.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_Table.target = null;
		
		com_htmli_ui_Table.xcoord = 0;
		com_htmli_ui_Table.ycoord = 0;

		com_htmli_ui_Table.prototype.base = 0;		
		com_htmli_ui_Table.prototype.limitprevious = 0;		
		com_htmli_ui_Table.prototype.limitnext = 0;		
	
		
		
		/**
		 * Called when drag and drop occurs
		 */
		application.addEventListener('mousemove', function(ev) {
			var target = com_htmli_ui_Table.target;
			var xcoord = com_htmli_ui_Table.xcoord;
			var ycoord = com_htmli_ui_Table.ycoord;			
			var parent = target? target.getParentNode() : null;
			if (target != null) {
				var x = ev.getClientX();
				var diff = parseFloat(x - xcoord);
	
				com_htmli_ui_TH.resizeToW(target, diff);
				com_htmli_ui_Table.xcoord = x;
			}			
		}, false);
		
		
		application.addEventListener('mouseup', function(ev) {
				com_htmli_ui_Table.target = null;
			}, false);
			
		
		
		
	
		
		function com_htmli_ui_TabPane(outerNode) {
			this.init(outerNode, 'com.htmli.ui.TabPane', 'TabPane');
			
			
			
		try {
			var aux = outerNode.children[0].children[0].children[0];
			if (aux.getAttribute('htmliinner') != null) {
				this.innerNode = aux;
				return;
			}
		} catch (e) {}
			
			
		try {
			var aux = outerNode.children[0].children[0].children[1];
			if (aux.getAttribute('htmliinner') != null) {
				this.innerNode = aux;
				return;
			}
		} catch (e) {}
			
			
		try {
			var aux = outerNode.children[0].children[0].children[1];
			if (aux.getAttribute('htmliinner') != null) {
				this.innerNode = aux;
				return;
			}
		} catch (e) {}
			
			
		try {
			var aux = outerNode.children[0].children[0].children[0];
			if (aux.getAttribute('htmliinner') != null) {
				this.innerNode = aux;
				return;
			}
		} catch (e) {}
			
			
		try {
			var aux = outerNode.children[0].children[0].children[0];
			if (aux.getAttribute('htmliinner') != null) {
				this.innerNode = aux;
				return;
			}
		} catch (e) {}
			
			
		try {
			var aux = outerNode.children[0].children[1].children[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.getChildren().getLength()) {
					
					/* display selected tab */
					var children = me.getChildren();
					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();
						} 
					}	
					this.setSelectedIndex(index);					
					
					/* display selected tab title */
					var position = me.getPosition();
					if (!position) {
						position = 'top'
					}
					var vertical = (position=='left' || position=='right');
					
					var children = me.getMyChildren();
					
					var i = me.getEnd()?1:0;
				
					for (; i < children.length-1; i+=2) {		
						if (Math.floor(i/2) == index) {
							if (position=='left') {
								children[i].children[0].className = 'com_htmli_ui_TabPane__selectedleft_' + position;
								children[i+1].children[0].className = 'com_htmli_ui_TabPane__selectedright_' + position;							
							} else if (position=='right') {
								var n =	children[i];
								n.children[n.children.length-1].className = 'com_htmli_ui_TabPane__selectedleft_' + position;
								n =	children[i+1];
								n.children[n.children.length-1].className = 'com_htmli_ui_TabPane__selectedright_' + position;							
							} else {
								children[i].className = 'com_htmli_ui_TabPane__selectedleft_' + position;
								children[i+1].className = 'com_htmli_ui_TabPane__selectedright_' + position;							
							}
						} else {
							if (position=='left') {
								children[i].children[0].className = 'com_htmli_ui_TabPane__itemleft_' + position;
								children[i+1].children[0].className = 'com_htmli_ui_TabPane__itemright_' + position;
							} else if (position=='right') {
								var n =	children[i];
								n.children[n.children.length-1].className = 'com_htmli_ui_TabPane__itemleft_' + position;
								n =	children[i+1];
								n.children[n.children.length-1].className = 'com_htmli_ui_TabPane__itemright_' + position;
							} else {
								children[i].className = 'com_htmli_ui_TabPane__itemleft_' + position;
								children[i+1].className = 'com_htmli_ui_TabPane__itemright_' + position;
							}
						} 
					}							
				}				
				
			
			
			};				
		com_htmli_ui_TabPane.prototype.hideChild = function(index) {
				var me = this;
				
				
			
				if (index >= 0 && index < me.getChildren().getLength()) {					
					var children = me.getMyChildren();					
					children[index*2].style.display = 'none';				
					children[index*2+1].style.display = 'none';									
				}				
				
			
			
			};				
		com_htmli_ui_TabPane.prototype.showChild = function(index) {
				var me = this;
				
				
			
				if (index >= 0 && index < me.getChildNodes().getLength()) {					
					var children = me.getMyChildren();
					children[index*2].style.display = '';				
					children[index*2+1].style.display = '';										
				}				
				
			
			
			};				
		com_htmli_ui_TabPane.prototype.appendTab = function(tab,caption) {
				var me = this;
				
			
				var children = me.getMyChildren();				
				var newNode1 = children.children[children.children.length-3].cloneNode(true);
				var newNode2 = children.children[children.children.length-2].cloneNode(true);
				newNode2.innerHTML = (caption);
				newNode2.setAttribute('position', parseInt(children.children.length/2));
				children.insertBefore(newNode1, children.lastChild);
				children.insertBefore(newNode2, children.lastChild);
				this.focusChild(0);		
				this.appendChild(tab.cloneNode(true));	
							
			
			
			};				
		com_htmli_ui_TabPane.prototype.removeTab = function(index) {
				var me = this;
				
				
			
				if (index >= 0 && index < me.getChildNodes().getLength()) {				
					var children = me.getMyChildren();
					var node = children[index*2];
					node.parentNode.removeChild(node);
					var node = children[index*2];
					node.parentNode.removeChild(node);
				}				
				
			
			
			};				
		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);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						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.getMyChildren = function() {
			/* display selected tab title */
			var position = this.getPosition();
				
			if (position == 'bottom') {
				var n = this.outerNode.children[0];
				return n.children[n.children.length-1].children[0].children[0].children[0].children[0].children;
			} else if (position == 'left') {
				return this.outerNode.children[0].children;					
			} else if (position == 'right') {
				var n = this.outerNode;
				return n.children[n.children.length-1].children;					
			} else {
				return this.outerNode.children[0].children[0].children[0].children[0].children[0].children[0].children;
			}
		};
		
		
		com_htmli_ui_TabPane.prototype.onClick  = function(current, position, ev) {
			current.focusChild(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_TBody(outerNode) {
			this.init(outerNode, 'com.htmli.ui.TBody', 'TBody');
			
			
			
		}
		
		
		com_htmli_ui_TBody.prototype = new HTMLiElement();
		
		com_htmli_ui_TBody.prototype.selectRow = function(rowNum) {
				var me = this;
				
			
				var tr = me.getChildNodes().item(rowNum);
				me.cleanSelected();
				me.addSelected(rowNum);
				tr.highlight();
			
			
			};				
		com_htmli_ui_TBody.prototype.addSelRow = function(rowNum) {
				var me = this;
				
			
				var tr = me.getChildNodes().item(rowNum);
				me.addSelected(rowNum);
				tr.highlight();
			
			
			};				
		com_htmli_ui_TBody.prototype.removeSelRow = function(rowNum) {
				var me = this;
				
			
				var tr = me.getChildNodes().item(rowNum);
				me.removeSelected(rowNum);
				tr.restore();
			
			
			};				
		com_htmli_ui_TBody.prototype.toggleSelRow = function(rowNum) {
				var me = this;
				
			
				if (me.isSelected(rowNum)) {
					me.removeSelRow(rowNum);
				} else {
					me.addSelRow(rowNum);
				}
			
			
			};				
		com_htmli_ui_TBody.prototype.selectRowsTo = function(rowNum) {
				var me = this;
				
			
				var lastSelected = me.getLastSelected();
				var from = (rowNum<lastSelected)? rowNum : lastSelected;
				var to = (rowNum<lastSelected)? lastSelected : rowNum;				
				var trArray = me.getChildNodes();
				
				me.cleanSelected();

				for (var i = from; i<=to; i++) {
					me.addSelected(i);
					trArray.item(i).highlight();	
				}	
			
			
			};				
		com_htmli_ui_TBody.prototype.getSelectedRows = function() {
				var me = this;
				
			
				if (!me.outerNode.selected) {
					me.outerNode.selected = new Array();
				}
				return me.outerNode.selected;
			
			
			};				
		
	
		com_htmli_ui_TBody.prototype.initSelected = function() {		
			this.outerNode.selected = new Array();
		};
		
		com_htmli_ui_TBody.prototype.cleanSelected = function() {		
			var trArray = this.getChildNodes();
			var selected = this.outerNode.selected;
			if (!selected) {
				return;
			}
			var length = selected.length;
		
			for (var j=0; j<length; j++) {
				var tr = trArray.item(selected[j]);
				tr.restore();
			}
			this.outerNode.selected = new Array();
		};

		com_htmli_ui_TBody.prototype.addSelected = function(rowNum) {		
			if (!this.outerNode.selected) {
				this.initSelected();
			}
			this.outerNode.selected.push(rowNum);
		};

		com_htmli_ui_TBody.prototype.removeSelected = function(rowNum) {		
			var selected = this.outerNode.selected;
			var length = selected.length;
		
			for (var j=length-1; j>=0; j--) {
				var row = selected[j];
				if (row == rowNum) {
					selected.splice(j,1);
					return row;
				}
			}
		};

		com_htmli_ui_TBody.prototype.isSelected = function(rowNum) {		
			var selected = this.outerNode.selected;
			if (!selected) {
				return false;
			}
			var length = selected.length;
		
			for (var j=0; j<length; j++) {
				var row = selected[j];
				if (row == rowNum) {
					return true;
				}
			}
			return false;			
		};

		com_htmli_ui_TBody.prototype.getLastSelected = function(rowNum) {		
			return this.outerNode.selected.pop(rowNum);
		};


	
	
		
		function com_htmli_ui_TD(outerNode) {
			this.init(outerNode, 'com.htmli.ui.TD', 'TD');
			
			
				this.innerNode = outerNode.children[0];
			
			
		}
		
		
		com_htmli_ui_TD.prototype = new HTMLiElement();
		
		com_htmli_ui_TD.prototype.getSelector = function() {
				
						var value = this.getAttribute('selector');
						return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
					
				
			};
			
			com_htmli_ui_TD.prototype.setSelector = function(selector) {
					
							this.setAttribute('selector', selector ? 'true' : 'false');	
											
				};		
			com_htmli_ui_TD.prototype.setWidth = function(width) {
				var me = this;
				
			
				/* substract one pixel corresponding to the border width */
				me.outerNode.style.width = width-1 + "px";
				/* substract 4 pixel corresponding to the padding */
				me.outerNode.firstChild.style.width = (width-5) + "px";
			
			
			};				
		
	
		com_htmli_ui_TD.prototype.onMouseDown = function(obj, ev) {		
	
			if (ev.getCtrlKey()) {
				this.getParentNode().toggleSelected();
			} else if (ev.getShiftKey()) {
				this.getParentNode().selectTo();
			} else {
				this.getParentNode().select();
			}
		};
		
	
		
		function com_htmli_ui_TH(outerNode) {
			this.init(outerNode, 'com.htmli.ui.TH', 'TH');
			
			
				this.innerNode = outerNode.children[0].children[1];
			
			
		}
		
		
		com_htmli_ui_TH.prototype = new HTMLiElement();
		
		com_htmli_ui_TH.prototype.getCellIndex = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var cellIndex = __value;
				
						return me.outerNode.cellIndex;
						return __value;
					
				
			};
			
			com_htmli_ui_TH.prototype.setWidth = function(width) {
				var me = this;
				
			
				/*me.outerNode.firstChild.style.width = width + "px";*/
				me.outerNode.firstChild.firstChild.style.width = (width-8) + "px";
			
			
			};				
		
	
	com_htmli_ui_TH.prototype.onMouseOver = function(obj) {		
		if (!com_htmli_ui_Table.target) {
			obj.firstChild.className = 'com_htmli_ui_TH__container_hover';
		}
	};
	
	com_htmli_ui_TH.prototype.onMouseOut = function(obj) {		
		if (!com_htmli_ui_Table.target) {
			obj.firstChild.className = 'com_htmli_ui_TH__container';
		}
	};
	
	com_htmli_ui_TH.prototype.onClick = function(obj) {		
		if (!com_htmli_ui_Table.target) {
			var newEvent = application.createEvent('HTMLiEvents');
			newEvent.initHTMLiEvent('headerclick', this);
			this.getParentNode().getParentNode().dispatchEvent(newEvent);
		}
	};

	com_htmli_ui_TH.prototype.start = function(x, y) {		
		com_htmli_ui_Table.target = this;
		com_htmli_ui_Table.xcoord = x;
		com_htmli_ui_Table.ycoord = y;	
	};
	
	com_htmli_ui_TH.resizeToW = function(target, diff) {		
		var leftwidth = target.getWidth();
		var rightwidth = target.getNextSibling().getWidth();

		if (rightwidth && leftwidth) {
			if (diff<0 && (leftwidth + diff)>=0) {
				target.getNextSibling().outerNode.style.width = parseFloat(rightwidth - diff) + "px";
				target.outerNode.style.width = parseFloat(leftwidth + diff) + "px";
			} else if (diff>0 && (rightwidth - diff)>=0) {
				target.outerNode.style.width = parseFloat(leftwidth + diff) + "px";
				target.getNextSibling().outerNode.style.width = parseFloat(rightwidth - diff) + "px";
			}
		} 
	};

	
		
	
		
		function com_htmli_ui_THead(outerNode) {
			this.init(outerNode, 'com.htmli.ui.THead', 'THead');
			
			
				this.innerNode = outerNode.children[0];
			
			
		}
		
		
		com_htmli_ui_THead.prototype = new HTMLiElement();
		
		
		
		function com_htmli_ui_TR(outerNode) {
			this.init(outerNode, 'com.htmli.ui.TR', 'TR');
			
			
			
		}
		
		
		com_htmli_ui_TR.prototype = new HTMLiElement();
		
		com_htmli_ui_TR.prototype.getRowIndex = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var rowIndex = __value;
				
						return me.outerNode.rowIndex;
						return __value;
					
				
			};
			
			com_htmli_ui_TR.prototype.highlight = function() {
				var me = this;
				
			
				var childNodes = me.getChildNodes();
				var length = childNodes.getLength();			
				for (var j=0; j<length-1; j++) {
					var td = childNodes.item(j);
					if (!td.getSelector()) {
						td.setClassName('com_htmli_ui_TD__selected');
					}
				}
			
			
			};				
		com_htmli_ui_TR.prototype.restore = function() {
				var me = this;
				
			
				var childNodes = me.getChildNodes();
				var length = childNodes.getLength();				
				for (var j=0; j<length-1; j++) {
					var td = childNodes.item(j);
					if (!td.getSelector()) {
						td.setClassName('com_htmli_ui_TD');
					}
				}
			
			
			};				
		com_htmli_ui_TR.prototype.select = function() {
				var me = this;
				
			
				me.getParentNode().selectRow(me.getRowIndex()-1);
			
			
			};				
		com_htmli_ui_TR.prototype.addSelected = function() {
				var me = this;
				
			
				me.getParentNode().addSelRow(me.getRowIndex()-1);
			
			
			};				
		com_htmli_ui_TR.prototype.toggleSelected = function() {
				var me = this;
				
			
				me.getParentNode().toggleSelRow(me.getRowIndex()-1);
			
			
			};				
		com_htmli_ui_TR.prototype.selectTo = function() {
				var me = this;
				
			
				me.getParentNode().selectRowsTo(me.getRowIndex()-1);
			
			
			};				
		
		
		function com_htmli_ui_Tree(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Tree', 'Tree');
			
			
				this.innerNode = outerNode.children[0];
			
			
		}
		
		
		com_htmli_ui_Tree.prototype = new HTMLiElement();
		
		com_htmli_ui_Tree.prototype.unselectAll = function() {
				var me = this;
				
			
				var children=me.getChildNodes();
				var length=children.getLength();
				for (var i = 0; i<length; i++) {
					var child = children.item(i);
					if (child.hasChildNodes() && child.getFirstChild().getClassName().indexOf('com_htmli_ui_Tree') >= 0) {
						child.getFirstChild().unselectAll();
					}
					child.setSelected(false);
				}
			
			
			};				
		
		
		function com_htmli_ui_TreeItem(outerNode) {
			this.init(outerNode, 'com.htmli.ui.TreeItem', 'TreeItem');
			
			
				this.innerNode = outerNode.children[0].children[0].children[0].children[1].children[1];
			
			
		}
		
		
		com_htmli_ui_TreeItem.prototype = new HTMLiElement();
		
		com_htmli_ui_TreeItem.prototype.getOpened = function() {
				
						var value = this.getAttribute('opened');
						return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
					
				
			};
			
			com_htmli_ui_TreeItem.prototype.setOpened = function(opened) {
					
							this.setAttribute('opened', opened ? 'true' : 'false');	
											
				};		
			com_htmli_ui_TreeItem.prototype.getSelected = function() {
				
						var value = this.getAttribute('selected');
						return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
					
				
			};
			
			com_htmli_ui_TreeItem.prototype.setSelected = function(selected) {
					
							var me = this;
							var __value = selected;
							
								if (__value == true) {
									__value = 'true';
								}
								if (__value == false) {
									__value = 'false';
								}						
							
			
				if(selected) {
					me.outerNode.firstChild.firstChild.firstChild.firstChild.lastChild.firstChild.className = 
					'com_htmli_ui_TreeItem__caption_selected';
				} else {
					me.outerNode.firstChild.firstChild.firstChild.firstChild.lastChild.firstChild.className = 
					'com_htmli_ui_TreeItem__caption';
				}
			
			
							this.setAttribute('selected', __value);	
											
				};		
			com_htmli_ui_TreeItem.prototype.getIcon = function() {
				
						return this.getAttribute('icon');
					
				
			};
			
			com_htmli_ui_TreeItem.prototype.getCaption = function() {
				
						return this.getAttribute('caption');
					
				
			};
			
			com_htmli_ui_TreeItem.prototype.setCaption = function(caption) {
					
							var me = this;
							var __value = caption;
							
				me.outerNode.firstChild.firstChild.firstChild.firstChild.lastChild.firstChild.innerHTML = caption;
			
							this.setAttribute('caption', __value);	
											
				};		
			com_htmli_ui_TreeItem.prototype.toggle = function() {
				var me = this;
				
			
				if (me.hasChildren()) {
					if (me.getOpened()) {
						me.close();
					} else {
						me.expand();
					}
				}				
			
			
			};				
		com_htmli_ui_TreeItem.prototype.expand = function() {
				var me = this;
				
			
				if (me.hasChildren()) {
					me.setOpened(true);
					me.outerNode.children[0].children[0].children[0].children[0].children[0].children[0].className = 'com_htmli_ui_TreeItem__opened';				
					var tbody = me.outerNode.children[0].children[0].children[0];
					tbody.children[tbody.children.length-1].className = 'com_htmli_ui_TreeItem__visible';
				}
			
			
			};				
		com_htmli_ui_TreeItem.prototype.close = function() {
				var me = this;
				
			
				if (me.hasChildren()) {
					me.setOpened(false);					
					me.outerNode.children[0].children[0].children[0].children[0].children[0].children[0].className = 'com_htmli_ui_TreeItem__closed';
					var tbody = me.outerNode.children[0].children[0].children[0];
					tbody.children[tbody.children.length-1].className = 'com_htmli_ui_TreeItem__hidden';
				}
			
			
			};				
		
	
		com_htmli_ui_TreeItem.prototype.click  = function (obj, ev) {
			this.toggle();
			var tree = this.getTree();
			tree.unselectAll();
			this.setSelected(true);
		}

		com_htmli_ui_TreeItem.prototype.mouseOut  = function (obj, ev) {
			if (this.getSelected())	{
				obj.className='com_htmli_ui_TreeItem__caption_selected';
			} else {
				obj.className='com_htmli_ui_TreeItem__caption'
			}
			ev.stopPropagation();
		}
		com_htmli_ui_TreeItem.prototype.mouseOver  = function (obj, ev) {
			if (this.getSelected())	{
				obj.className = 'com_htmli_ui_TreeItem__caption_selhover';
			} else {
				obj.className = 'com_htmli_ui_TreeItem__caption_hover';
			}
			ev.stopPropagation();			
		}
		
		com_htmli_ui_TreeItem.prototype.getTree  = function () {
			var parentTree = this.getParentNode();
			if (parentTree.getParentNode() && parentTree.getTree) {
				return parentTree.getParentNode().getTree();
			} else {
				return this.getParentNode();
			}
		}

		
	
		
		function com_htmli_ui_Window(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Window', 'Window');
			
			
			
		try {
			var aux = outerNode.children[2].children[0].children[0].children[1].children[1].children[0];
			if (aux.getAttribute('htmliinner') != null) {
				this.innerNode = aux;
				return;
			}
		} catch (e) {}
			
			
		try {
			var aux = outerNode.children[2].children[0].children[0].children[1].children[1].children[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) {
					
							var me = this;
							var __value = icon;
							
			
				me.outerNode.children[2].children[0].children[0].children[0].children[1].children[0].src = icon;
			
			
							this.setAttribute('icon', __value);	
											
				};		
			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.children[2].children[0].children[0].children[0].children[1].children[1].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.setNoMaxButton = function(noMaxButton) {
					
							var me = this;
							var __value = noMaxButton;
							
			
			
				var change = function() {
					if (noMaxButton) {
						me.outerNode.children[2].children[0].children[0].children[0].children[2].children[0].children[1].style.display = 'none';
					} else {
						me.outerNode.children[2].children[0].children[0].children[0].children[2].children[0].children[1].style.display = '';
					}
				};				
				if (document.all) {
					setTimeout(change,1);
				} else {
					change();
				}					


			
			
							this.setAttribute('nomaxbutton', __value);	
											
				};		
			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.setHelpButton = function(helpButton) {
					
							var me = this;
							var __value = helpButton;
							
			
				

				var change = function() {
					if (helpButton) {
						me.outerNode.children[2].children[0].children[0].children[0].children[2].children[0].children[4].style.display = '';
					} else {
						me.outerNode.children[2].children[0].children[0].children[0].children[2].children[0].children[4].style.display = 'none';
					}
				};
				if (document.all) {
					setTimeout(change,1);
				} else {
					change();
				}		
				
			
			
							this.setAttribute('helpbutton', __value);	
											
				};		
			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.getContentHeight = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var contentHeight = __value;
				
						var table = application.wrapNode(me.outerNode.children[2].children[0]); return table.getHeight();
						return __value;
					
				
			};
			
			com_htmli_ui_Window.prototype.getContentWidth = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var contentWidth = __value;
				
						var table = application.wrapNode(me.outerNode.children[2].children[0]); return table.getWidth();
						return __value;
					
				
			};
			
			com_htmli_ui_Window.prototype.getPreviousWidth = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var previousWidth = __value;
				
						return parseInt(me.outerNode.previousWidth);
						return __value;
					
				
			};
			
			com_htmli_ui_Window.prototype.getPreviousHeight = function() {
							
						var me = this;
						var __value = this.getAttribute('');
						var previousHeight = __value;
				
						return parseInt(me.outerNode.previousHeight);
						return __value;
					
				
			};
			
			com_htmli_ui_Window.hideAll = function() {
				var me = this;
				
			
				var length = com_htmli_ui_Window.active.length;
				for (var i=0; i<length; i++) {
					com_htmli_ui_Window.active[i].outerNode.style.display = 'none';
				}
							
			
			};				
		com_htmli_ui_Window.showAll = function() {
				var me = this;
				
			
				var length = com_htmli_ui_Window.active.length;
				for (var i=0; i<length; i++) {
					com_htmli_ui_Window.active[i].outerNode.style.display = 'block';
				}
							
			
			};				
		com_htmli_ui_Window.prototype.moveTo = function(top,left) {
				var me = this;
				
			
				var style = this.outerNode.style;
				style.top = top + 'px';
				style.left = left + 'px';			
			
			
			};				
		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';
				
				me.getCookies();					
				var table = application.wrapNode(me.outerNode.children[2].children[0]);
				//If cookies set width and height, use them. Otherwise, use user's style. Otherwise, use contents size. Otherwise, use minimized size.
				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;
				
				var buttons = me.outerNode.children[2].children[0].children[0].children[0].children[2].children[0];
				me.outerNode.closeButton = buttons.children[0];
				me.outerNode.maxButton = buttons.children[1];
				me.outerNode.restoreButton = buttons.children[2];
				me.outerNode.minButton = buttons.children[3];
				me.outerNode.helpButton = buttons.children[4];				
				
				me.resizeTo(width, height, true, true, true);

				/*If icon present, move the caption to leave space*/
				if (me.getIcon()) {
					me.outerNode.children[2].children[0].children[0].children[0].children[1].children[1].style.left = '20px';
				}

				/*Set the buttonbar width*/
				var style = application.wrapNode(me.outerNode.children[2].children[0].children[0].children[0].children[2].children[0]).getStyle();
				style.width = me.getButtonBarWidth() + "px";
				style = application.wrapNode(me.outerNode.children[2].children[0].children[0].children[0].children[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";					
				}
				
				if (com_htmli_ui_Window.alwaysCentered) {				
					me.center();
				}
				if (com_htmli_ui_Window.alwaysExclusive) {
					me.showOverlay();				
					me.setNotDraggable(true);
				}
				
				me.setState('normal');
			
			
			};				
		com_htmli_ui_Window.prototype.openExclusive = function(handler) {
				var me = this;
				
			
				me.open();
				me.center();

				me.showOverlay();
				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 minimized, clean the space of the array */
				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 = '';
				}
				
				me.dispatchClose();
				
				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.children[0].style.width, me.outerNode.children[0].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, true);
			
			me.dispatchMinimize();
			me.setState('minimized');
			
			/*Activates the previous window*/
			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, 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);
					}				
				
					if (event == 'closewindow') {
						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);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
					if (event.getType() == 'resizewindow') {
						var aux;
						eval('com_htmli_ui_Window.prototype.aux = function(ev) {'  + this.getAttribute('onresizewindow') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
					if (event.getType() == 'maxwindow') {
						var aux;
						eval('com_htmli_ui_Window.prototype.aux = function(ev) {'  + this.getAttribute('onmaxwindow') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
					if (event.getType() == 'minwindow') {
						var aux;
						eval('com_htmli_ui_Window.prototype.aux = function(ev) {'  + this.getAttribute('onminwindow') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
					if (event.getType() == 'closewindow') {
						var aux;
						eval('com_htmli_ui_Window.prototype.aux = function(ev) {'  + this.getAttribute('onclosewindow') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						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.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.children[0].style.width;
			com_htmli_ui_Window.maximized.height = this.outerNode.children[0].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.outerNode.restoreButton.style.display = 'none';
			this.outerNode.maxButton.style.display = '';
		
			this.resizeTo(width, height, true, true, true);
			this.moveTo(x, y);
			
			this.setState('normal');		
		};

		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, true);
			this.moveTo(x, y);
			
			this.outerNode.minButton.style.display = '';
			this.outerNode.restoreButton.style.display = 'none';			



			this.setState('normal');			

			/*Activates this window*/
			com_htmli_ui_Window.active.push(this);
			com_htmli_ui_Window.refreshActive();
			
		};

		/**
		 * Private function called when drag and drop begins
		 */
		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.children[1].style;
					if (!style.top && !style.left) {
						style.top =  "0px";
						style.left =  "0px";					
					}
				}
			}
		};

		/**
		 * Private function called when resize begins
		 */
		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.getRelativeX(), this.getRelativeY()];*/
				com_htmli_ui_Window.resizingBase = [this.getX(), this.getY()];
				com_htmli_ui_Window.resizingAxis = [horizontal, vertical];
			}
		};
		
		
		/**
		 * Called when mouseup occurs
		 */
		 

		com_htmli_ui_Window.prototype.resizeTo = function(width, height, changeDashed, ignoreRememberSize, ignoreDispatch) {		
			var last = this.outerNode.children[this.outerNode.children.length-1];
			last.style.display = 'none';		
			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;	
			}
			
			if (!ignoreDispatch) {
				this.dispatchResize();		
			}
			last.style.display = '';						
		};
		
		
		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) {

			this.outerNode.previousWidth = this.getWidth();
			
			if (parseInt(width) < (this.getButtonBarWidth()+ 10))
			{
				width = (this.getButtonBarWidth() + 10) + "px";
				/* Also correct the drawing div*/
				this.outerNode.children[1].style.width = width;
			}
			/* outerNode */
			this.outerNode.style.width = (parseFloat(width)-8) + "px";
			
			/* Div that contains and restricts the size of the table */
			this.outerNode.children[2].style.width = width;

			/* Dashed div used to resize and dnd */
			if (changeDashed) {
				this.outerNode.children[0].style.width = width;
			}

			/* Center div */
			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.children[2].children[0].children[0].children[0].children[1].style;
			style.width = (parseFloat(width) - this.getButtonBarWidth()) + "px";
			
		};
		
		com_htmli_ui_Window.prototype.resizeToH = function(height, changeDashed) {	

			this.outerNode.previousHeight = this.getHeight();

			if (parseInt(height) < 35)
			{
				height = "35px";
				/* Also correct the drawing div*/
				this.outerNode.children[0].style.height = height;
			}
			
			/* outerNode */
			this.outerNode.style.minHeight = height;
			
			/* Div that contains and restricts the size of the table */
			this.outerNode.children[2].style.minHeight = height;

			/* Dashed div used to resize and dnd */
			if (changeDashed) {
				this.outerNode.children[0].style.minHeight = height;
			}

			/* Center div */
			if (this.getUrl()) {
				var style = this.innerNode.style;
				style.minHeight = (parseFloat(height)-34 < 0)? "0px" : (parseFloat(height)-34) + "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.children[0]) {
					this.outerNode.children[0].style.display = '';
					this.outerNode.children[0].style.height = '30px';
					this.outerNode.children[0].className = 'com_htmli_ui_Window__faded';
				}
			}
			
		};
		
		com_htmli_ui_Window.prototype.activate = function() {
			if (this.outerNode.children[0]) {
				this.outerNode.children[0].style.height = this.outerNode.style.height;					
				this.outerNode.children[0].style.display = 'none';
				this.outerNode.children[0].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 still out of bounds*/
				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 still out of bounds*/
				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;
		};

		/**
		 * Called when mousemove occurs
		 */
		application.addEventListener('mousemove', function(ev) {
			if (com_htmli_ui_Window.resizingTable != null) {
				var obj = com_htmli_ui_Window.resizingTable;
				var div = obj.outerNode.children[0];
				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.children[0];

				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 = (isNaN(parseInt(style.top)) ? 0 : parseInt(style.top) + diff[1]) + "px";						
					style.left = (isNaN(parseInt(style.left)) ? 0 : 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);
		};

		com_htmli_ui_Window.prototype.dispatchClose = function(obj, ev) {
			var newEvent = application.createEvent('HTMLiEvents');
			newEvent.initHTMLiEvent('closewindow', this);
			this.dispatchEvent(newEvent);
		};

		com_htmli_ui_Window.prototype.showOverlay = function() {
			var me = this;			
			var height;
			if (navigator.userAgent.toLowerCase().indexOf('msie') > -1) {
				height = document.body.clientHeight;
			} else {
				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.children[1].style;
			style.height = height;				
			style.width = width;
			style.display = '';
			style.top = (-top) + "px";
			style.left = (-left) + "px";				

		}
			
		
		application.addEventListener('mouseup', function() {
				if (com_htmli_ui_Window.resizingTable != null) {
					var drawingDiv = com_htmli_ui_Window.resizingTable.outerNode.children[0];
					var width = drawingDiv.style.width;
					var height = drawingDiv.style.height;

					com_htmli_ui_Window.resizingTable.resizeTo(width, height);
					drawingDiv.style.display='none'; 
					
				}	
				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.children[0];
						var diff = [parseInt(drawingDiv.style.left), parseInt(drawingDiv.style.top)];					
						var style = obj.outerNode.style;
						if (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()) {
				/*Activates the previous window*/
				com_htmli_ui_Window.shiftTop();
				if (com_htmli_ui_Window.bottom()) {
					com_htmli_ui_Window.bottom().deactivate();
				}
				com_htmli_ui_Window.refreshActive(true);
				if (com_htmli_ui_Window.top()) {
					com_htmli_ui_Window.top().top();
				}
			} else if (ev.getKeyCode()==39 && ev.getCtrlKey() && ev.getAltKey()) {
				/*Activates the next window*/
				com_htmli_ui_Window.shiftBottom();
				com_htmli_ui_Window.refreshActive();
				if (com_htmli_ui_Window.top()) {
					com_htmli_ui_Window.top().top();
				}
			} else if (ev.getKeyCode()==68 && ev.getCtrlKey() && ev.getAltKey()) {
				/*Hides all windows*/
				com_htmli_ui_Window.hideAll();
			} else if (ev.getKeyCode()==87 && ev.getCtrlKey() && ev.getAltKey()) {
				/*Show all windows*/
				com_htmli_ui_Window.showAll();
			}
			ev.stopPropagation();
			ev.preventDefault();			
		}, false);
			
		
	
		
		function com_htmli_ui_Wizard(outerNode) {
			this.init(outerNode, 'com.htmli.ui.Wizard', 'Wizard');
			
			
				this.innerNode = outerNode.children[0].children[0];
			
			
		}
		
		
		com_htmli_ui_Wizard.prototype = new HTMLiElement();
		
		com_htmli_ui_Wizard.prototype.getPosition = function() {
				
						return this.getAttribute('position');
					
				
			};
			
			com_htmli_ui_Wizard.prototype.getStep = function() {
							
						var me = this;
						var __value = this.getAttribute('step');
						var step = __value;
				
						if (!com_htmli_ui_Wizard.step) { com_htmli_ui_Wizard.step = 0; } return com_htmli_ui_Wizard.step;
						return __value;
					
				
			};
			
			com_htmli_ui_Wizard.prototype.setStep = function(step) {
					
							var me = this;
							var __value = step;
							
			
				com_htmli_ui_Wizard.step = step;
			
			
							this.setAttribute('step', __value);	
											
				};		
			com_htmli_ui_Wizard.prototype.moveTo = function(stepNumber) {
				var me = this;
				
			
				var step = me.getChildNodes().item(stepNumber);
				if (step && step.getClass() == 'com.htmli.ui.Step') {
					me.getChildNodes().item(me.getStep()).hide();
					me.setStep(stepNumber);
					step.show();
				}
			
			
			};				
		com_htmli_ui_Wizard.prototype.previous = function() {
				var me = this;
				
			
				me.moveTo(me.getStep() - 1);
				var newEvent = application.createEvent('HTMLiEvents');
				newEvent.initHTMLiEvent('change', this);
				this.dispatchEvent(newEvent);
				
			
			
			};				
		com_htmli_ui_Wizard.prototype.next = function() {
				var me = this;
				
			
				me.moveTo(me.getStep() + 1);
				var newEvent = application.createEvent('HTMLiEvents');
				newEvent.initHTMLiEvent('change', this);
				this.dispatchEvent(newEvent);

			
			
			};				
		com_htmli_ui_Wizard.prototype.first = function() {
				var me = this;
				
			
				me.moveTo(0);
				var newEvent = application.createEvent('HTMLiEvents');
				newEvent.initHTMLiEvent('change', this);
				this.dispatchEvent(newEvent);
				
			
			
			};				
		com_htmli_ui_Wizard.prototype._addEventListener = com_htmli_ui_Wizard.prototype.addEventListener;
		
			com_htmli_ui_Wizard.prototype._dispatchEvent = com_htmli_ui_Wizard.prototype.dispatchEvent;
		
		
			com_htmli_ui_Wizard.prototype.addEventListener = function(event, func, capture) {
				
					if (event == 'change') {
						return this._addEventListenerFor(event, func);
					}				
				
			
				return this._addEventListener(event, func, capture);
			};
		
			com_htmli_ui_Wizard.prototype.dispatchEvent = function(event) {
				
					if (event.getType() == 'change') {
						var aux;
						eval('com_htmli_ui_Wizard.prototype.aux = function(ev) {'  + this.getAttribute('onchange') + '};');
						this.aux(event);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						return;				
					}					
				
				
				return this._dispatchEvent(event);
			};
			
			com_htmli_ui_Wizard.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_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.getCache = function() {
				
						var value = this.getAttribute('cache');
						return (value == 'false' || value == 'no' || value == null || !value) ? false : true;
					
				
			};
			
			com_htmli_xml_Xml.prototype.setCache = function(cache) {
					
							this.setAttribute('cache', cache ? 'true' : 'false');	
											
				};		
			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();
				
				me.outerNode.httpRequest = httpRequest;
				
				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, httpRequest.status);
						}				
					}
				};
				var xmlDoc = XmlDocument.create();
				xmlDoc.loadXML(me.outerNode.value.replace('<?xml version="1.0"?>', '<?xml version="1.0" encoding="utf-8" ?>'));
				httpRequest.setRequestHeader("Content-Type", "application/xml;charset=UTF-8");
				httpRequest.send(xmlDoc);					
			
			
			};				
		com_htmli_xml_Xml.prototype.get = function(handler,param) {
				var me = this;
				
			
				var httpRequest = HttpRequest.create();
				
				var url = me.getCache() ? (me.getUrl() + '?' + com_htmli_xml_Xml.cacheHash) : (me.getUrl() + '?' + new Date().getTime());
				 
				httpRequest.open("GET", url, true);
				httpRequest.onreadystatechange = function() {			
					
					if (httpRequest.readyState == 4) {
						me.outerNode.value = httpRequest.responseText;	
								
						if (handler) {
							handler(param, httpRequest.responseXML, httpRequest.status);
						}	
						
						me.dispatchChange();	
					}
				};
				httpRequest.send("");	
				
				
			
			
			};				
		com_htmli_xml_Xml.prototype.abort = function() {
				var me = this;
				
			
				if (me.outerNode.httpRequest) {
					me.outerNode.httpRequest.onreadystatechange = function() {};
					me.outerNode.httpRequest.abort();
				}
			
			
			};				
		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);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						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;
		};
		
		com_htmli_xml_Xml.cacheHash = new Date().getTime();
		
		application.addEventListener('keyup', function(ev) {
			if (ev.getKeyCode() == 123) {
				com_htmli_xml_Xml.cacheHash = new Date().getTime();
			}				
		});

		
	
		
		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.getChildren();
				for (var i=0; i < children.getLength(); i++) {
					var n = document.all ? children.item(i).getXmlDocument().documentElement : xmlDocument.adoptNode(children.item(i).getXmlDocument().documentElement);
					xmlDocument.documentElement.appendChild(n);
				}
				return xmlDocument;
			
			
			};				
		com_htmli_xml_XmlMultiple.prototype.get = function(handler,param) {
				var me = this;
				
			
				var children = me.getChildren();
				var count = children.getLength();
				
				if (com_htmli_xml_XmlMultiple.progressBar) {
					com_htmli_xml_XmlMultiple.progressBar.setProgress(0);
					com_htmli_xml_XmlMultiple.progressBar.setMaximum(count);					
				}
				
				var aux = count;
				var status = 200;
				
				for (var i=0; i < count; i++) {
				
					children.item(i).get(function(foo, xmlDoc, currentStatus) {
							if (com_htmli_xml_XmlMultiple.progressBar) {
								com_htmli_xml_XmlMultiple.progressBar.setProgress(com_htmli_xml_XmlMultiple.progressBar.getProgress()+1);
							}
							
							status = currentStatus == 200 ? status : currentStatus;
								
							if(--aux <= 0) {
								if (handler) {
									handler(param, me.getXmlDocument(), status);
								}
							}
						});
				}				
						
			
			};				
		
		
		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 args = '';
				for (var i=1; i < arguments.length ;i++) {
					args += ',arguments[' + i + ']';
				}
				var handler = function() {};
				eval('this.call(handler, me.getUrl(), false, service ' + args + ')');	
				
			
			};				
		com_htmli_xml_XmlRpcServer.prototype.executeAsync = function(service,handler) {
				var me = this;
				
			
				var args = '';
				for (var i=2; i < arguments.length ;i++) {
					args += ',arguments[' + i + ']';
				}
				
				eval('this.call(handler, me.getUrl(), true, service ' + args + ')');	
				
			
			};				
		
	
		
com_htmli_xml_XmlRpcServer.prototype.objectToXMLRPC = function(obj) {
	var wo = obj.valueOf();
	retstr = "<struct>";
	for(prop in obj){
		if(typeof wo[prop] != "function"){
			retstr += "<member><name>" + prop + "</name><value>" + this.getXML(wo[prop]) + "</value></member>";
		}
	}
	retstr += "</struct>";
	return retstr;
};

com_htmli_xml_XmlRpcServer.prototype.stringToXMLRPC = function(obj) {
	return "<string><![CDATA[" + obj.replace(/\]\]/g, "]" + " ]") + "]" + "]></string>";
};

com_htmli_xml_XmlRpcServer.prototype.numberToXMLRPC = function(obj) {
	if (obj == parseInt(obj)){
		return "<int>" + obj + "</int>";
	}
	else if (obj == parseFloat(obj)){
		return "<double>" + obj + "</double>";
	}
	else{
		return this.booleanToXMLRPC(false);
	}
};

com_htmli_xml_XmlRpcServer.prototype.booleanToXMLRPC = function(obj) {
	return "<boolean>" + (obj ? "1" : "0") + "</boolean>";
};

com_htmli_xml_XmlRpcServer.prototype.dateToXMLRPC = function(obj) {
	
	return "<dateTime.iso8601>" + doYear(obj.getUTCFullYear()) + doZero(obj.getMonth()) + doZero(obj.getUTCDate()) + "T" + doZero(obj.getHours()) + ":" + doZero(obj.getMinutes()) + ":" + doZero(obj.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) { 
			throw new Error("Unsupported year: " + year);			
		} 
		year = String("0000" + year)
		return year.substr(year.length-4, 4);
	}
};

com_htmli_xml_XmlRpcServer.prototype.arrayToXMLRPC = function(obj) {
	var retstr = "<array><data>";
	for (var i=0; i<obj.length; i++){
		retstr += "<value>" + this.getXML(obj[i]) + "</value>";
	}
	return retstr + "</data></array>";
};

com_htmli_xml_XmlRpcServer.prototype.getXML = function(obj) {
	switch (typeof(obj)){
		case "string":
			return this.stringToXMLRPC(obj);
		case "number":
			return this.numberToXMLRPC(obj);
		case "boolean":
			return this.booleanToXMLRPC(obj);
	}
	
	if (obj.getUTCFullYear) {
		return this.dateToXMLRPC(obj);
	} else if (obj.constructor.toString().match(/array/i)) {
		return this.arrayToXMLRPC(obj);
	}  else {
		return this.objectToXMLRPC(obj);
	}
	
};

com_htmli_xml_XmlRpcServer.prototype.parseResponse = function(xmlDoc) {
	var rpcErr = xmlDoc.getElementsByTagName("fault");
	if (rpcErr.length > 0) {
		rpcErr = com_htmli_xml_XmlRpcServer.prototype.toObject(rpcErr[0].firstChild.firstChild);
		if (document.all) {
			throw new Error(rpcErr.faultCode, rpcErr.faultString);
		} else {
			throw new Error(rpcErr.faultString, rpcErr.faultCode);
		}
	}
	
	var main = xmlDoc.getElementsByTagName("param");
	if (main.length == 0) {
		throw new Error("Malformed XMLRPC Message");
	}
	return com_htmli_xml_XmlRpcServer.prototype.toObject(main[0].firstChild);
};

com_htmli_xml_XmlRpcServer.prototype.toObject = function(data) {
	if (!data) {
		return data;
	}
	if (!data.tagName) {
		return data.nodeValue;
	}

	switch (data.tagName){
		case "string":
			return (data.firstChild) ? new String(data.firstChild.nodeValue) : "";
		case "value":		
			return this.toObject(data.firstChild);
		case "int":
		case "i4":
		case "double":
			return (data.firstChild) ? new Number(data.firstChild.nodeValue) : 0;
		case "dateTime.iso8601":
			var sn = (document.all) ? "-" : "/";
			if (/^(\d{4})(\d{2})(\d{2})T(\d{2}):(\d{2}):(\d{2})/.test(data.firstChild.nodeValue)){;//data.text)){
	      		return new Date(RegExp.$2 + sn + RegExp.$3 + sn + RegExp.$1 + " " + RegExp.$4 + ":" + RegExp.$5 + ":" + RegExp.$6);
	      	} else{
				return new Date();
			}
		case "array":
			var ret = [];
			for (var i=0; i < data.firstChild.childNodes.length; i++) {
				ret[ret.length] = this.toObject(data.firstChild.childNodes[i]);
			}			
		case "struct":
			var ret = {};
			for (var i=0; i < data.childNodes.length; i++) {
				ret[data.childNodes[i].firstChild.firstChild.nodeValue] = this.toObject(data.childNodes[i].lastChild);
			}
			return ret;
		case "boolean":
			return Boolean(isNaN(parseInt(data.firstChild.nodeValue)) ? (data.firstChild.nodeValue == "true") : parseInt(data.firstChild.nodeValue))
		case "base64":
			return this.decodeBase64(data.firstChild.nodeValue);
		default:
			throw new Error("Malformed XMLRPC Message: " + data.tagName);
	}
};

com_htmli_xml_XmlRpcServer.prototype.call = function(handler, url, async, service, params)	{

	/* build message */
	var message = '<?xml version="1.0" ?><methodCall><methodName>' + service + '</methodName><params>';
	for (i=4; i<arguments.length; i++){
  		message += '<param><value>' + this.getXML(arguments[i]) + '</value></param>';
	}
	message += '</params></methodCall>';
	var xmlDoc = XmlDocument.create();
	xmlDoc.loadXML(message);
	
	/* do call */
	var httpRequest = HttpRequest.create();
	httpRequest.open('POST', url, async);
	httpRequest.setRequestHeader("Content-type", "text/xml");	
	var parseResponse = this.parseResponse;
	if (async) {
		httpRequest.onreadystatechange = function() {
			if (httpRequest.readyState == 4) {
				try {
					var r = parseResponse(httpRequest.responseXML);
				} catch (e) {
					handler(null, e);
					return;
				}
				handler(r);
			}
		}
	}	
	httpRequest.send(xmlDoc);
	if (!async) {
		handler(this.parseResponse(httpRequest.responseXML));
	}
};

com_htmli_xml_XmlRpcServer.prototype.decodeBase64 = function(sEncoded){
		// Input must be dividable with 4.
		if(!sEncoded || (sEncoded.length % 4) > 0)
		  return sEncoded;
	
		/* Use NN's built-in base64 decoder if available.
		   This procedure is horribly slow running under NN4,
		   so the NN built-in equivalent comes in very handy. :) */
	
		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);
		}
	
		// not sure if the following statement behaves as supposed under
		// all circumstances, but tests up til now says it does.
	
		return sDecoded.substring(0, sDecoded.length -
		 ((sEncoded.charCodeAt(i - 2) == 61) ? 2 :
		  (sEncoded.charCodeAt(i - 1) == 61 ? 1 : 0)));
	};
	
		

		
	
		
		function com_htmli_xml_Xsl(outerNode) {
			this.init(outerNode, 'com.htmli.xml.Xsl', 'Xsl');
			
			
				this.innerNode = outerNode.children[0];
			
			
		}
		
		
		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.getStatus = function() {
				var me = this;
				
			
				return me.getUrl() ? me.outerNode.status : me.getContainer().getElementById(me.getSrc()).getStatus();
			
			
			};				
		com_htmli_xml_Xsl.prototype.refresh = function(handler,refreshXml,param) {
				var me = this;
				
			
			
				var url;
				var xmlDocument;
				
				var xsl = '<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="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.children[1].value;
				xsl += '</xslt:template></xslt:stylesheet>';
				var xslDocument = XmlDocument.create();
				xslDocument.async = false;
				xslDocument.loadXML(xsl);
				
				
				if (url=me.getUrl()) {
					var httpRequest = HttpRequest.create();
					var createTime = new Date().getTime();
					me.outerNode.lastRequest = createTime;
								
					httpRequest.open("GET", me.getUrl() + '?rand=' + new Date().getTime(), true);
					httpRequest.onreadystatechange = function() {		
						if (httpRequest.readyState == 4) {
							if (createTime == me.outerNode.lastRequest) {
								var xmlDocument = httpRequest.responseXML;
								if (me && me.outerNode && me.outerNode.children[0]) {
								
									var txt = xmlDocument.transformNode(xslDocument);	
									me.outerNode.children[0].innerHTML = txt;
									me.evalScripts(txt);
									
								}
							}
							if (handler) {
								handler(param, xmlDocument, httpRequest.status);
							}
							var refreshEvent = application.createEvent('HTMLiEvents');
							refreshEvent.initHTMLiEvent('refresh', me);
							me.dispatchEvent(refreshEvent);
						}
					};
					httpRequest.send('');					
				} else {
					var xml = me.getContainer().getElementById(me.getSrc());
					
					var onrefresh = function(p, xmlDocument, status) {
						if (!xml) {
							throw new Error("Source " +  me.getSrc() + " for XSL " + me.getId() + " doesn't exist");
						}	

						var e;
						try {
							var txt = xmlDocument.transformNode(xslDocument);	
							me.outerNode.children[0].innerHTML = txt;
							me.evalScripts(txt);
									
							var refreshEvent = application.createEvent('HTMLiEvents');
							refreshEvent.initHTMLiEvent('refresh', me);
							me.dispatchEvent(refreshEvent);
						} catch (e1) {
							e = e1;
						}
						if (handler) {
							handler(p, xmlDocument, status, e);
						}
					};
					
					if (refreshXml) {
						xml.get(onrefresh);
					} else {
						onrefresh(param, xml.getXmlDocument());
					}
					
				}		
				
				
			
			
			};				
		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:xsl="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.children[1].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:xsl="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.children[1].value;
				xsl += '</xslt:template></xslt:stylesheet>';
				var xslDocument = XmlDocument.create();
				xslDocument.async = false;
				xslDocument.loadXML(xsl);
				me.outerNode.children[0].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);
					
						
						/*var listeners = this._getListenersFor(event);
						for (var i=0; i < listeners.length; i++) {
							listeners[i]();
						}*/
						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();
				}	
			};
		
	
	com_htmli_xml_Xsl.prototype.evalScripts = function(txt) {
		var d = document.createElement('div');
		d.innerHTML = '<br>' + txt;
		
		var scripts = d.getElementsByTagName('script');
		var n = scripts.length;
		for (var i=0; i < n; i++) {
			eval(scripts[i].text);
		}		
	};
		
	