var ntElement=1,ntAttribute=2,ntText=3,ntCData=4,ntComment=8,ntDocument=9,charCodes=[160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,338,339,352,353,376,402,710,732,
8211,8212,8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,8364,8482],specialChar=["&nbsp;","&iexcl;","&cent;","&pound;","&curren;","&yen;","&brvbar;","&sect;","&uml;","&copy;","&ordf;","&laquo;","&not;","&shy;","&reg;","&macr;","&deg;","&plusmn;","&sup2;","&sup3;","&acute;","&micro;","&para;","&middot;","&cedil;","&sup1;","&ordm;","&raquo;","&frac14;","&frac12;","&frac34;","&iquest;","&Agrave;","&Aacute;","&Acirc;","&Atilde;","&Auml;","&Aring;","&AElig;","&Ccedil;","&Egrave;","&Eacute;",
"&Ecirc;","&Euml;","&Igrave;","&Iacute;","&Icirc;","&Iuml;","&ETH;","&Ntilde;","&Ograve;","&Oacute;","&Ocirc;","&Otilde;","&Ouml;","&times;","&Oslash;","&Ugrave;","&Uacute;","&Ucirc;","&Uuml;","&Yacute;","&THORN;","&szlig;","&agrave;","&aacute;","&acirc;","&atilde;","&auml;","&aring;","&aelig;","&ccedil;","&egrave;","&eacute;","&ecirc;","&euml;","&igrave;","&iacute;","&icirc;","&iuml;","&eth;","&ntilde;","&ograve;","&oacute;","&ocirc;","&otilde;","&ouml;","&divide;","&oslash;","&ugrave;","&uacute;",
"&ucirc;","&uuml;","&yacute;","&thorn;","&yuml;"];specialChar[178]="&OElig;";specialChar[179]="&oelig;";specialChar[192]="&Scaron;";specialChar[193]="&scaron;";specialChar[216]="&Yuml;";specialChar[242]="&fnof;";specialChar[550]="&circ;";specialChar[572]="&tilde;";specialChar[8051]="&ndash;";specialChar[8052]="&mdash;";specialChar[8056]="&lsquo;";specialChar[8057]="&rsquo;";specialChar[8058]="&sbquo;";specialChar[8060]="&ldquo;";specialChar[8061]="&rdquo;";specialChar[8062]="&bdquo;";
specialChar[8064]="&dagger;";specialChar[8065]="&Dagger;";specialChar[8066]="&bull;";specialChar[8070]="&hellip;";specialChar[8080]="&permil;";specialChar[8089]="&lsaquo;";specialChar[8090]="&rsaquo;";specialChar[8204]="&euro;";specialChar[8322]="&trade;";
function toXml(a,b){if(typeof b!="undefined")switch(b){case dtBoolean:return a?"1":"0";case dtDateTime:return a.formatString("s");case dtDouble:case dtMoney:case dtPercentage:return a.formatString("0.0#########").replace(",",".");case dtInteger:case dtLong:break;case dtString:case dtGuid:a=a.replace(/\&/gi,"&amp;");a=a.replace(/\"/gi,"&quot;");a=a.replace(/\</gi,"&lt;");a=a.replace(/\>/gi,"&gt;");break;default:throw new Error('Illegal assignment to parameter "type" ('+b+").");}return a}
function fromXml(a,b){if(typeof a!="undefined"&&typeof a.firstChild!="undefined")a=a.firstChild?a.firstChild.data:null;if(a==null||String(a)=="")return null;switch(b){case dtBoolean:return String(a)=="0"||String(a).toLowerCase()=="false"||String(a).toLowerCase()=="no"?false:true;case dtDateTime:a=parseXmlDate(a);return isNaN(a)?null:a;case dtDouble:case dtMoney:case dtPercentage:a=parseFloat(a);return isNaN(a)?null:a;case dtInteger:case dtLong:a=parseInt(a);return isNaN(a)?null:a;case dtString:case dtGuid:a=
a.replace(/&amp;/gi,"&");a=a.replace(/&quot;/gi,'"');a=a.replace(/&lt;/gi,"<");return a=a.replace(/&gt;/gi,">");default:throw new Error('Illegal assignment to parameter "type" ('+b+").");}}
function parseXmlDate(a){if(/^(\d{4}-\d{2}-\d{2})(T\d{2}:\d{2}:\d{2}(\.\d{1,7})?)?$/i.test(a)){a=a.split(/[-T:\.]/g);for(var b=0;b<a.length;b++)for(;a[b].startsWith("0")&&String(a[b]).length>1;)a[b]=a[b].substr(1);b=parseInt(a[0]);month=parseInt(a[1]);day=parseInt(a[2]);hour=parseInt(a[3]);minute=parseInt(a[4]);second=parseInt(a[5]);if(isNaN(hour))hour=0;if(isNaN(minute))minute=0;if(isNaN(second))second=0;return new Date(b,month-1,day,hour,minute,second)}else return parseInt("knaag")}
function htmlEncode(a){var b;try{b=new String(a);b=b.replace(/&/g,"&amp;");for(var d=0;d<charCodes.length;d++){var c=charCodes[d],e=specialChar[c-160];b=b.replace(new RegExp(String.fromCharCode(c),"g"),"&amp;"+e.substr(1))}b=b.replace(/</g,"&lt;");b=b.replace(/>/g,"&gt;");b=b.replace(/"/g,"&quot;")}catch(f){try{b=a.join(", ")}catch(g){b=a}}return b}
function showXml(a,b){if(typeof b=="undefined"||b==null)b="";if(typeof a!="object"||typeof a.childNodes=="undefined")throw new Error("Illegal argument. First argument is not an XmlNode.");if(typeof a.documentElement!="undefined")a=a.documentElement;var d=String('<?xml version="1.0" encoding="utf-8"?>\r\n').length,c=window.open("","frmXML"+b,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=788,height=570");if(typeof Xml!="undefined"&&typeof Xml.toString=="function")d+=
Xml.toString(a).length;if(c){c.document.open();c.document.writeln("<html><head><title>Xml "+b+'</title></head><body style="font-family: Lucida Console, Courier New; font-size:11px; color:navy; margin:5px; background-color:white;">&lt;?xml version="1.0" encoding="Windows-1252"?&gt;');c.document.writeln(buildXml(a));if(typeof Xml!="undefined"&&typeof Xml.toString=="function")if(d<2048)c.document.writeln('<div style="clear:both; margin-top:10px; font-family:Verdana; color:black;"><b>XML size:</b> '+
d+" bytes</div></html>");else if(d/1024<2048)c.document.writeln('<div style="clear:both; margin-top:10px; font-family:Verdana; color:black;"><b>XML size:</b> '+Math.round(d/1024*100)/100+" kB</div></html>");else d/1024/1024<2048&&c.document.writeln('<div style="clear:both; margin-top:10px; font-family:Verdana; color:black;"><b>XML size:</b> '+Math.round(d/1024/1024*100)/100+" MB</div></html>");c.document.writeln("</body></html>");c.document.close();c.focus()}}
function nodeName(a){var b=a.nodeName;if(a.attributes)for(var d=0;d<a.attributes.length;d++){var c=a.attributes.item(d);if(c.nodeName!="xmlns:sql"&&c.value!="null"&&c.value!=""&&c.value!=null)b+=" "+c.nodeName+'=<font color="blue">"'+c.value.replace(/\"/g,"&amp;quot;")+'"</font>'}return b}
function buildXml(a,b){var d="";if(b==undefined)b="";if(a.childNodes.length){d+="<br/>"+b+"&lt;"+nodeName(a)+"&gt;";for(var c=0;c<a.childNodes.length;c++)d+=buildXml(a.childNodes[c],b+"&nbsp;&nbsp;&nbsp;");var e=a.childNodes.length;for(c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeType==ntText||a.childNodes[c].nodeType==ntCData)e--;if(e>0)d+="<br/>"+b;d+="&lt;/"+a.nodeName+"&gt;"}else if(a.nodeType==ntText){c=null;if(typeof a.value!="undefined")c=a.value;else if(typeof a.text!="undefined")c=
a.text;else if(typeof a.nodeValue!="undefined")c=a.nodeValue;if(typeof c!="undefined"&&c!=""&&c!=null)d+='<font color="black"><b>'+toXml(c,dtString).htmlEncode().replace(/[\r\n]/gi,"<br/>")+"</b></font>"}else if(a.nodeType==ntCData){c=null;if(typeof a.value!="undefined")c=a.value;else if(typeof a.text!="undefined")c=a.text;else if(typeof a.nodeValue!="undefined")c=a.nodeValue;d+='<font color="red">&lt;![CDATA[<br/><div style="margin-left:'+b.length/6*7+'px; padding-left:3px; border-left:1px solid #C00000;"><font color="black">';
d+=toXml(c,dtString).replace(/[\r\n]/gi,"<br/>").replace(/[\t]/gi,"&nbsp;&nbsp;&nbsp;");d+="</font><br/></div>"+b+"]]&gt;</font>"}else if(a.nodeType==ntElement)d+="<br/>"+b+"&lt;"+nodeName(a)+"/&gt;";return d};
