treenode.prototype.getXMLAttribute = function(attributeName){
	if(this.hasXMLAttributes){
		return this.xmlNode.getAttribute(attributeName);
	}else{
		var details = 'what happened: xml attributes not available';
		alert('an error occured within treenode.prototype.getXMLAttribute: \n\ndetails:\nrequested xml attribute:' + attributeName);
	}
}

treenode.prototype.alertXMLAttributes = function(){
	var str = '';
	var attrs = this.xmlNode.attributes;
	for (var i = 0; i < attrs.length; i++){
		str += 'attribute:'+attrs[i].nodeName+' value:'+attrs[i].nodeValue+'\n';
	}
	alert(str);
}

treenode.prototype.hasXMLAttributes = function(){
	if(this.xmlNode){
		if(this.xmlNode.attributes){
			return true;
		}else{
			return false;
		}
	}
}
treenode.prototype.selectByXMLAttributePath = function(attribute,path){
	
	var path;
	var attribute;
	
	if(this.src && !this.loaded){
		var self = this;
		this.eventManager.addListener("onload",function(){self.selectByXMLAttributePath(attribute,path)},'once');
		this.load();
		return;
	}			
	
	path = path.split(",");
	
	var found = false;
	for(i=0;i<this.oNodeChilds.childNodes.length;i++){
		
		if(this.oNodeChilds.childNodes[i].obj.getXMLAttribute(attribute) == path[0]){
			//treeview object has no expand function
			if(this.expand){
				this.expand();
			}
			this.oNodeChilds.childNodes[i].obj.select();
			found = true;
			break;
		}
	}
	
	if(!found){
		details = 'what happened: no childnodes found with provided xml attribute\nprovided attribute: '+path[0];
		alert('an error occured within treenode.prototype.selectByXMLAttributePath or treeview.prototype.selectByXMLAttributePath: \n\ndetails:\n' + details);
	}else{
		if(path.length > 1){
			var tmp = '';
			for(i=1;i<path.length;i++){
				tmp += path[i];
				if(i<path.length-1){
				tmp += ',';
				}
			}
			path = tmp;
			this.treeview.selectedNode.selectByXMLAttributePath(attribute,path);
		}
	}
}
treeview.prototype.selectByXMLAttributePath = treenode.prototype.selectByXMLAttributePath;
