
var image_tree_sign_plus = new Image();
var image_tree_sign_minus = new Image();
var image_tree_group_open = new Image();
var image_tree_group_closed = new Image();

var txtExpand;
var txtCollapse;

function findObj(n, d) {
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function clickOnGroup(id) {
	var expand;
	var group = findObj(id);
	
	if (group && group.style) {
		if (group.style.display == "none")
			expand = true;
		else
			expand = false;
	}
	var imga = findObj("imga_" + id);
	var imgb = findObj("imgb_" + id);

	// switch the sign
	if (expand) {
		imga.src = image_tree_sign_minus.src;
		imga.alt = txtCollapse;
		imgb.src = image_tree_group_open.src;
		group.style.display = "block";
	} else {
		imga.src = image_tree_sign_plus.src;
		imga.alt = txtExpand;
		imgb.src = image_tree_group_closed.src;
		group.style.display = "none";
	}
}

function treeShowStatus(id) {
	var expand;
	var group = findObj(id);
	
	if (group && group.style) {
		if (group.style.display == "none")
			expand = true;
		else
			expand = false;
	}
	
	// show the window status
	if (expand) {
		window.status = txtExpand;
	} else {
		window.status = txtCollapse;
	}
	return true;
}

function treeClearStatus(id) {
	window.status = "";
	return true;
}


