var teamList = new Array();
var teamListI = 0;
var openNewsItem = null;
var openNewsItemHidden = true;

var portfolioList = Array();
var portfolioListI = 0;
function startTeam() {
	var list = document.getElementById('teamList');
	for(i=0; i<list.childNodes.length; i++)
	{
		var attr = list.childNodes[i].attributes;		
		if(attr!= null)
		{
			teamList[teamListI] = new Array();			
			var rel = false;
			for(j=0;j<attr.length;j++)
			{
				if(attr[j].nodeName == 'rel')
				{
					rel = attr[j].nodeValue;
				}
			}
			teamList[teamListI]['rel'] = new Array();
			if(rel != false)
			{
				rel = rel.split(';');
				for (j=0; j<rel.length; j++)
				{
					teamList[teamListI]['rel'].push(rel[j]);
				}
			}
			list.childNodes[i].childNodes[0].setAttribute('onClick', "togleTeamList('"+teamListI+"', this)");
			teamList[teamListI]['node'] = list.childNodes[i].childNodes[0];
			teamList[teamListI]['visible'] = false;
			teamListI = teamListI + 1;
		}
		
	}
	$('.toggle').hide();
}


function togleTeamList(item, element)
{
	if(teamList[item])
	{
		teamList[item]['visible'] = !teamList[item]['visible'];
		$(element).next().toggle('slow');	

	}
}

function startNews() {
	$('.toggle').hide();
}

function toggleNewsEntry(item) {
	var id;
	id = '#'+item;
	if(id != openNewsItem) {
		$('.toggle').hide('slow');
	}
	$(id).toggle('slow');
	openNewsItem = id;
}


function highlight(itemname)
{
	$('.toggle').hide('slow');
	for(i=0; i<teamList.length; i++)
	{
		for(j=0; j<teamList[i]['rel'].length; j++)
		{
			if(itemname == teamList[i]['rel'][j])
			{
				$(teamList[i]['node']).next().toggle('slow');
				break;
			}
		}
	}
}


function startPortfolio() {
	$('.portfolio_hide').css('visibility', 'hidden');
	var list = document.getElementById('mainleft');
	for(i=0; i<list.childNodes.length; i++)
	{
		var attr = list.childNodes[i].attributes;		
		if(attr!= null)
		{
			portfolioList[portfolioListI] = new Array();			
			var rel = false;
			for(j=0;j<attr.length;j++)
			{
				if(attr[j].nodeName == 'rel')
				{
					rel = attr[j].nodeValue;
				}
			}
			portfolioList[portfolioListI]['rel'] = new Array();
			if(rel != false)
			{
				rel = rel.split(';');
				for (j=0; j<rel.length; j++)
				{
					portfolioList[portfolioListI]['rel'].push(rel[j]);
				}
			}
			portfolioList[portfolioListI]['node'] = list.childNodes[i].childNodes[0];
			portfolioList[portfolioListI]['visible'] = false;
			portfolioListI = portfolioListI + 1;
		}
		
	}
	
}

function highlightPortfolio(itemname) {
	$('.portfolio_hide').css('visibility', 'visible');
	for(i=0; i<portfolioList.length; i++)
	{
		for(j=0; j<portfolioList[i]['rel'].length; j++)
		{
			if(itemname == portfolioList[i]['rel'][j])
			{
				$(portfolioList[i]['node']).children('.portfolio_hide').css('visibility', 'hidden');
				break;
			}
		}
	}

}







