var openImg = new Image();
openImg.src = "images/tree-minus.gif";
var closedImg = new Image();
closedImg.src = "images/tree-plus.gif";

function showBranch(branch, intElementID){
	var objBranch = document.getElementById(branch).style;
	var strClassName = document.getElementById(branch).className;
	var strCurrentDisplay = objBranch.display;

	if (strCurrentDisplay == "") {
		if (strClassName == "branchOn")
			strCurrentDisplay = "block";
		else
			strCurrentDisplay = "none";
	}

	if (strCurrentDisplay == "block")
		objBranch.display = "none";
	else
		objBranch.display = "block";

	swapFolder('I' + branch, false);
}


function swapFolder(img, blnAlwaysOpen){
	objImg = document.getElementById(img);

	if (objImg.src.indexOf('tree-plus.gif')>-1)
		objImg.src = openImg.src;
	else
		objImg.src = closedImg.src;
}

function highlightElement(intElementID, blnAlwaysOpen){
	if (intElementID > 0){
		highlightedElement.style.fontWeight = 'normal';
		if (document.getElementById('Lnode'+intElementID)){
			document.getElementById('Lnode'+intElementID).style.textDecoration = 'underline';
			highlightedElement = document.getElementById('Lnode'+intElementID);
		}


		if (blnAlwaysOpen){
			var objBranch = document.getElementById('node'+intElementID).style;
			var strClassName = document.getElementById('node'+intElementID).className;
			var strCurrentDisplay = objBranch.display;

			if (strCurrentDisplay == "") {
				if (strClassName == "branchOn")
					strCurrentDisplay = "block";
				else
					strCurrentDisplay = "none";
			}

			if (strCurrentDisplay == "none"){
				objBranch.display = "block";
				swapFolder('Inode' + intElementID, blnAlwaysOpen);
			}
		}

	}
}

function goToSubSection(strSectionIDs){
	var objFrmGoToSubSection = document.frmGoToSubSection
	if (objFrmGoToSubSection){
		objFrmGoToSubSection.sectionids.value = strSectionIDs;
		objFrmGoToSubSection.submit();
	}
}

