
/* T R E E  D R A W I N G  M E T H O D S */

function getTreeColorFromDepth (depth)
{
	switch (depth)
	{
		case 0: return color2;
		default: return color1;
	}
}


function tree_drawItem (idx, depth, name, url, group, selected_state)
{
	var item;
	var size = depth * 6;
	
var img_blank	= '/shell/img/00.gif';
var img_opened	= '/shell/img/tree/open.gif';
var img_closed	= '/shell/img/tree/close.gif';
var img_leaf	= '/shell/img/tree/active.gif';

	navg_on='navg_on';	
	navg_off='navg_off';
	
	document.write (" \
	<DIV id='tree" + idx + "' style='position: absolute; z-index: " + (100 - depth) + "'> \
	<TABLE class='navg' cellpadding='0' cellspacing='0' border='0'>");
	if( idx == 0 )
	{
		document.write ("<tr><td class='colorsep' height='5'></td></tr>");	
	}
	document.write ("<tr> ");
	
	/*
	if (group)
	{
		document.write ("<TD width='14'><IMG id='img"+idx+"' src='"+img_closed+"' border='0'></TD>");
	}
	else
	{
		document.write ("<TD width='14'><IMG src='"+img_leaf+"'></TD>");
	}
	*/
    document.write ("<td class='navg_off' onMouseOver='this.className=navg_on' onMouseOut='this.className=navg_off' style='margin-left:10px'>");
    if (group)
	{
		document.write ("<IMG id='img"+idx+"' src='"+img_closed+"' border='0'>");
	}
	else
	{
		if (depth=='1') {
		//document.write ("<IMG src='"+img_leaf_n3+"'>");
		document.write ("&nbsp;&nbsp;-");
		}
		else {
		document.write ("<IMG src='"+img_leaf+"'>");
		}
	}    
     document.write ("&nbsp;"+ name + "</td> \
      </tr> \
      <tr> \
        <td class='colorsep' height='10'></td> \
      </tr> \
	<tr> \
	</TABLE></DIV> \
	");
	/*
	<TR height='15' bgcolor='" + getTreeColorFromDepth (depth) + "'> \
	<TD width='" + (size + 5) + "'><img src='/shell/img/00.gif' width='5' height='1' border='0'><IMG src='"+img_blank+"' width='" + size + "' height='1'></TD> ");
	
	if (group)
	{
		document.write ("<TD width='14'><IMG id='img"+idx+"' src='"+img_closed+"' border='0'></TD>");
	}
	else
	{
		document.write ("<TD width='14'><IMG src='"+img_leaf+"'></TD>");
	}
	
	document.write (" \
	<TD width='"+(148-14-5-size)+"' class='navg_off' onMouseOver='this.className=navg_on' onMouseOut='this.className=navg_off'>" + name + "</TD> \
	</TR> \
	*/
	

	item = document.getElementById ("tree" + idx);

	item.xsize = 150;
	item.ysize = 16;
	
	return item;
}



/*  M E N U  D R A W I N G   M E T H O D S  */


function drawMenuRoot (idx, data)
{
	var item;
	
	var hasUrl = (data[idx][0].length >= 2);
	var color = false;
	try
	{
		color = data[idx][0][2];
	}
	catch(e){}
	
	document.write (" \
		<DIV id='menu" + idx + "' style='position:absolute;z-index:300;'> \
			<TABLE cellspacing='0' cellpadding='0' border='0'>");
				document.write ("<tr> ");
					if( idx == 0 )
					{
						document.write ("<td class='colorsep' weight='1'></td>");	
					}
					
					navt_on='navt_on';	
					navt_off='navt_off';
					if( color )
					{
						navt_on='navt_on';	
						navt_off='navt_on';
					}
					
					document.write ("<td class='"+navt_off+"' ");
					if( navt_on!=navt_off )
					{
						document.write (" onMouseOver='this.className=navt_on' onMouseOut='this.className=navt_off'");
					}
					document.write(">"+ data[idx][0][0] + "</TD> \
					<td width='1' class='colorsep'></td> \
				</TR> \
			</TABLE> \
		</DIV> \
	");

	item = document.getElementById ("menu" + idx);
	
	if (hasUrl)
	{
		item.url = data[idx][0][1];
		item.onclick = menu_click;
	}
	/*if( color )
	{
		if( menu_color )
		{
			item2.bgColor = menu_color (true);
		}
	}
	else
	{
		item2.onmouseover = menu_setActive;
		item2.onmouseout = menu_setInactive;	
	}
	*/
	return item;
}
			
function menu_setActive ()
{
	if( menu_color )
	{
		this.bgColor = menu_color (true);
		this.color = '#FFFFFF';
	}
}

function menu_setInactive ()
{
	if( menu_color )
	{
		this.bgColor = menu_color(false);
		this.color = '#000000';
	}
}

function drawMenuContent (idx, data)
{
	var content;
	
	document.write (" \
	<DIV id='menu" + idx + "_content' style='position: absolute; z-index: 300'> \
	<TABLE cellspacing='0' cellpadding='0' border='0'> \
	");
	
	navt_on='navt_on';	
	navt_off='navt_off';

	for (var i = 1; i < data[idx].length; i++)
	{
		document.write (" \
		<TR> \
		<td width='1' class='color_bordure'></td> \
		<td id='menu"+idx+"_"+i+"' class='"+navt_off+"' onMouseOver='this.className=navt_on' onMouseOut='this.className=navt_off'> \
		"+ data[idx][i][0] + "</TD> \
		<td width='1' class='color_bordure'></td> \
		</TR> \
		");
		var td = document.getElementById ("menu"+idx+"_"+i);
		td.url = data[idx][i][1];
		td.onclick = menu_click;
	}
	
	document.write (" \
	<TR><TD colspan='4' height='1' class='color_bordure'></TD></TR> \
	</TABLE> \
	</DIV> \
	");
	
	content = document.getElementById ("menu" + idx + "_content");
	
	return content;
}