var curid = '';
var selparentid = '';


function manipTree(treeid,pid)
{
	var parent	= document.getElementById(treeid);
	var dis = 'none';

	if(document.getElementById(curid) && (treeid != curid ))
	{
		document.getElementById(curid).style.display = 'none';
		curid = '';
	}

	if(selparentid != '' && pid == '' && document.getElementById(selparentid))
	{
		//hide parent if other parent sibling has clicked
		document.getElementById(selparentid).style.display = 'none';
		selparentid ='';
	}

	if(pid != 'undefined' || pid != null || pid != '')
	{
		//displaying parent
		if(document.getElementById(pid))
		{
			selparentid = pid;
			document.getElementById(pid).style.display = 'block';
		}
	}

	if(parent.style.display == 'none')
	{
		curid = treeid;
		var curParent = parent.parentNode.parentNode.getAttribute("id");

		dis = 'block';
	}


	parent.style.display = dis;
}



function manipTree123(treeid)
{
	var parent	= document.getElementById(treeid);
	var dis = 'none';

	if(document.getElementById(curid) && (treeid != curid ))
	{
		document.getElementById(curid).style.display = 'none';
		curid = '';
	}

	if(document.getElementById(selparentid) && (treeid != selparentid ) && selparentid != "treemenu1")
	{
		document.getElementById(selparentid).style.display = 'none';
		selparentid = '';
	}



	if(parent.style.display == 'none')
	{
		curid = treeid;
		var curParent = parent.parentNode.parentNode.getAttribute("id");

		if(curParent != null )
		{
			selparentid = curParent;
			document.getElementById(curParent).style.display = 'block';
		}

		dis = 'block';
	}


	parent.style.display = dis;
}



