if(typeof (XML)=="undefined"){XML=function(){}}XML.ObjTree=function(){return this};XML.ObjTree.VERSION="0.23";XML.ObjTree.prototype.xmlDecl='<?xml version="1.0" encoding="UTF-8" ?>\n';XML.ObjTree.prototype.attr_prefix="-";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)}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)}};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 I=E.attributes[G].nodeName;if(typeof (I)!="string"){continue}var C=E.attributes[G].nodeValue;if(!C){continue}I=this.attr_prefix+I;if(typeof (D[I])=="undefined"){D[I]=0}D[I]++;this.addNode(B,I,D[I],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 I=E.childNodes[G].nodeName;if(typeof (I)!="string"){continue}var C=this.parseElement(E.childNodes[G]);if(!C){continue}if(typeof (D[I])=="undefined"){D[I]=0}D[I]++;this.addNode(B,I,D[I],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 A.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};