function clearAllTabs(ts)
{

 for( k=1; k<=ts; k++ )
	{
		document.getElementById('menulink'+k).className='normal';
		document.getElementById('menutab'+k).style.display='none';
	}
		document.getElementById('menulink'+ts).className='t-last';
}


function clearSelectedTab(disableId,ignoreId){
  
	for( k=1; k<=disableId; k++ ){
		if ( k != ignoreId){
			document.getElementById('menulink'+k).className='normal';
			document.getElementById('menutab'+k).style.display='none';
		}
	}
}



function menuSelectTab(id)
{
var el = document.getElementById("segment-navigation");
var children = el.childNodes;
var lis = children.length;
	
if(window.navigator.appName == "Netscape")
{
 	if (lis == 13)
	{
	lis = 6;
	}
	else if (lis == 11)
	{
	lis = 5;
	}
	else if (lis == 9)
	{
	lis = 4;
	}
	else if (lis == 5)
	{
	lis = 2;
	}
	else if (lis == 7)
	{
	lis = 3;
	}
}
	clearAllTabs(lis);
      
	document.getElementById('menulink'+id).className='select';
	document.getElementById('menutab'+id).style.display='inline';
}


var time=null;
var selectdelay = 0;
var deselectdelay = 0;
var clearTabs = false;
function delay(t,id) {
      
	if(t) {
		clearTabs = false;
		time = setTimeout("menuSelectTab("+id+")",selectdelay);
	}else{
		if(time) {
			clearTabs = true;
			setTimeout("clearAll()",deselectdelay);
			clearTimeout(time);
			time=null;
		}
	}
}




function clearAll() {
 if ( clearTabs ) clearAllTabs(6);
}

function tabsOut (){
	clearTabs=true;
	setTimeout('clearAll()',deselectdelay)
}


function tabcheck()
{
    var x = window.location.search.substring(1)
    if ( x.indexOf('tid')!=-1 )
    {
        var i_array = x.split('=')
        var tab = i_array[1];
        selectTab(tab)
    }
}
addLoadEvent(tabcheck);