if(typeof(XML)=="undefined"){XML=function(){}}XML.ObjTree=function(){return this};XML.ObjTree.VERSION="0.24";XML.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n';XML.ObjTree.prototype.attr_prefix="-";XML.ObjTree.prototype.overrideMimeType="text/xml";XML.ObjTree.prototype.parseXML=function(c){var b;if(window.DOMParser){var a=new DOMParser();var d=a.parseFromString(c,"application/xml");if(!d){return}b=d.documentElement}else{if(window.ActiveXObject){a=new ActiveXObject("Microsoft.XMLDOM");a.async=false;a.loadXML(c);b=a.documentElement}}if(!b){return}return this.parseDOM(b)};XML.ObjTree.prototype.parseHTTP=function(b,j,h){var a={};for(var g in j){a[g]=j[g]}if(!a.method){if(typeof(a.postBody)=="undefined"&&typeof(a.postbody)=="undefined"&&typeof(a.parameters)=="undefined"){a.method="get"}else{a.method="post"}}if(h){a.asynchronous=true;var f=this;var c=h;var d=a.onComplete;a.onComplete=function(l){var k;if(l&&l.responseXML&&l.responseXML.documentElement){k=f.parseDOM(l.responseXML.documentElement)}else{if(l&&l.responseText){k=f.parseXML(l.responseText)}}c(k,l);if(d){d(l)}}}else{a.asynchronous=false}var i;if(typeof(HTTP)!="undefined"&&HTTP.Request){a.uri=b;var e=new HTTP.Request(a);if(e){i=e.transport}}else{if(typeof(Ajax)!="undefined"&&Ajax.Request){var e=new Ajax.Request(b,a);if(e){i=e.transport}}}if(h){return i}if(i&&i.responseXML&&i.responseXML.documentElement){return this.parseDOM(i.responseXML.documentElement)}else{if(i&&i.responseText){return this.parseXML(i.responseText)}}};XML.ObjTree.prototype.parseDOM=function(a){if(!a){return}this.__force_array={};if(this.force_array){for(var d=0;d<this.force_array.length;d++){this.__force_array[this.force_array[d]]=1}}var c=this.parseElement(a);if(this.__force_array[a.nodeName]){c=[c]}if(a.nodeType!=11){var b={};b[a.nodeName]=c;c=b}return c};XML.ObjTree.prototype.parseElement=function(e){if(e.nodeType==7){return}if(e.nodeType==3||e.nodeType==4){var f=e.nodeValue.match(/[^\x00-\x20]/);if(f==null){return}return e.nodeValue}var b;var d={};if(e.attributes&&e.attributes.length){b={};for(var g=0;g<e.attributes.length;g++){var j=e.attributes[g].nodeName;if(typeof(j)!="string"){continue}var c=e.attributes[g].nodeValue;if(!c){continue}j=this.attr_prefix+j;if(typeof(d[j])=="undefined"){d[j]=0}d[j]++;this.addNode(b,j,d[j],c)}}if(e.childNodes&&e.childNodes.length){var h=true;if(b){h=false}for(var g=0;g<e.childNodes.length&&h;g++){var a=e.childNodes[g].nodeType;if(a==3||a==4){continue}h=false}if(h){if(!b){b=""}for(var g=0;g<e.childNodes.length;g++){b+=e.childNodes[g].nodeValue}}else{if(!b){b={}}for(var g=0;g<e.childNodes.length;g++){var j=e.childNodes[g].nodeName;if(typeof(j)!="string"){continue}var c=this.parseElement(e.childNodes[g]);if(!c){continue}if(typeof(d[j])=="undefined"){d[j]=0}d[j]++;this.addNode(b,j,d[j],c)}}}return b};XML.ObjTree.prototype.addNode=function(c,a,b,d){if(this.__force_array[a]){if(b==1){c[a]=[]}c[a][c[a].length]=d}else{if(b==1){c[a]=d}else{if(b==2){c[a]=[c[a],d]}else{c[a][c[a].length]=d}}}};XML.ObjTree.prototype.writeXML=function(a){var b=this.hash_to_xml(null,a);return this.xmlDecl+b};XML.ObjTree.prototype.hash_to_xml=function(c,b){var f=[];var a=[];for(var e in b){if(!b.hasOwnProperty(e)){continue}var h=b[e];if(e.charAt(0)!=this.attr_prefix){if(typeof(h)=="undefined"||h==null){f[f.length]="<"+e+" />"}else{if(typeof(h)=="object"&&h.constructor==Array){f[f.length]=this.array_to_xml(e,h)}else{if(typeof(h)=="object"){f[f.length]=this.hash_to_xml(e,h)}else{f[f.length]=this.scalar_to_xml(e,h)}}}}else{a[a.length]=" "+(e.substring(1))+'="'+(this.xml_escape(h))+'"'}}var g=a.join("");var d=f.join("");if(typeof(c)=="undefined"||c==null){}else{if(f.length>0){if(d.match(/\n/)){d="<"+c+g+">\n"+d+"</"+c+">\n"}else{d="<"+c+g+">"+d+"</"+c+">\n"}}else{d="<"+c+g+" />\n"}}return d};XML.ObjTree.prototype.array_to_xml=function(b,e){var a=[];for(var c=0;c<e.length;c++){var d=e[c];if(typeof(d)=="undefined"||d==null){a[a.length]="<"+b+" />"}else{if(typeof(d)=="object"&&d.constructor==Array){a[a.length]=this.array_to_xml(b,d)}else{if(typeof(d)=="object"){a[a.length]=this.hash_to_xml(b,d)}else{a[a.length]=this.scalar_to_xml(b,d)}}}}return a.join("")};XML.ObjTree.prototype.scalar_to_xml=function(a,b){if(a=="#text"){return this.xml_escape(b)}else{return"<"+a+">"+this.xml_escape(b)+"</"+a+">\n"}};XML.ObjTree.prototype.xml_escape=function(a){return String(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};