function addClass(n,t){return n?n.indexOf("|"+t+"|")<0&&(n+=t+"|"):n="|"+t+"|",n}function isEmpty(n){return n==null||n.length==0}function trim(n,t,i){if(isEmpty(n))return"";t==null&&(t=!0),i==null&&(i=!0);var u=0,f=0,e=0,r=0;if(t==!0)while(e<n.length&&whitespace.indexOf(n.charAt(e++))!=-1)u++;if(i==!0){r=n.length-1;while(r>=u&&whitespace.indexOf(n.charAt(r--))!=-1)f++}return n.substring(u,n.length-f)}function __escapeString(n){var u=/&/g,f=/</g,r=/>/g,t=/"/g,i=/'/g;return n=n.replace(u,"&amp;"),n=n.replace(f,"&lt;"),n=n.replace(r,"&gt;"),n=n.replace(t,"&quot;"),n=n.replace(i,"&apos;")}function __unescapeString(n){var u=/&amp;/g,f=/&lt;/g,r=/&gt;/g,t=/&quot;/g,i=/&apos;/g;return n=n.replace(u,"&"),n=n.replace(f,"<"),n=n.replace(r,">"),n=n.replace(t,'"'),n=n.replace(i,"'")}function convertEscapes(n){var t,i;t=-1;while(n.indexOf("&lt;",t+1)>-1)t=n.indexOf("&lt;",t+1),i=n.substr(0,t),i+="<",i=i+n.substr(t+4,n.length),n=i;t=-1;while(n.indexOf("&gt;",t+1)>-1)t=n.indexOf("&gt;",t+1),i=n.substr(0,t),i+=">",i=i+n.substr(t+4,n.length),n=i;t=-1;while(n.indexOf("&amp;",t+1)>-1)t=n.indexOf("&amp;",t+1),i=n.substr(0,t),i+="&",i=i+n.substr(t+5,n.length),n=i;return n}function convertToEscapes(n){var t=-1,i;while(n.indexOf("&",t+1)>-1)t=n.indexOf("&",t+1),i=n.substr(0,t),i+="&amp;",i=i+n.substr(t+1,n.length),n=i;t=-1;while(n.indexOf("<",t+1)>-1)t=n.indexOf("<",t+1),i=n.substr(0,t),i+="&lt;",i=i+n.substr(t+1,n.length),n=i;t=-1;while(n.indexOf(">",t+1)>-1)t=n.indexOf(">",t+1),i=n.substr(0,t),i+="&gt;",i=i+n.substr(t+1,n.length),n=i;return n}function _displayElement(n,t){var o,r,s,h,f,u,i,e;if(n==null)return;if(!(n.nodeType=="ELEMENT"))return;for(o=n.tagName,r="",r="<"+o,s=n.getAttributeNames(),u=0;u<s.length;u++)h=s[u],r=r+" "+h+"=",r=r+'"'+n.getAttribute(h)+'"';r=r+">",t=t+r;if(n.children!=null)for(f=n.children,u=0;u<f.length;u++)i=f[u],i.nodeType=="COMMENT"?t=t+"<!--"+i.content+"-->":i.nodeType=="TEXT"?(e=trim(i.content,!0,!0),t=t+i.content):i.nodeType=="CDATA"?(e=trim(i.content,!0,!0),t=t+"<![CDATA["+e+"]\]>"):t=_displayElement(i,t);return t=t+"</"+o+">"}function firstWhiteChar(n,t){if(isEmpty(n))return-1;while(t<n.length){if(whitespace.indexOf(n.charAt(t))!=-1)return t;t++}return n.length}function isEmpty(n){return n==null||n.length==0}function trim(n,t,i){if(isEmpty(n))return"";t==null&&(t=!0),i==null&&(i=!0);var u=0,f=0,e=0,r=0;if(t==!0)while(e<n.length&&whitespace.indexOf(n.charAt(e++))!=-1)u++;if(i==!0){r=n.length-1;while(r>=u&&whitespace.indexOf(n.charAt(r--))!=-1)f++}return n.substring(u,n.length-f)}function XMLDoc(n,t){return this.topNode=null,this.errFn=t,this.createXMLNode=_XMLDoc_createXMLNode,this.error=_XMLDoc_error,this.getUnderlyingXMLText=_XMLDoc_getUnderlyingXMLText,this.handleNode=_XMLDoc_handleNode,this.hasErrors=!1,this.insertNodeAfter=_XMLDoc_insertNodeAfter,this.insertNodeInto=_XMLDoc_insertNodeInto,this.loadXML=_XMLDoc_loadXML,this.parse=_XMLDoc_parse,this.parseAttribute=_XMLDoc_parseAttribute,this.parseDTD=_XMLDoc_parseDTD,this.parsePI=_XMLDoc_parsePI,this.parseTag=_XMLDoc_parseTag,this.removeNodeFromTree=_XMLDoc_removeNodeFromTree,this.replaceNodeContents=_XMLDoc_replaceNodeContents,this.selectNode=_XMLDoc_selectNode,this.selectNodeText=_XMLDoc_selectNodeText,this.source=n,this.parse()?this.topNode!=null?this.error("expected close "+this.topNode.tagName):!0:void 0}function _XMLDoc_createXMLNode(n){return new XMLDoc(n,this.errFn).docNode}function _XMLDoc_error(n){this.hasErrors=!0;if(this.errFn)this.errFn("ERROR: "+n);else if(this.onerror)this.onerror("ERROR: "+n);return 0}function _XMLDoc_getTagNameParams(n,t){var r=-1,u,f=n.indexOf("["),i=[];return f<0||(u=n.indexOf("]"),u<0?t.error("expected ] near "+n):r=n.substr(f+1,u-f-1),n=n.substr(0,f),isNaN(r)&&r!="*"?(i=r.substr(1,r.length-1),i=i.split("="),i[1]&&(f=i[1].indexOf('"'),i[1]=i[1].substr(f+1,i[1].length-1),u=i[1].indexOf('"'),u<0?t.error('expected " near '+n):i[1]=i[1].substr(0,u)),r=-1):r=="*"&&(r=-1)),[n,r,i[0],i[1]]}function _XMLDoc_getUnderlyingXMLText(){var n="";return n=n+'<?xml version="1.0"?>',this.docNode==null?void 0:n=_displayElement(this.docNode,n)}function _XMLDoc_handleNode(n){if(n.nodeType=="COMMENT"&&this.topNode!=null)return this.topNode.addElement(n);if(n.nodeType=="TEXT"||n.nodeType=="CDATA")return this.topNode==null?trim(n.content,!0,!1)==""?!0:this.error("expected document node, found: "+n):this.topNode.addElement(n);if(n.nodeType=="OPEN"||n.nodeType=="SINGLE"){var t=!1;return this.topNode==null?(this.docNode=n,n.parent=null,t=!0):t=this.topNode.addElement(n),t&&n.nodeType!="SINGLE"&&(this.topNode=n),n.nodeType="ELEMENT",t}if(n.nodeType=="CLOSE"){if(this.topNode==null)return this.error("close tag without open: "+n.toString());if(n.tagName!=this.topNode.tagName)return this.error("expected closing "+this.topNode.tagName+", found closing "+n.tagName);this.topNode=this.topNode.getParent()}return!0}function _XMLDoc_insertNodeAfter(n,t){var r=this.getUnderlyingXMLText(),f=n.getUnderlyingXMLText(),e=r.indexOf(f)+f.length,i=r.substr(0,e),u;return i+=t.getUnderlyingXMLText(),i+=r.substr(e),u=new XMLDoc(i,this.errFn)}function _XMLDoc_insertNodeInto(n,t){var r=this.getUnderlyingXMLText(),e=n.getUnderlyingXMLText(),o=e.indexOf(">")+1,f=r.indexOf(e)+o,i=r.substr(0,f),u;return i+=t.getUnderlyingXMLText(),i+=r.substr(f),u=new XMLDoc(i,this.errFn)}function _XMLDoc_loadXML(n){return this.topNode=null,this.hasErrors=!1,this.source=n,this.parse()}function _XMLDoc_parse(){var n=0,i,f;err=!1;while(!err){var r="",t=this.source.indexOf("<",n),o=1,e,u;if(t==-1)break;e=t,i=this.source.substring(n,e),i.length!=0&&(err=!this.handleNode(new XMLNode("TEXT",this,i)));if(t==this.source.indexOf("<?",n)){n=this.parsePI(this.source,n+2),n==0&&(err=!0);continue}if(t==this.source.indexOf("<!DOCTYPE",n)){n=this.parseDTD(this.source,t+9),n==0&&(err=!0);continue}t==this.source.indexOf("<!--",n)&&(o=4,r="--"),t==this.source.indexOf("<![CDATA[",n)&&(o=9,r="]]"),t=this.source.indexOf(r+">",t);if(t==-1)return this.error("expected closing tag sequence: "+r+">");u=t+r.length,i=this.source.substring(e+1,u),f=this.parseTag(i),f&&(err=!this.handleNode(f)),n=u+1}return!err}function _XMLDoc_parseAttribute(n,t,i){var u,r,e,f;while(t<n.length&&whitespace.indexOf(n.charAt(t))!=-1)t++;if(t>=n.length)return t;u=t;while(t<n.length&&n.charAt(t)!="=")t++;r="attributes must have values";if(t>=n.length)return this.error(r);e=trim(n.substring(u,t++),!1,!0);while(t<n.length&&whitespace.indexOf(n.charAt(t))!=-1)t++;if(t>=n.length)return this.error(r);r="attribute values must be in quotes",f=n.charAt(t++);if(quotes.indexOf(f)==-1)return this.error(r);u=t;while(t<n.length&&n.charAt(t)!=f)t++;return t>=n.length?this.error(r):i.addAttribute(e,trim(n.substring(u,t++),!1,!0))?t:0}function _XMLDoc_parseDTD(n,t){var f=n.indexOf(">",t),i,u,r;if(f==-1)return this.error("error in DTD: expected '>'");i="",u=n.indexOf("[",t),u!=-1&&u<f&&(i="]");for(;;){r=n.indexOf(i+">",t);if(r==-1)return this.error("expected closing tag sequence: "+i+">");t=r+i.length+1;if(n.substring(r-1,r+2)!="]\]>")break}return t}function _XMLDoc_parsePI(n,t){var i=n.indexOf("?>",t);return i+2}function _XMLDoc_parseTag(n){var t,r,i;if(n.indexOf("!--")==0)return new XMLNode("COMMENT",this,n.substring(3,n.length-2));if(n.indexOf("![CDATA[")==0)return new XMLNode("CDATA",this,n.substring(8,n.length-2));t=new XMLNode,t.doc=this,n.charAt(0)=="/"?(t.nodeType="CLOSE",n=n.substring(1)):t.nodeType="OPEN";if(n.charAt(n.length-1)=="/"){if(t.nodeType=="CLOSE")return this.error("singleton close tag");t.nodeType="SINGLE",n=n.substring(0,n.length-1)}t.nodeType!="CLOSE"&&(t.attributes=[]),t.nodeType=="OPEN"&&(t.children=[]),n=trim(n,!0,!0);if(n.length==0)return this.error("empty tag");r=firstWhiteChar(n,0);if(r==-1)return t.tagName=n,t;t.tagName=n.substring(0,r),i=r;while(i<n.length){i=this.parseAttribute(n,i,t);if(this.pos==0)return null}return t}function _XMLDoc_removeNodeFromTree(n){var t=this.getUnderlyingXMLText(),u=n.getUnderlyingXMLText(),f=t.indexOf(u),i=t.substr(0,f),r;return i+=t.substr(f+u.length),r=new XMLDoc(i,this.errFn)}function _XMLDoc_replaceNodeContents(n,t){var i=this.createXMLNode("<X>"+t+"</X>");return n.children=i.children,this}function _XMLDoc_selectNode(n){var f,t,i,u,e,l,h,s,c,o,r;n=trim(n,!0,!0),f=t=this.source?this.docNode:this;if(!n)return t;n.indexOf("/")==0&&(n=n.substr(1)),n=n.replace(i,""),h=n.split("/"),i=h[0];if(i){n.indexOf("/")==0&&(n=n.substr(1)),n=n.replace(i,""),u=_XMLDoc_getTagNameParams(i,this),i=u[0],e=u[1],s=u[2],c=u[3],t=i=="*"?t.getElements():t.getElements(i);if(t.length)if(e<0){f=t,r=0;while(r<f.length){o=s?f[r].getAttribute(s)!=c?!1:!0:!0;if(o){t=f[r].selectNode(n);if(t)return t}r++}}else if(e<t.length){t=t[e].selectNode(n);if(t)return t}}}function _XMLDoc_selectNodeText(n){var t=this.selectNode(n);return t!=null?t.getText():null}function XMLNode(n,t,i){this.content=n=="TEXT"||n=="CDATA"||n=="COMMENT"?i:null,this.attributes=null,this.children=null,this.doc=t,this.nodeType=n,this.parent="",this.tagName="",this.addAttribute=_XMLNode_addAttribute,this.addElement=_XMLNode_addElement,this.getAttribute=_XMLNode_getAttribute,this.getAttributeNames=_XMLNode_getAttributeNames,this.getElementById=_XMLNode_getElementById,this.getElements=_XMLNode_getElements,this.getText=_XMLNode_getText,this.getParent=_XMLNode_getParent,this.getUnderlyingXMLText=_XMLNode_getUnderlyingXMLText,this.removeAttribute=_XMLNode_removeAttribute,this.selectNode=_XMLDoc_selectNode,this.selectNodeText=_XMLDoc_selectNodeText,this.toString=_XMLNode_toString}function _XMLNode_addAttribute(n,t){return this.attributes["_"+n]=t,!0}function _XMLNode_addElement(n){return n.parent=this,this.children[this.children.length]=n,!0}function _XMLNode_getAttribute(n){return this.attributes==null?null:this.attributes["_"+n]}function _XMLNode_getAttributeNames(){var i,n,t;if(this.attributes==null)return i=[];n=[];for(t in this.attributes)n[n.length]=t.substring(1);return n}function _XMLNode_getElementById(n){var r=this,u,i,t,f;if(r.getAttribute("id")==n)return r;i=r.getElements(),t=0;while(t<i.length){f=i[t],u=f.getElementById(n);if(u!=null)break;t++}return u}function _XMLNode_getElements(n){var r,i,t;if(this.children==null)return r=[];for(i=[],t=0;t<this.children.length;t++)this.children[t].nodeType=="ELEMENT"&&(n==null||this.children[t].tagName==n)&&(i[i.length]=this.children[t]);return i}function _XMLNode_getText(){var i,n,t;if(this.nodeType=="ELEMENT"){if(this.children==null)return null;for(i="",n=0;n<this.children.length;n++)t=this.children[n].getText(),i+=t==null?"":t;return i}return this.nodeType=="TEXT"?convertEscapes(this.content):this.content}function _XMLNode_getParent(){return this.parent}function _XMLNode_getUnderlyingXMLText(){var n="";return n=_displayElement(this,n)}function _XMLNode_removeAttribute(n){if(n==null)return this.doc.error("You must pass an attribute name into the removeAttribute function");var t=this.getAttributeNames(),r=t.length,i=[];for(intLoop=0;intLoop<r;intLoop++)i[intLoop]=this.getAttribute(t[intLoop]);for(this.attributes=[],intLoop=0;intLoop<r;intLoop++)t[intLoop]!=n&&this.addAttribute(t[intLoop],i[intLoop]);return!0}function _XMLNode_toString(){return""+this.nodeType+":"+(this.nodeType=="TEXT"||this.nodeType=="CDATA"||this.nodeType=="COMMENT"?this.content:this.tagName)}var whitespace,quotes;DOMException=function(n){this._class=addClass(this._class,"DOMException"),this.code=n},DOMException.INDEX_SIZE_ERR=1,DOMException.DOMSTRING_SIZE_ERR=2,DOMException.HIERARCHY_REQUEST_ERR=3,DOMException.WRONG_DOCUMENT_ERR=4,DOMException.INVALID_CHARACTER_ERR=5,DOMException.NO_DATA_ALLOWED_ERR=6,DOMException.NO_MODIFICATION_ALLOWED_ERR=7,DOMException.NOT_FOUND_ERR=8,DOMException.NOT_SUPPORTED_ERR=9,DOMException.INUSE_ATTRIBUTE_ERR=10,DOMException.INVALID_STATE_ERR=11,DOMException.SYNTAX_ERR=12,DOMException.INVALID_MODIFICATION_ERR=13,DOMException.NAMESPACE_ERR=14,DOMException.INVALID_ACCESS_ERR=15,DOMImplementation=function(){this._class=addClass(this._class,"DOMImplementation"),this._p=null,this.preserveWhiteSpace=!1,this.namespaceAware=!0,this.errorChecking=!0},DOMImplementation.prototype.escapeString=function(n){return __escapeString(n)},DOMImplementation.prototype.unescapeString=function(n){return __unescapeString(n)},DOMImplementation.prototype.hasFeature=function(n,t){var i=!1;return n.toLowerCase()=="xml"?i=!t||t=="1.0"||t=="2.0":n.toLowerCase()=="core"&&(i=!t||t=="2.0"),i},DOMImplementation.prototype.loadXML=function(n){var i,t;try{i=new XMLP(n)}catch(r){alert("Error Creating the SAX Parser. Did you include xmlsax.js or tinyxmlsax.js in your web page?\nThe SAX parser is needed to populate XML for <SCRIPT>'s W3C DOM Parser with data.")}return t=new DOMDocument(this),this._parseLoop(t,i),t._parseComplete=!0,t},DOMImplementation.prototype.translateErrCode=function(n){var t="";switch(n){case DOMException.INDEX_SIZE_ERR:t="INDEX_SIZE_ERR: Index out of bounds";break;case DOMException.DOMSTRING_SIZE_ERR:t="DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a DOMString";break;case DOMException.HIERARCHY_REQUEST_ERR:t="HIERARCHY_REQUEST_ERR: The Node can not be inserted at this location";break;case DOMException.WRONG_DOCUMENT_ERR:t="WRONG_DOCUMENT_ERR: The source and the destination Documents are not the same";break;case DOMException.INVALID_CHARACTER_ERR:t="INVALID_CHARACTER_ERR: The string contains an invalid character";break;case DOMException.NO_DATA_ALLOWED_ERR:t="NO_DATA_ALLOWED_ERR: This Node / NodeList does not support data";break;case DOMException.NO_MODIFICATION_ALLOWED_ERR:t="NO_MODIFICATION_ALLOWED_ERR: This object cannot be modified";break;case DOMException.NOT_FOUND_ERR:t="NOT_FOUND_ERR: The item cannot be found";break;case DOMException.NOT_SUPPORTED_ERR:t="NOT_SUPPORTED_ERR: This implementation does not support function";break;case DOMException.INUSE_ATTRIBUTE_ERR:t="INUSE_ATTRIBUTE_ERR: The Attribute has already been assigned to another Element";break;case DOMException.INVALID_STATE_ERR:t="INVALID_STATE_ERR: The object is no longer usable";break;case DOMException.SYNTAX_ERR:t="SYNTAX_ERR: Syntax error";break;case DOMException.INVALID_MODIFICATION_ERR:t="INVALID_MODIFICATION_ERR: Cannot change the type of the object";break;case DOMException.NAMESPACE_ERR:t="NAMESPACE_ERR: The namespace declaration is incorrect";break;case DOMException.INVALID_ACCESS_ERR:t="INVALID_ACCESS_ERR: The object does not support this function";break;default:t="UNKNOWN: Unknown Exception Code ("+n+")"}return t},DOMImplementation.prototype._parseLoop=function(n,t){var o,i,f,u,s,h,g,r,w,e,nt,v,d,tt,a,c,b,y,l;iNodeParent=n;var it=0,p=[],k=[];this.namespaceAware&&(s=n.createNamespace(""),s.setValue("http://www.w3.org/2000/xmlns/"),n._namespaces.setNamedItem(s));for(;;){o=t.next();if(o==XMLP._ELM_B){h=t.getName(),h=trim(h,!0,!0);if(this.namespaceAware){for(i=n.createElementNS("",t.getName()),i._namespaces=iNodeParent._namespaces._cloneNodes(i),r=0;r<t.getAttributeCount();r++)u=t.getAttributeName(r),this._isNamespaceDeclaration(u)?(g=this._parseNSName(u),s=u!="xmlns"?n.createNamespace(u):n.createNamespace(""),s.setValue(t.getAttributeValue(r)),i._namespaces.setNamedItem(s)):(f=i.getAttributeNode(u),f||(f=n.createAttributeNS("",u)),f.setValue(t.getAttributeValue(r)),i.setAttributeNodeNS(f),this._isIdDeclaration(u)&&(i.id=t.getAttributeValue(r)));for(i._namespaces.getNamedItem(i.prefix)&&(i.namespaceURI=i._namespaces.getNamedItem(i.prefix).value),r=0;r<i.attributes.length;r++)i.attributes.item(r).prefix!=""&&i._namespaces.getNamedItem(i.attributes.item(r).prefix)&&(i.attributes.item(r).namespaceURI=i._namespaces.getNamedItem(i.attributes.item(r).prefix).value)}else for(i=n.createElement(t.getName()),r=0;r<t.getAttributeCount();r++)u=t.getAttributeName(r),f=i.getAttributeNode(u),f||(f=n.createAttribute(u)),f.setValue(t.getAttributeValue(r)),i.setAttributeNode(f);iNodeParent.nodeType==DOMNode.DOCUMENT_NODE&&(iNodeParent.documentElement=i),iNodeParent.appendChild(i),iNodeParent=i}else if(o==XMLP._ELM_E)iNodeParent=iNodeParent.parentNode;else if(o==XMLP._ELM_EMP){h=t.getName(),h=trim(h,!0,!0);if(this.namespaceAware){for(i=n.createElementNS("",t.getName()),i._namespaces=iNodeParent._namespaces._cloneNodes(i),r=0;r<t.getAttributeCount();r++)u=t.getAttributeName(r),this._isNamespaceDeclaration(u)?(g=this._parseNSName(u),s=u!="xmlns"?n.createNamespace(u):n.createNamespace(""),s.setValue(t.getAttributeValue(r)),i._namespaces.setNamedItem(s)):(f=i.getAttributeNode(u),f||(f=n.createAttributeNS("",u)),f.setValue(t.getAttributeValue(r)),i.setAttributeNodeNS(f),this._isIdDeclaration(u)&&(i.id=t.getAttributeValue(r)));for(i._namespaces.getNamedItem(i.prefix)&&(i.namespaceURI=i._namespaces.getNamedItem(i.prefix).value),r=0;r<i.attributes.length;r++)i.attributes.item(r).prefix!=""&&i._namespaces.getNamedItem(i.attributes.item(r).prefix)&&(i.attributes.item(r).namespaceURI=i._namespaces.getNamedItem(i.attributes.item(r).prefix).value)}else for(i=n.createElement(h),r=0;r<t.getAttributeCount();r++)u=t.getAttributeName(r),f=i.getAttributeNode(u),f||(f=n.createAttribute(u)),f.setValue(t.getAttributeValue(r)),i.setAttributeNode(f);iNodeParent.nodeType==DOMNode.DOCUMENT_NODE&&(iNodeParent.documentElement=i),iNodeParent.appendChild(i)}else if(o==XMLP._TEXT||o==XMLP._ENTITY)e=t.getContent().substring(t.getContentBegin(),t.getContentEnd()),this.preserveWhiteSpace||trim(e,!0,!0)==""&&(e=""),e.length>0&&(w=n.createTextNode(e),iNodeParent.appendChild(w),o==XMLP._ENTITY?p[p.length]=w:k[k.length]=w);else if(o==XMLP._PI)iNodeParent.appendChild(n.createProcessingInstruction(t.getName(),t.getContent().substring(t.getContentBegin(),t.getContentEnd())));else if(o==XMLP._CDATA)e=t.getContent().substring(t.getContentBegin(),t.getContentEnd()),this.preserveWhiteSpace||(e=trim(e,!0,!0),e.replace(/ +/g," ")),e.length>0&&iNodeParent.appendChild(n.createCDATASection(e));else if(o==XMLP._COMMENT)e=t.getContent().substring(t.getContentBegin(),t.getContentEnd()),this.preserveWhiteSpace||(e=trim(e,!0,!0),e.replace(/ +/g," ")),e.length>0&&iNodeParent.appendChild(n.createComment(e));else if(o!=XMLP._DTD)if(o==XMLP._ERROR)throw new DOMException(DOMException.SYNTAX_ERR);else if(o==XMLP._NONE)if(iNodeParent==n)break;else throw new DOMException(DOMException.SYNTAX_ERR);}for(b=p.length,intLoop=0;intLoop<b;intLoop++){nt=p[intLoop],v=nt.getParentNode();if(v){v.normalize();if(!this.preserveWhiteSpace)for(d=v.getChildNodes(),tt=d.getLength(),intLoop2=0;intLoop2<tt;intLoop2++)a=d.item(intLoop2),a.getNodeType()==DOMNode.TEXT_NODE&&(c=a.getData(),c=trim(c,!0,!0),c.replace(/ +/g," "),a.setData(c))}}if(!this.preserveWhiteSpace)for(b=k.length,intLoop=0;intLoop<b;intLoop++)y=k[intLoop],y.getParentNode()!=null&&(l=y.getData(),l=trim(l,!0,!0),l.replace(/ +/g," "),y.setData(l))},DOMImplementation.prototype._isNamespaceDeclaration=function(n){return n.indexOf("xmlns")>-1},DOMImplementation.prototype._isIdDeclaration=function(n){return n.toLowerCase()=="id"},DOMImplementation.prototype._isValidName=function(n){return n.match(re_validName)},re_validName=/^[a-zA-Z_:][a-zA-Z0-9\.\-_:]*$/,DOMImplementation.prototype._isValidString=function(n){return n.search(re_invalidStringChars)<0},re_invalidStringChars=/\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x0B|\x0C|\x0E|\x0F|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1A|\x1B|\x1C|\x1D|\x1E|\x1F|\x7F/,DOMImplementation.prototype._parseNSName=function(n){var t={};return t.prefix=n,t.namespaceName="",delimPos=n.indexOf(":"),delimPos>-1&&(t.prefix=n.substring(0,delimPos),t.namespaceName=n.substring(delimPos+1,n.length)),t},DOMImplementation.prototype._parseQName=function(n){var t={};return t.localName=n,t.prefix="",delimPos=n.indexOf(":"),delimPos>-1&&(t.prefix=n.substring(0,delimPos),t.localName=n.substring(delimPos+1,n.length)),t},DOMNodeList=function(n,t){this._class=addClass(this._class,"DOMNodeList"),this._nodes=[],this.length=0,this.parentNode=t,this.ownerDocument=n,this._readonly=!1},DOMNodeList.prototype.getLength=function(){return this.length},DOMNodeList.prototype.item=function(n){var t=null;return n>=0&&n<this._nodes.length&&(t=this._nodes[n]),t},DOMNodeList.prototype._findItemIndex=function(n){var i=-1,t;if(n>-1)for(t=0;t<this._nodes.length;t++)if(this._nodes[t]._id==n){i=t;break}return i},DOMNodeList.prototype._insertBefore=function(n,t){if(t>=0&&t<this._nodes.length){var i=[];i=this._nodes.slice(0,t),n.nodeType==DOMNode.DOCUMENT_FRAGMENT_NODE?i=i.concat(n.childNodes._nodes):i[i.length]=n,this._nodes=i.concat(this._nodes.slice(t)),this.length=this._nodes.length}},DOMNodeList.prototype._replaceChild=function(n,t){var r=null,i;return t>=0&&t<this._nodes.length&&(r=this._nodes[t],n.nodeType==DOMNode.DOCUMENT_FRAGMENT_NODE?(i=[],i=this._nodes.slice(0,t),i=i.concat(n.childNodes._nodes),this._nodes=i.concat(this._nodes.slice(t+1))):this._nodes[t]=n),r},DOMNodeList.prototype._removeChild=function(n){var i=null,t;return n>-1&&(i=this._nodes[n],t=[],t=this._nodes.slice(0,n),this._nodes=t.concat(this._nodes.slice(n+1)),this.length=this._nodes.length),i},DOMNodeList.prototype._appendChild=function(n){n.nodeType==DOMNode.DOCUMENT_FRAGMENT_NODE?this._nodes=this._nodes.concat(n.childNodes._nodes):this._nodes[this._nodes.length]=n,this.length=this._nodes.length},DOMNodeList.prototype._cloneNodes=function(n,t){for(var r=new DOMNodeList(this.ownerDocument,t),i=0;i<this._nodes.length;i++)r._appendChild(this._nodes[i].cloneNode(n));return r},DOMNodeList.prototype.toString=function(){for(var t="",n=0;n<this.length;n++)t+=this._nodes[n].toString();return t},DOMNamedNodeMap=function(n,t){this._class=addClass(this._class,"DOMNamedNodeMap"),this.DOMNodeList=DOMNodeList,this.DOMNodeList(n,t)},DOMNamedNodeMap.prototype=new DOMNodeList,DOMNamedNodeMap.prototype.getNamedItem=function(n){var i=null,t=this._findNamedItemIndex(n);return t>-1&&(i=this._nodes[t]),i},DOMNamedNodeMap.prototype.setNamedItem=function(n){if(this.ownerDocument.implementation.errorChecking){if(this.ownerDocument!=n.ownerDocument)throw new DOMException(DOMException.WRONG_DOCUMENT_ERR);if(this._readonly||this.parentNode&&this.parentNode._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(n.ownerElement&&n.ownerElement!=this.parentNode)throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR);}var i=this._findNamedItemIndex(n.name),t=null;if(i>-1){t=this._nodes[i];if(this.ownerDocument.implementation.errorChecking&&t._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);else this._nodes[i]=n}else this._nodes[this.length]=n;return this.length=this._nodes.length,n.ownerElement=this.parentNode,t},DOMNamedNodeMap.prototype.removeNamedItem=function(n){var r=null,t,i;if(this.ownerDocument.implementation.errorChecking&&(this._readonly||this.parentNode&&this.parentNode._readonly))throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);t=this._findNamedItemIndex(n);if(this.ownerDocument.implementation.errorChecking&&t<0)throw new DOMException(DOMException.NOT_FOUND_ERR);i=this._nodes[t];if(this.ownerDocument.implementation.errorChecking&&i._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);return this._removeChild(t)},DOMNamedNodeMap.prototype.getNamedItemNS=function(n,t){var r=null,i=this._findNamedItemNSIndex(n,t);return i>-1&&(r=this._nodes[i]),r},DOMNamedNodeMap.prototype.setNamedItemNS=function(n){if(this.ownerDocument.implementation.errorChecking){if(this._readonly||this.parentNode&&this.parentNode._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(this.ownerDocument!=n.ownerDocument)throw new DOMException(DOMException.WRONG_DOCUMENT_ERR);if(n.ownerElement&&n.ownerElement!=this.parentNode)throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR);}var i=this._findNamedItemNSIndex(n.namespaceURI,n.localName),t=null;if(i>-1){t=this._nodes[i];if(this.ownerDocument.implementation.errorChecking&&t._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);else this._nodes[i]=n}else this._nodes[this.length]=n;return this.length=this._nodes.length,n.ownerElement=this.parentNode,t},DOMNamedNodeMap.prototype.removeNamedItemNS=function(n,t){var u=null,i,r;if(this.ownerDocument.implementation.errorChecking&&(this._readonly||this.parentNode&&this.parentNode._readonly))throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);i=this._findNamedItemNSIndex(n,t);if(this.ownerDocument.implementation.errorChecking&&i<0)throw new DOMException(DOMException.NOT_FOUND_ERR);r=this._nodes[i];if(this.ownerDocument.implementation.errorChecking&&r._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);return this._removeChild(i)},DOMNamedNodeMap.prototype._findNamedItemIndex=function(n){for(var i=-1,t=0;t<this._nodes.length;t++)if(this._nodes[t].name==n){i=t;break}return i},DOMNamedNodeMap.prototype._findNamedItemNSIndex=function(n,t){var r=-1,i;if(t)for(i=0;i<this._nodes.length;i++)if(this._nodes[i].namespaceURI==n&&this._nodes[i].localName==t){r=i;break}return r},DOMNamedNodeMap.prototype._hasAttribute=function(n){var t=!1,i=this._findNamedItemIndex(n);return i>-1&&(t=!0),t},DOMNamedNodeMap.prototype._hasAttributeNS=function(n,t){var i=!1,r=this._findNamedItemNSIndex(n,t);return r>-1&&(i=!0),i},DOMNamedNodeMap.prototype._cloneNodes=function(n){for(var i=new DOMNamedNodeMap(this.ownerDocument,n),t=0;t<this._nodes.length;t++)i._appendChild(this._nodes[t].cloneNode(!1));return i},DOMNamedNodeMap.prototype.toString=function(){for(var t="",n=0;n<this.length-1;n++)t+=this._nodes[n].toString()+" ";return this.length>0&&(t+=this._nodes[this.length-1].toString()),t},DOMNamespaceNodeMap=function(n,t){this._class=addClass(this._class,"DOMNamespaceNodeMap"),this.DOMNamedNodeMap=DOMNamedNodeMap,this.DOMNamedNodeMap(n,t)},DOMNamespaceNodeMap.prototype=new DOMNamedNodeMap,DOMNamespaceNodeMap.prototype._findNamedItemIndex=function(n){for(var i=-1,t=0;t<this._nodes.length;t++)if(this._nodes[t].localName==n){i=t;break}return i},DOMNamespaceNodeMap.prototype._cloneNodes=function(n){for(var i=new DOMNamespaceNodeMap(this.ownerDocument,n),t=0;t<this._nodes.length;t++)i._appendChild(this._nodes[t].cloneNode(!1));return i},DOMNamespaceNodeMap.prototype.toString=function(){for(var i="",t,n=0;n<this._nodes.length;n++){t=null;try{t=this.parentNode.parentNode._namespaces.getNamedItem(this._nodes[n].localName)}catch(r){break}t&&""+t.nodeValue==""+this._nodes[n].nodeValue||(i+=this._nodes[n].toString()+" ")}return i},DOMNode=function(n){this._class=addClass(this._class,"DOMNode"),n&&(this._id=n._genId()),this.namespaceURI="",this.prefix="",this.localName="",this.nodeName="",this.nodeValue="",this.nodeType=0,this.parentNode=null,this.childNodes=new DOMNodeList(n,this),this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.attributes=new DOMNamedNodeMap(n,this),this.ownerDocument=n,this._namespaces=new DOMNamespaceNodeMap(n,this),this._readonly=!1},DOMNode.ELEMENT_NODE=1,DOMNode.ATTRIBUTE_NODE=2,DOMNode.TEXT_NODE=3,DOMNode.CDATA_SECTION_NODE=4,DOMNode.ENTITY_REFERENCE_NODE=5,DOMNode.ENTITY_NODE=6,DOMNode.PROCESSING_INSTRUCTION_NODE=7,DOMNode.COMMENT_NODE=8,DOMNode.DOCUMENT_NODE=9,DOMNode.DOCUMENT_TYPE_NODE=10,DOMNode.DOCUMENT_FRAGMENT_NODE=11,DOMNode.NOTATION_NODE=12,DOMNode.NAMESPACE_NODE=13,DOMNode.prototype.hasAttributes=function(){return this.attributes.length==0?!1:!0},DOMNode.prototype.getNodeName=function(){return this.nodeName},DOMNode.prototype.getNodeValue=function(){return this.nodeValue},DOMNode.prototype.setNodeValue=function(n){if(this.ownerDocument.implementation.errorChecking&&this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);this.nodeValue=n},DOMNode.prototype.getNodeType=function(){return this.nodeType},DOMNode.prototype.getParentNode=function(){return this.parentNode},DOMNode.prototype.getChildNodes=function(){return this.childNodes},DOMNode.prototype.getFirstChild=function(){return this.firstChild},DOMNode.prototype.getLastChild=function(){return this.lastChild},DOMNode.prototype.getPreviousSibling=function(){return this.previousSibling},DOMNode.prototype.getNextSibling=function(){return this.nextSibling},DOMNode.prototype.getAttributes=function(){return this.attributes},DOMNode.prototype.getOwnerDocument=function(){return this.ownerDocument},DOMNode.prototype.getNamespaceURI=function(){return this.namespaceURI},DOMNode.prototype.getPrefix=function(){return this.prefix},DOMNode.prototype.setPrefix=function(n){if(this.ownerDocument.implementation.errorChecking){if(this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(!this.ownerDocument.implementation._isValidName(n))throw new DOMException(DOMException.INVALID_CHARACTER_ERR);if(!this.ownerDocument._isValidNamespace(this.namespaceURI,n+":"+this.localName))throw new DOMException(DOMException.NAMESPACE_ERR);if(n=="xmlns"&&this.namespaceURI!="http://www.w3.org/2000/xmlns/")throw new DOMException(DOMException.NAMESPACE_ERR);if(n==""&&this.localName=="xmlns")throw new DOMException(DOMException.NAMESPACE_ERR);}this.prefix=n,this.nodeName=this.prefix!=""?this.prefix+":"+this.localName:this.localName},DOMNode.prototype.getLocalName=function(){return this.localName},DOMNode.prototype.insertBefore=function(n,t){var i,f,u,r;if(this.ownerDocument.implementation.errorChecking){if(this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(this.ownerDocument!=n.ownerDocument)throw new DOMException(DOMException.WRONG_DOCUMENT_ERR);if(this._isAncestor(n))throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR);}if(t){f=this.childNodes._findItemIndex(t._id);if(this.ownerDocument.implementation.errorChecking&&f<0)throw new DOMException(DOMException.NOT_FOUND_ERR);u=n.parentNode,u&&u.removeChild(n),this.childNodes._insertBefore(n,this.childNodes._findItemIndex(t._id)),i=t.previousSibling;if(n.nodeType==DOMNode.DOCUMENT_FRAGMENT_NODE){if(n.childNodes._nodes.length>0){for(r=0;r<n.childNodes._nodes.length;r++)n.childNodes._nodes[r].parentNode=this;t.previousSibling=n.childNodes._nodes[n.childNodes._nodes.length-1]}}else n.parentNode=this,t.previousSibling=n}else i=this.lastChild,this.appendChild(n);return n.nodeType==DOMNode.DOCUMENT_FRAGMENT_NODE?n.childNodes._nodes.length>0&&(i?i.nextSibling=n.childNodes._nodes[0]:this.firstChild=n.childNodes._nodes[0],n.childNodes._nodes[0].previousSibling=i,n.childNodes._nodes[n.childNodes._nodes.length-1].nextSibling=t):(i?i.nextSibling=n:this.firstChild=n,n.previousSibling=i,n.nextSibling=t),n},DOMNode.prototype.replaceChild=function(n,t){var f=null,u,r,i;if(this.ownerDocument.implementation.errorChecking){if(this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(this.ownerDocument!=n.ownerDocument)throw new DOMException(DOMException.WRONG_DOCUMENT_ERR);if(this._isAncestor(n))throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR);}u=this.childNodes._findItemIndex(t._id);if(this.ownerDocument.implementation.errorChecking&&u<0)throw new DOMException(DOMException.NOT_FOUND_ERR);r=n.parentNode,r&&r.removeChild(n),f=this.childNodes._replaceChild(n,u);if(n.nodeType==DOMNode.DOCUMENT_FRAGMENT_NODE){if(n.childNodes._nodes.length>0){for(i=0;i<n.childNodes._nodes.length;i++)n.childNodes._nodes[i].parentNode=this;t.previousSibling?t.previousSibling.nextSibling=n.childNodes._nodes[0]:this.firstChild=n.childNodes._nodes[0],t.nextSibling?t.nextSibling.previousSibling=n:this.lastChild=n.childNodes._nodes[n.childNodes._nodes.length-1],n.childNodes._nodes[0].previousSibling=t.previousSibling,n.childNodes._nodes[n.childNodes._nodes.length-1].nextSibling=t.nextSibling}}else n.parentNode=this,t.previousSibling?t.previousSibling.nextSibling=n:this.firstChild=n,t.nextSibling?t.nextSibling.previousSibling=n:this.lastChild=n,n.previousSibling=t.previousSibling,n.nextSibling=t.nextSibling;return f},DOMNode.prototype.removeChild=function(n){if(this.ownerDocument.implementation.errorChecking&&(this._readonly||n._readonly))throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);var t=this.childNodes._findItemIndex(n._id);if(this.ownerDocument.implementation.errorChecking&&t<0)throw new DOMException(DOMException.NOT_FOUND_ERR);return this.childNodes._removeChild(t),n.parentNode=null,n.previousSibling?n.previousSibling.nextSibling=n.nextSibling:this.firstChild=n.nextSibling,n.nextSibling?n.nextSibling.previousSibling=n.previousSibling:this.lastChild=n.previousSibling,n.previousSibling=null,n.nextSibling=null,n},DOMNode.prototype.appendChild=function(n){var i,t;if(this.ownerDocument.implementation.errorChecking){if(this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(this.ownerDocument!=n.ownerDocument)throw new DOMException(DOMException.WRONG_DOCUMENT_ERR);if(this._isAncestor(n))throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR);}i=n.parentNode,i&&i.removeChild(n),this.childNodes._appendChild(n);if(n.nodeType==DOMNode.DOCUMENT_FRAGMENT_NODE){if(n.childNodes._nodes.length>0){for(t=0;t<n.childNodes._nodes.length;t++)n.childNodes._nodes[t].parentNode=this;this.lastChild?(this.lastChild.nextSibling=n.childNodes._nodes[0],n.childNodes._nodes[0].previousSibling=this.lastChild,this.lastChild=n.childNodes._nodes[n.childNodes._nodes.length-1]):(this.lastChild=n.childNodes._nodes[n.childNodes._nodes.length-1],this.firstChild=n.childNodes._nodes[0])}}else n.parentNode=this,this.lastChild?(this.lastChild.nextSibling=n,n.previousSibling=this.lastChild,this.lastChild=n):(this.lastChild=n,this.firstChild=n);return n},DOMNode.prototype.hasChildNodes=function(){return this.childNodes.length>0},DOMNode.prototype.cloneNode=function(n){try{return this.ownerDocument.importNode(this,n)}catch(t){return null}},DOMNode.prototype.normalize=function(){var n,r=new DOMNodeList,i,t;if(this.nodeType==DOMNode.ELEMENT_NODE||this.nodeType==DOMNode.DOCUMENT_NODE){for(i=null,t=0;t<this.childNodes.length;t++)n=this.childNodes.item(t),n.nodeType==DOMNode.TEXT_NODE?n.length<1?r._appendChild(n):i?(i.appendData(n.data),r._appendChild(n)):i=n:(i=null,n.normalize());for(t=0;t<r.length;t++)n=r.item(t),n.parentNode.removeChild(n)}},DOMNode.prototype.isSupported=function(n,t){return this.ownerDocument.implementation.hasFeature(n,t)},DOMNode.prototype.getElementsByTagName=function(n){return this._getElementsByTagNameRecursive(n,new DOMNodeList(this.ownerDocument))},DOMNode.prototype._getElementsByTagNameRecursive=function(n,t){if(this.nodeType==DOMNode.ELEMENT_NODE||this.nodeType==DOMNode.DOCUMENT_NODE){(this.nodeName==n||n=="*")&&t._appendChild(this);for(var i=0;i<this.childNodes.length;i++)t=this.childNodes.item(i)._getElementsByTagNameRecursive(n,t)}return t},DOMNode.prototype.getXML=function(){return this.toString()},DOMNode.prototype.getElementsByTagNameNS=function(n,t){return this._getElementsByTagNameNSRecursive(n,t,new DOMNodeList(this.ownerDocument))},DOMNode.prototype._getElementsByTagNameNSRecursive=function(n,t,i){if(this.nodeType==DOMNode.ELEMENT_NODE||this.nodeType==DOMNode.DOCUMENT_NODE){(this.namespaceURI==n||n=="*")&&(this.localName==t||t=="*")&&i._appendChild(this);for(var r=0;r<this.childNodes.length;r++)i=this.childNodes.item(r)._getElementsByTagNameNSRecursive(n,t,i)}return i},DOMNode.prototype._isAncestor=function(n){return this==n||this.parentNode&&this.parentNode._isAncestor(n)},DOMNode.prototype.importNode=function(n,t){var r,i;this.getOwnerDocument()._performingImportNodeOperation=!0;try{if(n.nodeType==DOMNode.ELEMENT_NODE)if(this.ownerDocument.implementation.namespaceAware){for(r=this.ownerDocument.createElementNS(n.namespaceURI,n.nodeName),i=0;i<n.attributes.length;i++)r.setAttributeNS(n.attributes.item(i).namespaceURI,n.attributes.item(i).name,n.attributes.item(i).value);for(i=0;i<n._namespaces.length;i++)r._namespaces._nodes[i]=this.ownerDocument.createNamespace(n._namespaces.item(i).localName),r._namespaces._nodes[i].setValue(n._namespaces.item(i).value)}else for(r=this.ownerDocument.createElement(n.tagName),i=0;i<n.attributes.length;i++)r.setAttribute(n.attributes.item(i).name,n.attributes.item(i).value);else if(n.nodeType==DOMNode.ATTRIBUTE_NODE){if(this.ownerDocument.implementation.namespaceAware)for(r=this.ownerDocument.createAttributeNS(n.namespaceURI,n.nodeName),i=0;i<n._namespaces.length;i++)r._namespaces._nodes[i]=this.ownerDocument.createNamespace(n._namespaces.item(i).localName),r._namespaces._nodes[i].setValue(n._namespaces.item(i).value);else r=this.ownerDocument.createAttribute(n.name);r.setValue(n.value)}else if(n.nodeType==DOMNode.DOCUMENT_FRAGMENT)r=this.ownerDocument.createDocumentFragment();else if(n.nodeType==DOMNode.NAMESPACE_NODE)r=this.ownerDocument.createNamespace(n.nodeName),r.setValue(n.value);else if(n.nodeType==DOMNode.TEXT_NODE)r=this.ownerDocument.createTextNode(n.data);else if(n.nodeType==DOMNode.CDATA_SECTION_NODE)r=this.ownerDocument.createCDATASection(n.data);else if(n.nodeType==DOMNode.PROCESSING_INSTRUCTION_NODE)r=this.ownerDocument.createProcessingInstruction(n.target,n.data);else if(n.nodeType==DOMNode.COMMENT_NODE)r=this.ownerDocument.createComment(n.data);else throw new DOMException(DOMException.NOT_SUPPORTED_ERR);if(t)for(i=0;i<n.childNodes.length;i++)r.appendChild(this.ownerDocument.importNode(n.childNodes.item(i),!0));return this.getOwnerDocument()._performingImportNodeOperation=!1,r}catch(u){this.getOwnerDocument()._performingImportNodeOperation=!1;throw u;}},DOMNode.prototype.__escapeString=function(n){return __escapeString(n)},DOMNode.prototype.__unescapeString=function(n){return __unescapeString(n)},DOMDocument=function(n){this._class=addClass(this._class,"DOMDocument"),this.DOMNode=DOMNode,this.DOMNode(this),this.doctype=null,this.implementation=n,this.documentElement=null,this.all=[],this.nodeName="#document",this.nodeType=DOMNode.DOCUMENT_NODE,this._id=0,this._lastId=0,this._parseComplete=!1,this.ownerDocument=this,this._performingImportNodeOperation=!1},DOMDocument.prototype=new DOMNode,DOMDocument.prototype.getDoctype=function(){return this.doctype},DOMDocument.prototype.getImplementation=function(){return this.implementation},DOMDocument.prototype.getDocumentElement=function(){return this.documentElement},DOMDocument.prototype.createElement=function(n){if(this.ownerDocument.implementation.errorChecking&&!this.ownerDocument.implementation._isValidName(n))throw new DOMException(DOMException.INVALID_CHARACTER_ERR);var t=new DOMElement(this);return t.tagName=n,t.nodeName=n,this.all[this.all.length]=t,t},DOMDocument.prototype.createDocumentFragment=function(){return new DOMDocumentFragment(this)},DOMDocument.prototype.createTextNode=function(n){var t=new DOMText(this);return t.data=n,t.nodeValue=n,t.length=n.length,t},DOMDocument.prototype.createComment=function(n){var t=new DOMComment(this);return t.data=n,t.nodeValue=n,t.length=n.length,t},DOMDocument.prototype.createCDATASection=function(n){var t=new DOMCDATASection(this);return t.data=n,t.nodeValue=n,t.length=n.length,t},DOMDocument.prototype.createProcessingInstruction=function(n,t){if(this.ownerDocument.implementation.errorChecking&&!this.implementation._isValidName(n))throw new DOMException(DOMException.INVALID_CHARACTER_ERR);var i=new DOMProcessingInstruction(this);return i.target=n,i.nodeName=n,i.data=t,i.nodeValue=t,i.length=t.length,i},DOMDocument.prototype.createAttribute=function(n){if(this.ownerDocument.implementation.errorChecking&&!this.ownerDocument.implementation._isValidName(n))throw new DOMException(DOMException.INVALID_CHARACTER_ERR);var t=new DOMAttr(this);return t.name=n,t.nodeName=n,t},DOMDocument.prototype.createElementNS=function(n,t){if(this.ownerDocument.implementation.errorChecking){if(!this.ownerDocument._isValidNamespace(n,t))throw new DOMException(DOMException.NAMESPACE_ERR);if(!this.ownerDocument.implementation._isValidName(t))throw new DOMException(DOMException.INVALID_CHARACTER_ERR);}var i=new DOMElement(this),r=this.implementation._parseQName(t);return i.nodeName=t,i.namespaceURI=n,i.prefix=r.prefix,i.localName=r.localName,i.tagName=t,this.all[this.all.length]=i,i},DOMDocument.prototype.createAttributeNS=function(n,t){if(this.ownerDocument.implementation.errorChecking){if(!this.ownerDocument._isValidNamespace(n,t,!0))throw new DOMException(DOMException.NAMESPACE_ERR);if(!this.ownerDocument.implementation._isValidName(t))throw new DOMException(DOMException.INVALID_CHARACTER_ERR);}var i=new DOMAttr(this),r=this.implementation._parseQName(t);return i.nodeName=t,i.namespaceURI=n,i.prefix=r.prefix,i.localName=r.localName,i.name=t,i.nodeValue="",i},DOMDocument.prototype.createNamespace=function(n){var t=new DOMNamespace(this),i=this.implementation._parseQName(n);return t.nodeName=n,t.prefix=i.prefix,t.localName=i.localName,t.name=n,t.nodeValue="",t},DOMDocument.prototype.getElementById=function(n){var i,t;for(retNode=null,i=0;i<this.all.length;i++){t=this.all[i];if(t.id==n&&t._isAncestor(t.ownerDocument.documentElement)){retNode=t;break}}return retNode},DOMDocument.prototype._genId=function(){return this._lastId+=1},DOMDocument.prototype._isValidNamespace=function(n,t,i){if(this._performingImportNodeOperation==!0)return!0;var r=!0,u=this.implementation._parseQName(t);return this._parseComplete==!0&&(u.localName.indexOf(":")>-1&&(r=!1),r&&!i&&(n||(r=!1)),r&&u.prefix==""&&(r=!1)),r&&u.prefix=="xml"&&n!="http://www.w3.org/XML/1998/namespace"&&(r=!1),r},DOMDocument.prototype.toString=function(){return""+this.childNodes},DOMElement=function(n){this._class=addClass(this._class,"DOMElement"),this.DOMNode=DOMNode,this.DOMNode(n),this.tagName="",this.id="",this.nodeType=DOMNode.ELEMENT_NODE},DOMElement.prototype=new DOMNode,DOMElement.prototype.getTagName=function(){return this.tagName},DOMElement.prototype.getAttribute=function(n){var i="",t=this.attributes.getNamedItem(n);return t&&(i=t.value),i},DOMElement.prototype.setAttribute=function(n,t){var i=this.attributes.getNamedItem(n),t;i||(i=this.ownerDocument.createAttribute(n)),t=new String(t);if(this.ownerDocument.implementation.errorChecking){if(i._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(!this.ownerDocument.implementation._isValidString(t))throw new DOMException(DOMException.INVALID_CHARACTER_ERR);}this.ownerDocument.implementation._isIdDeclaration(n)&&(this.id=t),i.value=t,i.nodeValue=t,i.specified=t.length>0?!0:!1,this.attributes.setNamedItem(i)},DOMElement.prototype.removeAttribute=function(n){return this.attributes.removeNamedItem(n)},DOMElement.prototype.getAttributeNode=function(n){return this.attributes.getNamedItem(n)},DOMElement.prototype.setAttributeNode=function(n){return this.ownerDocument.implementation._isIdDeclaration(n.name)&&(this.id=n.value),this.attributes.setNamedItem(n)},DOMElement.prototype.removeAttributeNode=function(n){if(this.ownerDocument.implementation.errorChecking&&n._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);var t=this.attributes._findItemIndex(n._id);if(this.ownerDocument.implementation.errorChecking&&t<0)throw new DOMException(DOMException.NOT_FOUND_ERR);return this.attributes._removeChild(t)},DOMElement.prototype.getAttributeNS=function(n,t){var r="",i=this.attributes.getNamedItemNS(n,t);return i&&(r=i.value),r},DOMElement.prototype.setAttributeNS=function(n,t,i){var r=this.attributes.getNamedItem(n,t),i;r||(r=this.ownerDocument.createAttributeNS(n,t)),i=new String(i);if(this.ownerDocument.implementation.errorChecking){if(r._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(!this.ownerDocument._isValidNamespace(n,t))throw new DOMException(DOMException.NAMESPACE_ERR);if(!this.ownerDocument.implementation._isValidString(i))throw new DOMException(DOMException.INVALID_CHARACTER_ERR);}this.ownerDocument.implementation._isIdDeclaration(name)&&(this.id=i),r.value=i,r.nodeValue=i,r.specified=i.length>0?!0:!1,this.attributes.setNamedItemNS(r)},DOMElement.prototype.removeAttributeNS=function(n,t){return this.attributes.removeNamedItemNS(n,t)},DOMElement.prototype.getAttributeNodeNS=function(n,t){return this.attributes.getNamedItemNS(n,t)},DOMElement.prototype.setAttributeNodeNS=function(n){return n.prefix==""&&this.ownerDocument.implementation._isIdDeclaration(n.name)&&(this.id=n.value),this.attributes.setNamedItemNS(n)},DOMElement.prototype.hasAttribute=function(n){return this.attributes._hasAttribute(n)},DOMElement.prototype.hasAttributeNS=function(n,t){return this.attributes._hasAttributeNS(n,t)},DOMElement.prototype.toString=function(){var t="",i=this._namespaces.toString(),n;return i.length>0&&(i=" "+i),n=this.attributes.toString(),n.length>0&&(n=" "+n),t+="<"+this.nodeName+i+n+">",t+=this.childNodes.toString(),t+="</"+this.nodeName+">"},DOMAttr=function(n){this._class=addClass(this._class,"DOMAttr"),this.DOMNode=DOMNode,this.DOMNode(n),this.name="",this.specified=!1,this.value="",this.nodeType=DOMNode.ATTRIBUTE_NODE,this.ownerElement=null,this.childNodes=null,this.attributes=null},DOMAttr.prototype=new DOMNode,DOMAttr.prototype.getName=function(){return this.nodeName},DOMAttr.prototype.getSpecified=function(){return this.specified},DOMAttr.prototype.getValue=function(){return this.nodeValue},DOMAttr.prototype.setValue=function(n){if(this.ownerDocument.implementation.errorChecking&&this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);this.setNodeValue(n)},DOMAttr.prototype.setNodeValue=function(n){this.nodeValue=new String(n),this.value=this.nodeValue,this.specified=this.value.length>0},DOMAttr.prototype.toString=function(){var n="";return n+=this.nodeName+'="'+this.__escapeString(this.nodeValue)+'"'},DOMAttr.prototype.getOwnerElement=function(){return this.ownerElement},DOMNamespace=function(n){this._class=addClass(this._class,"DOMNamespace"),this.DOMNode=DOMNode,this.DOMNode(n),this.name="",this.specified=!1,this.value="",this.nodeType=DOMNode.NAMESPACE_NODE},DOMNamespace.prototype=new DOMNode,DOMNamespace.prototype.getValue=function(){return this.nodeValue},DOMNamespace.prototype.setValue=function(n){this.nodeValue=new String(n),this.value=this.nodeValue},DOMNamespace.prototype.toString=function(){var n="";return n+=this.nodeName!=""?this.nodeName+'="'+this.__escapeString(this.nodeValue)+'"':'xmlns="'+this.__escapeString(this.nodeValue)+'"'},DOMCharacterData=function(n){this._class=addClass(this._class,"DOMCharacterData"),this.DOMNode=DOMNode,this.DOMNode(n),this.data="",this.length=0},DOMCharacterData.prototype=new DOMNode,DOMCharacterData.prototype.getData=function(){return this.nodeValue},DOMCharacterData.prototype.setData=function(n){this.setNodeValue(n)},DOMCharacterData.prototype.setNodeValue=function(n){if(this.ownerDocument.implementation.errorChecking&&this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);this.nodeValue=new String(n),this.data=this.nodeValue,this.length=this.nodeValue.length},DOMCharacterData.prototype.getLength=function(){return this.nodeValue.length},DOMCharacterData.prototype.substringData=function(n,t){var i=null;if(this.data){if(this.ownerDocument.implementation.errorChecking&&(n<0||n>this.data.length||t<0))throw new DOMException(DOMException.INDEX_SIZE_ERR);i=t?this.data.substring(n,n+t):this.data.substring(n)}return i},DOMCharacterData.prototype.appendData=function(n){if(this.ownerDocument.implementation.errorChecking&&this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);this.setData(""+this.data+n)},DOMCharacterData.prototype.insertData=function(n,t){if(this.ownerDocument.implementation.errorChecking&&this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(this.data){if(this.ownerDocument.implementation.errorChecking&&(n<0||n>this.data.length))throw new DOMException(DOMException.INDEX_SIZE_ERR);this.setData(this.data.substring(0,n).concat(t,this.data.substring(n)))}else{if(this.ownerDocument.implementation.errorChecking&&n!=0)throw new DOMException(DOMException.INDEX_SIZE_ERR);this.setData(t)}},DOMCharacterData.prototype.deleteData=function(n,t){if(this.ownerDocument.implementation.errorChecking&&this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(this.data){if(this.ownerDocument.implementation.errorChecking&&(n<0||n>this.data.length||t<0))throw new DOMException(DOMException.INDEX_SIZE_ERR);!t||n+t>this.data.length?this.setData(this.data.substring(0,n)):this.setData(this.data.substring(0,n).concat(this.data.substring(n+t)))}},DOMCharacterData.prototype.replaceData=function(n,t,i){if(this.ownerDocument.implementation.errorChecking&&this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(this.data){if(this.ownerDocument.implementation.errorChecking&&(n<0||n>this.data.length||t<0))throw new DOMException(DOMException.INDEX_SIZE_ERR);this.setData(this.data.substring(0,n).concat(i,this.data.substring(n+t)))}else this.setData(i)},DOMText=function(n){this._class=addClass(this._class,"DOMText"),this.DOMCharacterData=DOMCharacterData,this.DOMCharacterData(n),this.nodeName="#text",this.nodeType=DOMNode.TEXT_NODE},DOMText.prototype=new DOMCharacterData,DOMText.prototype.splitText=function(n){var i,t;if(this.ownerDocument.implementation.errorChecking){if(this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(n<0||n>this.data.length)throw new DOMException(DOMException.INDEX_SIZE_ERR);}return this.parentNode&&(i=this.substringData(n),t=this.ownerDocument.createTextNode(i),this.nextSibling?this.parentNode.insertBefore(t,this.nextSibling):this.parentNode.appendChild(t),this.deleteData(n)),t},DOMText.prototype.toString=function(){return this.__escapeString(""+this.nodeValue)},DOMCDATASection=function(n){this._class=addClass(this._class,"DOMCDATASection"),this.DOMCharacterData=DOMCharacterData,this.DOMCharacterData(n),this.nodeName="#cdata-section",this.nodeType=DOMNode.CDATA_SECTION_NODE},DOMCDATASection.prototype=new DOMCharacterData,DOMCDATASection.prototype.splitText=function(n){var i,t;if(this.ownerDocument.implementation.errorChecking){if(this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);if(n<0||n>this.data.length)throw new DOMException(DOMException.INDEX_SIZE_ERR);}return this.parentNode&&(i=this.substringData(n),t=this.ownerDocument.createCDATASection(i),this.nextSibling?this.parentNode.insertBefore(t,this.nextSibling):this.parentNode.appendChild(t),this.deleteData(n)),t},DOMCDATASection.prototype.toString=function(){var n="";return n+="<![CDATA["+this.nodeValue+"]\]>"},DOMComment=function(n){this._class=addClass(this._class,"DOMComment"),this.DOMCharacterData=DOMCharacterData,this.DOMCharacterData(n),this.nodeName="#comment",this.nodeType=DOMNode.COMMENT_NODE},DOMComment.prototype=new DOMCharacterData,DOMComment.prototype.toString=function(){var n="";return n+="<!--"+this.nodeValue+"-->"},DOMProcessingInstruction=function(n){this._class=addClass(this._class,"DOMProcessingInstruction"),this.DOMNode=DOMNode,this.DOMNode(n),this.target="",this.data="",this.nodeType=DOMNode.PROCESSING_INSTRUCTION_NODE},DOMProcessingInstruction.prototype=new DOMNode,DOMProcessingInstruction.prototype.getTarget=function(){return this.nodeName},DOMProcessingInstruction.prototype.getData=function(){return this.nodeValue},DOMProcessingInstruction.prototype.setData=function(n){this.setNodeValue(n)},DOMProcessingInstruction.prototype.setNodeValue=function(n){if(this.ownerDocument.implementation.errorChecking&&this._readonly)throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR);this.nodeValue=new String(n),this.data=this.nodeValue},DOMProcessingInstruction.prototype.toString=function(){var n="";return n+="<?"+this.nodeName+" "+this.nodeValue+" ?>"},DOMDocumentFragment=function(n){this._class=addClass(this._class,"DOMDocumentFragment"),this.DOMNode=DOMNode,this.DOMNode(n),this.nodeName="#document-fragment",this.nodeType=DOMNode.DOCUMENT_FRAGMENT_NODE},DOMDocumentFragment.prototype=new DOMNode,DOMDocumentFragment.prototype.toString=function(){var n="",t=this.getChildNodes().getLength();for(intLoop=0;intLoop<t;intLoop++)n+=this.getChildNodes().item(intLoop).toString();return n},DOMDocumentType=function(){alert("DOMDocumentType.constructor(): Not Implemented")},DOMEntity=function(){alert("DOMEntity.constructor(): Not Implemented")},DOMEntityReference=function(){alert("DOMEntityReference.constructor(): Not Implemented")},DOMNotation=function(){alert("DOMNotation.constructor(): Not Implemented")},Strings={},Strings.WHITESPACE=" \t\n\r",Strings.QUOTES="\"'",Strings.isEmpty=function(n){return n==null||n.length==0},Strings.indexOfNonWhitespace=function(n,t,i){if(Strings.isEmpty(n))return-1;t=t||0,i=i||n.length;for(var r=t;r<i;r++)if(Strings.WHITESPACE.indexOf(n.charAt(r))==-1)return r;return-1},Strings.lastIndexOfNonWhitespace=function(n,t,i){if(Strings.isEmpty(n))return-1;t=t||0,i=i||n.length;for(var r=i-1;r>=t;r--)if(Strings.WHITESPACE.indexOf(n.charAt(r))==-1)return r;return-1},Strings.indexOfWhitespace=function(n,t,i){if(Strings.isEmpty(n))return-1;t=t||0,i=i||n.length;for(var r=t;r<i;r++)if(Strings.WHITESPACE.indexOf(n.charAt(r))!=-1)return r;return-1},Strings.replace=function(n,t,i,r,u){return Strings.isEmpty(n)?"":(t=t||0,i=i||n.length,n.substring(t,i).split(r).join(u))},Strings.getLineNumber=function(n,t){return Strings.isEmpty(n)?-1:(t=t||n.length,n.substring(0,t).split("\n").length)},Strings.getColumnNumber=function(n,t){var i,u,r;return Strings.isEmpty(n)?-1:(t=t||n.length,i=n.substring(0,t).split("\n"),u=i[i.length-1],i.length--,r=i.join("\n").length,t-r)},StringBuffer=function(){this._a=[]},StringBuffer.prototype.append=function(n){this._a[this._a.length]=n},StringBuffer.prototype.toString=function(){return this._a.join("")},whitespace="\n\r\t ",XMLP=function(n){n=SAXStrings.replace(n,null,null,"\r\n","\n"),n=SAXStrings.replace(n,null,null,"\r","\n"),this.m_xml=n,this.m_iP=0,this.m_iState=XMLP._STATE_PROLOG,this.m_stack=new Stack,this._clearAttributes()},XMLP._NONE=0,XMLP._ELM_B=1,XMLP._ELM_E=2,XMLP._ELM_EMP=3,XMLP._ATT=4,XMLP._TEXT=5,XMLP._ENTITY=6,XMLP._PI=7,XMLP._CDATA=8,XMLP._COMMENT=9,XMLP._DTD=10,XMLP._ERROR=11,XMLP._CONT_XML=0,XMLP._CONT_ALT=1,XMLP._ATT_NAME=0,XMLP._ATT_VAL=1,XMLP._STATE_PROLOG=1,XMLP._STATE_DOCUMENT=2,XMLP._STATE_MISC=3,XMLP._errs=[],XMLP._errs[XMLP.ERR_CLOSE_PI=0]="PI: missing closing sequence",XMLP._errs[XMLP.ERR_CLOSE_DTD=1]="DTD: missing closing sequence",XMLP._errs[XMLP.ERR_CLOSE_COMMENT=2]="Comment: missing closing sequence",XMLP._errs[XMLP.ERR_CLOSE_CDATA=3]="CDATA: missing closing sequence",XMLP._errs[XMLP.ERR_CLOSE_ELM=4]="Element: missing closing sequence",XMLP._errs[XMLP.ERR_CLOSE_ENTITY=5]="Entity: missing closing sequence",XMLP._errs[XMLP.ERR_PI_TARGET=6]="PI: target is required",XMLP._errs[XMLP.ERR_ELM_EMPTY=7]="Element: cannot be both empty and closing",XMLP._errs[XMLP.ERR_ELM_NAME=8]='Element: name must immediatly follow "<"',XMLP._errs[XMLP.ERR_ELM_LT_NAME=9]='Element: "<" not allowed in element names',XMLP._errs[XMLP.ERR_ATT_VALUES=10]="Attribute: values are required and must be in quotes",XMLP._errs[XMLP.ERR_ATT_LT_NAME=11]='Element: "<" not allowed in attribute names',XMLP._errs[XMLP.ERR_ATT_LT_VALUE=12]='Attribute: "<" not allowed in attribute values',XMLP._errs[XMLP.ERR_ATT_DUP=13]="Attribute: duplicate attributes not allowed",XMLP._errs[XMLP.ERR_ENTITY_UNKNOWN=14]="Entity: unknown entity",XMLP._errs[XMLP.ERR_INFINITELOOP=15]="Infininte loop",XMLP._errs[XMLP.ERR_DOC_STRUCTURE=16]="Document: only comments, processing instructions, or whitespace allowed outside of document element",XMLP._errs[XMLP.ERR_ELM_NESTING=17]="Element: must be nested correctly",XMLP.prototype._addAttribute=function(n,t){this.m_atts[this.m_atts.length]=[n,t]},XMLP.prototype._checkStructure=function(n){if(XMLP._STATE_PROLOG==this.m_iState){if(XMLP._TEXT==n||XMLP._ENTITY==n)if(SAXStrings.indexOfNonWhitespace(this.getContent(),this.getContentBegin(),this.getContentEnd())!=-1)return this._setErr(XMLP.ERR_DOC_STRUCTURE);(XMLP._ELM_B==n||XMLP._ELM_EMP==n)&&(this.m_iState=XMLP._STATE_DOCUMENT)}if(XMLP._STATE_DOCUMENT==this.m_iState){(XMLP._ELM_B==n||XMLP._ELM_EMP==n)&&this.m_stack.push(this.getName());if(XMLP._ELM_E==n||XMLP._ELM_EMP==n){var t=this.m_stack.pop();if(t==null||t!=this.getName())return this._setErr(XMLP.ERR_ELM_NESTING)}if(this.m_stack.count()==0)return this.m_iState=XMLP._STATE_MISC,n}if(XMLP._STATE_MISC==this.m_iState){if(XMLP._ELM_B==n||XMLP._ELM_E==n||XMLP._ELM_EMP==n||XMLP.EVT_DTD==n)return this._setErr(XMLP.ERR_DOC_STRUCTURE);if(XMLP._TEXT==n||XMLP._ENTITY==n)if(SAXStrings.indexOfNonWhitespace(this.getContent(),this.getContentBegin(),this.getContentEnd())!=-1)return this._setErr(XMLP.ERR_DOC_STRUCTURE)}return n},XMLP.prototype._clearAttributes=function(){this.m_atts=[]},XMLP.prototype._findAttributeIndex=function(n){for(var t=0;t<this.m_atts.length;t++)if(this.m_atts[t][XMLP._ATT_NAME]==n)return t;return-1},XMLP.prototype.getAttributeCount=function(){return this.m_atts?this.m_atts.length:0},XMLP.prototype.getAttributeName=function(n){return n<0||n>=this.m_atts.length?null:this.m_atts[n][XMLP._ATT_NAME]},XMLP.prototype.getAttributeValue=function(n){return n<0||n>=this.m_atts.length?null:__unescapeString(this.m_atts[n][XMLP._ATT_VAL])},XMLP.prototype.getAttributeValueByName=function(n){return this.getAttributeValue(this._findAttributeIndex(n))},XMLP.prototype.getColumnNumber=function(){return SAXStrings.getColumnNumber(this.m_xml,this.m_iP)},XMLP.prototype.getContent=function(){return this.m_cSrc==XMLP._CONT_XML?this.m_xml:this.m_cAlt},XMLP.prototype.getContentBegin=function(){return this.m_cB},XMLP.prototype.getContentEnd=function(){return this.m_cE},XMLP.prototype.getLineNumber=function(){return SAXStrings.getLineNumber(this.m_xml,this.m_iP)},XMLP.prototype.getName=function(){return this.m_name},XMLP.prototype.next=function(){return this._checkStructure(this._parse())},XMLP.prototype._parse=function(){return this.m_iP==this.m_xml.length?XMLP._NONE:this.m_iP==this.m_xml.indexOf("<?",this.m_iP)?this._parsePI(this.m_iP+2):this.m_iP==this.m_xml.indexOf("<!DOCTYPE",this.m_iP)?this._parseDTD(this.m_iP+9):this.m_iP==this.m_xml.indexOf("<!--",this.m_iP)?this._parseComment(this.m_iP+4):this.m_iP==this.m_xml.indexOf("<![CDATA[",this.m_iP)?this._parseCDATA(this.m_iP+9):this.m_iP==this.m_xml.indexOf("<",this.m_iP)?this._parseElement(this.m_iP+1):this.m_iP==this.m_xml.indexOf("&",this.m_iP)?this._parseEntity(this.m_iP+1):this._parseText(this.m_iP)},XMLP.prototype._parseAttribute=function(n,t){var r,h,f,u,e,s,o,i;this.m_cAlt="",r=SAXStrings.indexOfNonWhitespace(this.m_xml,n,t);if(r==-1||r>=t)return r;f=this.m_xml.indexOf("=",r);if(f==-1||f>t)return this._setErr(XMLP.ERR_ATT_VALUES);h=SAXStrings.lastIndexOfNonWhitespace(this.m_xml,r,f),u=SAXStrings.indexOfNonWhitespace(this.m_xml,f+1,t);if(u==-1||u>t)return this._setErr(XMLP.ERR_ATT_VALUES);s=this.m_xml.charAt(u);if(SAXStrings.QUOTES.indexOf(s)==-1)return this._setErr(XMLP.ERR_ATT_VALUES);e=this.m_xml.indexOf(s,u+1);if(e==-1||e>t)return this._setErr(XMLP.ERR_ATT_VALUES);o=this.m_xml.substring(r,h+1),i=this.m_xml.substring(u+1,e);if(o.indexOf("<")!=-1)return this._setErr(XMLP.ERR_ATT_LT_NAME);if(i.indexOf("<")!=-1)return this._setErr(XMLP.ERR_ATT_LT_VALUE);i=SAXStrings.replace(i,null,null,"\n"," "),i=SAXStrings.replace(i,null,null,"\t"," "),iRet=this._replaceEntities(i);if(iRet==XMLP._ERROR)return iRet;i=this.m_cAlt;if(this._findAttributeIndex(o)==-1)this._addAttribute(o,i);else return this._setErr(XMLP.ERR_ATT_DUP);return this.m_iP=e+2,XMLP._ATT},XMLP.prototype._parseCDATA=function(n){var t=this.m_xml.indexOf("]\]>",n);return t==-1?this._setErr(XMLP.ERR_CLOSE_CDATA):(this._setContent(XMLP._CONT_XML,n,t),this.m_iP=t+3,XMLP._CDATA)},XMLP.prototype._parseComment=function(n){var t=this.m_xml.indexOf("-->",n);return t==-1?this._setErr(XMLP.ERR_CLOSE_COMMENT):(this._setContent(XMLP._CONT_XML,n,t),this.m_iP=t+3,XMLP._COMMENT)},XMLP.prototype._parseDTD=function(n){var t,r,i,u;t=this.m_xml.indexOf(">",n);if(t==-1)return this._setErr(XMLP.ERR_CLOSE_DTD);i=this.m_xml.indexOf("[",n),r=i!=-1&&i<t?"]>":">";for(;;){if(t==u)return this._setErr(XMLP.ERR_INFINITELOOP);u=t,t=this.m_xml.indexOf(r,n);if(t==-1)return this._setErr(XMLP.ERR_CLOSE_DTD);if(this.m_xml.substring(t-1,t+2)!="]\]>")break}return this.m_iP=t+r.length,XMLP._DTD},XMLP.prototype._parseElement=function(n){var u,t,r,e,i,f,o;t=u=this.m_xml.indexOf(">",n);if(u==-1)return this._setErr(XMLP.ERR_CLOSE_ELM);this.m_xml.charAt(n)=="/"?(i=XMLP._ELM_E,n++):i=XMLP._ELM_B;if(this.m_xml.charAt(u-1)=="/"){if(i==XMLP._ELM_E)return this._setErr(XMLP.ERR_ELM_EMPTY);i=XMLP._ELM_EMP,t--}t=SAXStrings.lastIndexOfNonWhitespace(this.m_xml,n,t);if(u-n!=1)if(SAXStrings.indexOfNonWhitespace(this.m_xml,n,t)!=n)return this._setErr(XMLP.ERR_ELM_NAME);this._clearAttributes(),r=SAXStrings.indexOfWhitespace(this.m_xml,n,t);if(r==-1)r=t+1;else{this.m_iP=r;while(this.m_iP<t){if(this.m_iP==o)return this._setErr(XMLP.ERR_INFINITELOOP);o=this.m_iP,e=this._parseAttribute(this.m_iP,t);if(e==XMLP._ERROR)return e}}return f=this.m_xml.substring(n,r),f.indexOf("<")!=-1?this._setErr(XMLP.ERR_ELM_LT_NAME):(this.m_name=f,this.m_iP=u+1,i)},XMLP.prototype._parseEntity=function(n){var t=this.m_xml.indexOf(";",n);return t==-1?this._setErr(XMLP.ERR_CLOSE_ENTITY):(this.m_iP=t+1,this._replaceEntity(this.m_xml,n,t))},XMLP.prototype._parsePI=function(n){var t,f,i,r,u;t=this.m_xml.indexOf("?>",n);if(t==-1)return this._setErr(XMLP.ERR_CLOSE_PI);return f=SAXStrings.indexOfNonWhitespace(this.m_xml,n,t),f==-1?this._setErr(XMLP.ERR_PI_TARGET):(i=SAXStrings.indexOfWhitespace(this.m_xml,f,t),i==-1&&(i=t),r=SAXStrings.indexOfNonWhitespace(this.m_xml,i,t),r==-1&&(r=t),u=SAXStrings.lastIndexOfNonWhitespace(this.m_xml,r,t),u==-1&&(u=t-1),this.m_name=this.m_xml.substring(f,i),this._setContent(XMLP._CONT_XML,r,u+1),this.m_iP=t+2,XMLP._PI)},XMLP.prototype._parseText=function(n){var t,i;return t=this.m_xml.indexOf("<",n),t==-1&&(t=this.m_xml.length),i=this.m_xml.indexOf("&",n),i==-1||i>t||(t=i),this._setContent(XMLP._CONT_XML,n,t),this.m_iP=t,XMLP._TEXT},XMLP.prototype._replaceEntities=function(n,t,i){if(SAXStrings.isEmpty(n))return"";t=t||0,i=i||n.length;var u,r,f="";u=n.indexOf("&",t),r=t;while(u>0&&u<i){f+=n.substring(r,u),r=n.indexOf(";",u)+1;if(r==0||r>i)return this._setErr(XMLP.ERR_CLOSE_ENTITY);iRet=this._replaceEntity(n,u+1,r-1);if(iRet==XMLP._ERROR)return iRet;f+=this.m_cAlt,u=n.indexOf("&",r)}return r!=i&&(f+=n.substring(r,i)),this._setContent(XMLP._CONT_ALT,f),XMLP._ENTITY},XMLP.prototype._replaceEntity=function(n,t,i){if(SAXStrings.isEmpty(n))return-1;t=t||0,i=i||n.length;switch(n.substring(t,i)){case"amp":strEnt="&";break;case"lt":strEnt="<";break;case"gt":strEnt=">";break;case"apos":strEnt="'";break;case"quot":strEnt='"';break;default:if(n.charAt(t)=="#")strEnt=String.fromCharCode(parseInt(n.substring(t+1,i)));else return this._setErr(XMLP.ERR_ENTITY_UNKNOWN)}return this._setContent(XMLP._CONT_ALT,strEnt),XMLP._ENTITY},XMLP.prototype._setContent=function(n){var t=arguments;XMLP._CONT_XML==n?(this.m_cAlt=null,this.m_cB=t[1],this.m_cE=t[2]):(this.m_cAlt=t[1],this.m_cB=0,this.m_cE=t[1].length),this.m_cSrc=n},XMLP.prototype._setErr=function(n){var t=XMLP._errs[n];return this.m_cAlt=t,this.m_cB=0,this.m_cE=t.length,this.m_cSrc=XMLP._CONT_ALT,XMLP._ERROR},SAXDriver=function(){this.m_hndDoc=null,this.m_hndErr=null,this.m_hndLex=null},SAXDriver.DOC_B=1,SAXDriver.DOC_E=2,SAXDriver.ELM_B=3,SAXDriver.ELM_E=4,SAXDriver.CHARS=5,SAXDriver.PI=6,SAXDriver.CD_B=7,SAXDriver.CD_E=8,SAXDriver.CMNT=9,SAXDriver.DTD_B=10,SAXDriver.DTD_E=11,SAXDriver.prototype.parse=function(n){var t=new XMLP(n);this.m_hndDoc&&this.m_hndDoc.setDocumentLocator&&this.m_hndDoc.setDocumentLocator(this),this.m_parser=t,this.m_bErr=!1,this.m_bErr||this._fireEvent(SAXDriver.DOC_B),this._parseLoop(),this.m_bErr||this._fireEvent(SAXDriver.DOC_E),this.m_xml=null,this.m_iP=0},SAXDriver.prototype.setDocumentHandler=function(n){this.m_hndDoc=n},SAXDriver.prototype.setErrorHandler=function(n){this.m_hndErr=n},SAXDriver.prototype.setLexicalHandler=function(n){this.m_hndLex=n},SAXDriver.prototype.getColumnNumber=function(){return this.m_parser.getColumnNumber()},SAXDriver.prototype.getLineNumber=function(){return this.m_parser.getLineNumber()},SAXDriver.prototype.getMessage=function(){return this.m_strErrMsg},SAXDriver.prototype.getPublicId=function(){return null},SAXDriver.prototype.getSystemId=function(){return null},SAXDriver.prototype.getLength=function(){return this.m_parser.getAttributeCount()},SAXDriver.prototype.getName=function(n){return this.m_parser.getAttributeName(n)},SAXDriver.prototype.getValue=function(n){return this.m_parser.getAttributeValue(n)},SAXDriver.prototype.getValueByName=function(n){return this.m_parser.getAttributeValueByName(n)},SAXDriver.prototype._fireError=function(n){this.m_strErrMsg=n,this.m_bErr=!0,this.m_hndErr&&this.m_hndErr.fatalError&&this.m_hndErr.fatalError(this)},SAXDriver.prototype._fireEvent=function(n){var t,i,r=arguments,u=r.length-1;if(this.m_bErr)return;SAXDriver.DOC_B==n?(i="startDocument",t=this.m_hndDoc):SAXDriver.DOC_E==n?(i="endDocument",t=this.m_hndDoc):SAXDriver.ELM_B==n?(i="startElement",t=this.m_hndDoc):SAXDriver.ELM_E==n?(i="endElement",t=this.m_hndDoc):SAXDriver.CHARS==n?(i="characters",t=this.m_hndDoc):SAXDriver.PI==n?(i="processingInstruction",t=this.m_hndDoc):SAXDriver.CD_B==n?(i="startCDATA",t=this.m_hndLex):SAXDriver.CD_E==n?(i="endCDATA",t=this.m_hndLex):SAXDriver.CMNT==n&&(i="comment",t=this.m_hndLex),t&&t[i]&&(0==u?t[i]():1==u?t[i](r[1]):2==u?t[i](r[1],r[2]):3==u&&t[i](r[1],r[2],r[3]))},SAXDriver.prototype._parseLoop=function(n){var t,n;n=this.m_parser;while(!this.m_bErr){t=n.next();if(t==XMLP._ELM_B)this._fireEvent(SAXDriver.ELM_B,n.getName(),this);else if(t==XMLP._ELM_E)this._fireEvent(SAXDriver.ELM_E,n.getName());else if(t==XMLP._ELM_EMP)this._fireEvent(SAXDriver.ELM_B,n.getName(),this),this._fireEvent(SAXDriver.ELM_E,n.getName());else if(t==XMLP._TEXT)this._fireEvent(SAXDriver.CHARS,n.getContent(),n.getContentBegin(),n.getContentEnd()-n.getContentBegin());else if(t==XMLP._ENTITY)this._fireEvent(SAXDriver.CHARS,n.getContent(),n.getContentBegin(),n.getContentEnd()-n.getContentBegin());else if(t==XMLP._PI)this._fireEvent(SAXDriver.PI,n.getName(),n.getContent().substring(n.getContentBegin(),n.getContentEnd()));else if(t==XMLP._CDATA)this._fireEvent(SAXDriver.CD_B),this._fireEvent(SAXDriver.CHARS,n.getContent(),n.getContentBegin(),n.getContentEnd()-n.getContentBegin()),this._fireEvent(SAXDriver.CD_E);else if(t==XMLP._COMMENT)this._fireEvent(SAXDriver.CMNT,n.getContent(),n.getContentBegin(),n.getContentEnd()-n.getContentBegin());else if(t!=XMLP._DTD)if(t==XMLP._ERROR)this._fireError(n.getContent());else if(t==XMLP._NONE)return}},SAXStrings=function(){},SAXStrings.WHITESPACE=" \t\n\r",SAXStrings.QUOTES="\"'",SAXStrings.getColumnNumber=function(n,t){var i,u,r;return SAXStrings.isEmpty(n)?-1:(t=t||n.length,i=n.substring(0,t).split("\n"),u=i[i.length-1],i.length--,r=i.join("\n").length,t-r)},SAXStrings.getLineNumber=function(n,t){return SAXStrings.isEmpty(n)?-1:(t=t||n.length,n.substring(0,t).split("\n").length)},SAXStrings.indexOfNonWhitespace=function(n,t,i){if(SAXStrings.isEmpty(n))return-1;t=t||0,i=i||n.length;for(var r=t;r<i;r++)if(SAXStrings.WHITESPACE.indexOf(n.charAt(r))==-1)return r;return-1},SAXStrings.indexOfWhitespace=function(n,t,i){if(SAXStrings.isEmpty(n))return-1;t=t||0,i=i||n.length;for(var r=t;r<i;r++)if(SAXStrings.WHITESPACE.indexOf(n.charAt(r))!=-1)return r;return-1},SAXStrings.isEmpty=function(n){return n==null||n.length==0},SAXStrings.lastIndexOfNonWhitespace=function(n,t,i){if(SAXStrings.isEmpty(n))return-1;t=t||0,i=i||n.length;for(var r=i-1;r>=t;r--)if(SAXStrings.WHITESPACE.indexOf(n.charAt(r))==-1)return r;return-1},SAXStrings.replace=function(n,t,i,r,u){return SAXStrings.isEmpty(n)?"":(t=t||0,i=i||n.length,n.substring(t,i).split(r).join(u))},Stack=function(){this.m_arr=[]},Stack.prototype.clear=function(){this.m_arr=[]},Stack.prototype.count=function(){return this.m_arr.length},Stack.prototype.destroy=function(){this.m_arr=null},Stack.prototype.peek=function(){return this.m_arr.length==0?null:this.m_arr[this.m_arr.length-1]},Stack.prototype.pop=function(){if(this.m_arr.length==0)return null;var n=this.m_arr[this.m_arr.length-1];return this.m_arr.length--,n},Stack.prototype.push=function(n){this.m_arr[this.m_arr.length]=n},whitespace="\n\r\t ",quotes="\"'"
