function ToolBar_StartUp(toolbarID)
{
	var ToolBar_ToolBarButtons_Depressed = document.getElementById(toolbarID + "_ToolBarButtons_Depressed");
	var buttons = ToolBar_ToolBarButtons_Depressed.value.split(",");
	for(var i=0; i < buttons.length; i++)
	{
		var buttonID = buttons[i];
		if(buttonID == "")
			continue;
		
		var toolbarButton = new ToolBarButton();
		toolbarButton.name = buttonID;	
		toolbarButton.Depressed = true;
		
		if(typeof(ToolBar_Click) == "function")
			ToolBar_Click(toolbarButton, null);
		
		var htmlButton = document.getElementById(buttonID);
		htmlButton.className = "ToolBarButton_Depressed";
		htmlButton.setAttribute("depressed", "true");
	}
	return;	
}

function ToolBarButton()
{
	this.Name = null;
	this.Depressed = false;
}

function ToolBarButton_Click()
{
	return;
	var button = window.event.srcElement;
	while(button.tagName != "BUTTON")
		button = button.parentElement;
	button.blur();
	
	var toolbarButton = new ToolBarButton();
	toolbarButton.Name = button.id;	
	toolbarButton.Depressed = false;
	
	if(typeof(ToolBar_Click) == "function")
		ToolBar_Click(toolbarButton, null);

	// add/remove from depressed state bag
	var ToolBar_ToolBarButtons_Depressed = document.getElementById("ToolBar_ToolBarButtons_Depressed");
	var depressedToolBarButtons = ToolBar_ToolBarButtons_Depressed.value;
	
	if(!toolbarButton.Depressed)
	{
		button.setAttribute("depressed", "false");
		button.className = "ToolBarButton_Over";
		
		if(depressedToolBarButtons.indexOf("," + toolbarButton.name) > -1)
			depressedToolBarButtons = depressedToolBarButtons.replace("," + toolbarButton.name, "");
	}
	else
	{
		button.setAttribute("depressed", "true");
		button.className = "ToolBarButton_Depressed";
		
		if(depressedToolBarButtons.indexOf(toolbarButton.name) == -1)
			depressedToolBarButtons += "," + toolbarButton.name;
	}

	ToolBar_ToolBarButtons_Depressed.value = depressedToolBarButtons;
	
	return;
}

function ToolBarButton_Over(e)
{
	var button = fnEventTrigger(e);
	while(button.tagName != "BUTTON")
		button = button.parentElement;
	fnSetClass(button, "ToolBarButton_Over", "ToolBarButton_Depressed");
}

function ToolBarButton_Up(e)
{
	var button = fnEventTrigger(e);
	while(button.tagName != "BUTTON")
		button = button.parentElement;
	fnSetClass(button, "ToolBarButton", "ToolBarButton_Depressed");
}

function ToolBarButton_Out(e)
{
	var button = fnEventTrigger(e);
	while(button.tagName != "BUTTON")
		button = button.parentElement;
	fnSetClass(button, "ToolBarButton", "ToolBarButton_Depressed");
}

function ToolBarButton_Down(e)
{
	var button = fnEventTrigger(e);
	while(button.tagName != "BUTTON")
		button = button.parentElement;
	fnSetClass(button, "ToolBarButton", "ToolBarButton_Depressed");
}

function fnEventTrigger(e)
{
	if (!e) e = event;
	return e.target || e.srcElement;
}

function fnSetClass(button, className, classNameDepressed)
{
	button.blur();
	var depressed = button.getAttribute("depressed");
	if(depressed == null || depressed == "false")
		button.className = className;
	else
		button.className = classNameDepressed;
}