Element.implement({
    innerXML: function(){
			var str = new String();
			if (this.childNodes.length) {
				str += '<' + this.tagName.toLowerCase() + this.attributs() + '>';
				// If the tag is a child node, we get it's content as XML, otherwise we get the text content
				for (var t=0; t<this.childNodes.length; t++) {
					if (this.childNodes[t].tagName) {
						var myElement = $(this.childNodes[t]);
						str += myElement.innerXML();
					}
					else {
						str += this.childNodes[t].nodeValue;
					}
				}
				// We close the element
				str += '</' + this.tagName.toLowerCase() + '>';
			}
			else {
				str += '<' + this.tagName.toLowerCase() + this.attributs() + ' />';
			}
			return str;
	},
	attributs: function() {
		var str = new String();
		for (var t=0; t<this.attributes.length; t++) {
			// Specific IE test to remove empty attributes (like most of events and attributes specific to IE)
			if (
				this.attributes[t].nodeValue 
				&& this.attributes[t].nodeValue != 'inherit' 
				&& this.attributes[t].nodeName != 'match' 
				&& this.attributes[t].nodeName != 'uid' 
				&& this.attributes[t].nodeName.indexOf('$') == -1 
				&& !this.attributes[t].nodeValue.prototype
				&& (typeof this.attributes[t].nodeValue == "string" && this.attributes[t].nodeValue.indexOf('function') == -1) 
				) {
				str += ' ' + this.attributes[t].nodeName.toLowerCase() + '="' + this.attributes[t].nodeValue + '"';
			}
		}
		return str;
	}

});

