function PicassoTabSelected(tabContainerClientID, tabButtonsContainerClientID, tabPanelClientID, selectedTabButtonID)
{
	var tabContainer = document.getElementById(tabContainerClientID);
	var showItem = null;

	// First, configure the tab buttons
	PicassoHighlightTabButton(tabButtonsContainerClientID, selectedTabButtonID);
    
    // Second configure the tab panels
	for (i = 0; i < tabContainer.childNodes.length; i++)
	{
		var child = tabContainer.childNodes[i];

		if (child.nodeName == "#text" || child.id == undefined || child.id == tabButtonsContainerClientID || child.id == "")
		{
			continue;
		}
		else if (child.id == tabPanelClientID)
		{
		    showItem = child;
		}
		else
		{
			child.style.display = "none";
		}
	}

	if (showItem != null)
	{
	    document.cookie = 'selectedtabCookie = ' + showItem.getAttribute("itemID");
		showItem.style.display = "";
	}
}

function PicassoHighlightTabButton(tabButtonsContainerID, selectedTabButtonID)
{
	var tabButtons = document.getElementById(tabButtonsContainerID);
    
	for (i = 0; i < tabButtons.childNodes.length; i++)
	{
		var child = tabButtons.childNodes[i];

		if (child.nodeName == "#text" || child.id == undefined || child.id == "")
		{
			continue;
		}
		else if (child.id == selectedTabButtonID)
		{
			child.className = child.getAttribute("tabButtonSelectedStyle");
		}
		else
		{
			child.className = child.getAttribute("tabButtonUnselectedStyle");
		}
		

		child.setAttribute("onmouseout", "javascript:this.className='" + child.className + "'");

	}
}
