var noArrowImg = false;
function selectTab(name,obj)
{
    var tab_arrow_img = '/template/skin/flycell/images/sidebar/arrow_d_small.gif';
    
	// grab the objects we're going to need
	var tab = obj;
	var link = null;
	
	for(var i=0; i<tab.childNodes.length;i++)
	{
		if(tab.childNodes[i].tagName == 'A')
		{
			link = tab.childNodes[i];
		}
	}
	
	var tabRow = obj.parentNode;
	var tabPane = tabRow.parentNode;
	var tabName = name;
	var i=1;
	
	// loop through the tabs until we find the one that was selected
	while ($(tabName+'Tab'+i))
	{
		// if we find it, grab it's index
		if ($(tabName+'Tab'+i) == tab)
			var index = i;
		
		if($(tabName+'Tab'+i))
		{
			$(tabName+'Tab'+i).className = 'tab';
		}
		
		// fade in the page we want to display
		new Effect.Opacity( $(tabName+'TabPage'+i), {duration:0.5, from:0.0, to:0.9999999} );
		
		$(tabName+'TabPage'+i).style.display = "none";
		if ( $(tabName+'TabNav'+i) )
		{
			$(tabName+'TabNav'+i).style.display = "none";
		}
		if ( $(tabName+'TopTabNav'+i) )
		{
			$(tabName+'TopTabNav'+i).style.display = "none";
		}
		if ( $(tabName+'TabImg'+i))
		{
			$(tabName+'TabImg'+i).remove(tabName+'TabImg'+i);
		}
		i++;
	}
	
	// now open only the tab that was just selected
	tab.className = tab.className + " selected";
		
	if (!noArrowImg)
	{
		var arrowImg = document.createElement('img');
		arrowImg.src = tab_arrow_img;
		arrowImg.id = tabName+'TabImg'+index;
		if (link)
		{
			link.appendChild(arrowImg);
		}
	}
	
	$(tabName+'TabPage'+index).style.display = "block";
	
	if( $(tabName+'TabNav'+index))
	{
		if ( $(tabName+'TabNav'+index).tagName == 'TABLE')
		{
			$(tabName+'TabNav'+index).style.display = "table";
		}
		else
		{
			$(tabName+'TabNav'+index).style.display = "block";
		}
	}
	
	if( $(tabName+'TopTabNav'+index))
	{
		if ( $(tabName+'TopTabNav'+index).tagName == 'TABLE')
		{
			$(tabName+'TopTabNav'+index).style.display = "table";
		}
		else
		{
			$(tabName+'TopTabNav'+index).style.display = "block";
		}
	}
}
