function treeToggle()
{
	$(this).parent()
	.toggleClass('open');
	$(this).parent().parent().find('ul:eq(0)')
	.toggleClass('current');
	$(this)
	.html($(this).html() == '+' ? '-' : '+')
	.parent().blur();
	return false;
}

function treeOpen(id)
{
	$('#'+id+' li').each(function(i)
	{
		if($(this).find('ul').length > 0)
		{
			if($(this).find('ul:eq(0)').attr('class') != 'current')	$(this).find('a:eq(0)').find('span:eq(0)').click()
		}
	});
	return
}

function treeSet(id, current)
{
	$('#'+current).parents("li not[id = "+id+"]").each(function(i)
	{
		if($(this).find('ul').length > 0)
		{
			if($(this).find('ul:eq(0)').attr('class') != 'current')	$(this).find('a:eq(0)').find('span:eq(0)').click()
		}
	});
	return
}

function treeSetup(id, toggle_cb, lclk_cb, rclk_cb)
{
	$('#'+id+' li').each(function(i)
	{
		if(lclk_cb) $(this).find('a:eq(0)').bind("click", lclk_cb)
		if(lclk_cb) $(this).find('a:eq(0)').bind("click", lclk_cb)
		if($(this).find('ul').length > 0)
		{
			var t_arr = $(this).find('ul:eq(0)').attr('class') == 'current'? "-" : "+";
			t_arr = '<span>'+t_arr+'</span>';
			$(this).find('a:eq(0)').prepend(t_arr)
			$(this).find('a:eq(0)').find('span:eq(0)').bind("click", toggle_cb)
			$(this).find('a:eq(0).current').find('span:eq(0)').click()
		}
	});
	return
}
