/* Property: load Asynchronously load an XML structure into a node of this tree. Parameters: url - string, required, specifies the URL from which to load the XML document. vars - query string, optional. */ load: function(url, vars) { var urlScript = 'cat-xml.php?cPath=' + (this.id); //window.alert('attempting to load: ' + urlScript); new Ajax(urlScript, { method: 'get', evalScripts: true, update: $('loadXML') }).request(); if (this.loading) return; // if this node is already loading, return this.loading = true; // flag this node as loading this.toggle(false, true); // expand the node to make the loader visible this.clear(); this.insert(this.control.loader); var f = function() { new XHR({ method: 'GET', onSuccess: this._loaded.bind(this), onFailure: this._load_err.bind(this) }).send(url, vars || ''); }; window.setTimeout(f.bind(this), 20); // allowing a small delay for the browser to draw the loader-icon. }, _loaded: function(text, xml) { // called on success - import nodes from the root element: this.control.disable(); this.clear(); this._import(xml.documentElement); this.control.enable(); this.loading = false; }, _import: function(e) { // import childnodes from an xml element: var n = e.childNodes; for (var i=0; i