function Tree_getSelectedIndex(id) {
	var tree = document.getElementById(id);
	if (tree != null) {
		var selIndex = tree.getAttribute("selIndex");
		if (selIndex == null) {
			tree.setAttribute("selIndex", -1);
			selIndex = -1;
		}
		return selIndex;
	} else {
		return -1;
	}
}

function Tree_setSelectedIndex(id, index) {
	var tree = document.getElementById(id);
	if (tree != null) {
		tree.setAttribute("selIndex", index);
		var statePostfix = getPostfixForState(getElementState(tree));
		var newClassName = id + statePostfix + "_" + index;
		if (statePostfix == "_Disabled") {
			newClassName = id + "_Disabled";
		}
		if (tree.className != newClassName) {
			tree.className = newClassName;
		}
	}
}
