function HideAll(eSrc,iGroupNumber) {
	if (((eSrc.tagName == "IMAGE") || (eSrc.tagName == "IMG")) && (eSrc.parentElement.parentElement.tagName == "TR"))
		eSrc = eSrc.parentElement.parentElement;
	else if (eSrc.tagName != "TR")
		return false;
	iGroupNumber = Number(iGroupNumber);
	if (eSrc.nextSibling && !isNaN(iGroupNumber)) {
		var eNext = eSrc.nextSibling;
		if (eNext.id)
			var iNextGroupNumber = Number(eNext.id);
		else
			var iNextGroupNumber = Number(eNext.GroupNumber);
		if (iGroupNumber < iNextGroupNumber) {
				if (eNext.className == "child") {
					if (eNext.firstChild.children(1).className == "eBranch") {
						HideAll(eNext);
						eNext.firstChild.children(1).src = "includeweb/skin/images/portal/001/list/plus.gif";
						eNext.firstChild.children(1).className = "";
						eNext.style.display = "none";
					}
					else if ((eNext.firstChild.children(1).className == "uBranch") || (eNext.firstChild.children(1).className == "leaf")) {
						eNext.style.display = "none";
					}
				}
				if (eSrc.firstChild.children(1).className != "leaf") {
					eSrc.firstChild.children(1).src = "includeweb/skin/images/portal/001/list/plus.gif";
					eSrc.firstChild.children(1).className = "uBranch";
					eSrc.style.display = "none";
				}	
			HideAll(eNext,iGroupNumber);
		}
		else {
			return true;
		}
	}
}

function showAll(eSrc,iGroupNumber) {
	if (document.all)
		var eParent = eSrc.parentElement.parentElement;
	else
		var eParent = eSrc.parentNode.parentNode;

	if ((eSrc.tagName == "IMG") && (eParent.tagName == "TR"))
		eSrc = eParent;
	else if (eSrc.tagName != "TR")
		return false;

	iGroupNumber = Number(iGroupNumber);


	if (eSrc.nextSibling && !isNaN(iGroupNumber)) {
		if (eSrc.nextSibling)
			var eNext = eSrc.nextSibling;
		else
			var eNext = eSrc.childNodes[0];
	
		if (eNext.id)
			var iNextGroupNumber = Number(eNext.id);
		else
			var iNextGroupNumber = Number(eNext.GroupNumber);

		if (iGroupNumber < iNextGroupNumber) {

			if ((iGroupNumber + 1) == iNextGroupNumber) {
				if ((eNext.className == "child") || (eNext.className == "leaf")) {
					eNext.style.display="";
				}
			} 
			showAll(eNext,iGroupNumber);
		}
		else {
			return true;
		}
	}
}

function Toc_click() {
	// This grabs the event from either netscape OR ie
	var theEvent=window.event || arguments.callee.caller.arguments[0];

	if (theEvent.target)
	{
		// netscape
		var eSrc = theEvent.target;
		var eParent = eSrc.parentNode.parentNode;
		var eNext = eParent.childNodes[0];
	}
	else
	{
		//ie
		var eSrc = theEvent.srcElement;
		var eParent = eSrc.parentElement.parentElement;
		var eNext = eParent.nextSibling;
	}


	if ((eNext != null) && ((eSrc.tagName == "IMG") || (eSrc.tagName == "IMAGE"))) {
		if (eSrc.className == "uBranch") {
			eSrc.src="includeweb/skin/images/portal/001/list/minus.gif";
			eSrc.className="eBranch";

			if (eNext.id)
				var iIdentifier = Number(eParent.id);
			else
				var iIdentifier = Number(eParent.GroupNumber);

			showAll(eParent, iIdentifier);
		}
		else if (eSrc.className == "eBranch") {
			eNext.style.display = "none";
			eSrc.src = "includeweb/skin/images/portal/001/list/plus.gif";
			eSrc.className = "uBranch";

			if (eNext.id)
				var iIdentifier = Number(eParent.id);
			else
				var iIdentifier = Number(eParent.GroupNumber);

			HideAll(eNext, iIdentifier);
		}
	}
}
function checkForm(form,action) {
	var x = true;
	if (action == "add") {
		if (document.forms(form).AttributeGroupID.value == "") {
			alert("You have not saved the attribute group.");
			x = false;
		}
	}
	else if (action == "edit" || action == "delete") {
		if (document.forms(form).AttributeID.selectedIndex < 0) {
			alert("You must select an attribute to " + action + ".");
			x = false;
		}
	}
	return x;
}