var doc = document.all
var intLastSelectedDiv = -1;
var intLastSelectedID = -1;

function OpenMainDiv()
{	
	/* This function is called to open or close a first level menu, 
		when the users clicks on the + / -
	*/
	
	var intID = event.srcElement.id.substr(8);
	if (doc.divMain[intID].style.display=="none")
	{
		doc.divMain[intID].style.display="";
		doc.imgMain[intID].src = "oursite/images/ballopen.GIF";	
		intLastSelectedDiv = intID
		return true
	}
	else
	{
		doc.divMain[intID].style.display="none"
		doc.imgMain[intID].src = "oursite/images/ballClosed.GIF";		
		intLastSelectedDiv = intID
		return false
	}
}
var blnIsHome = true
function SelectItem(strAction,intSpanID)
{
	/*This function is called when the user selects a team name from the team tree

		intSpanID - the ID of the span that was selected
		intTeamID - the ID of the selected team
	*/
	blnIsHome = false
	ChangeImage(false)
	ChangeColor(intSpanID);
	if (strAction !=null)
	{
		var strLocation = strAction + '.html'
		document.frames("ifrmContents").location = strLocation
	}
	return true;
}


function SelectItemFromIndex(strAction,intSpanID)
{
	/*This function is called when the user selects a team name from the team tree

		intSpanID - the ID of the span that was selected
		intTeamID - the ID of the selected team
	*/
	blnIsHome = false
	ChangeImage(false)
	ChangeColor(intSpanID);
	if (strAction !=null)
	{
		var strLocation = 'oursite/' + strAction + '.html'
		document.frames("ifrmContents").location = strLocation
	}
	return true;
}

function SelectHome()
{
	//This function is called to load the home page
	//ChangeImage(true)
	//ChangeColor(0)
	document.frames("ifrmContents").location = 'oursite/home.html'
	blnIsHome = true
}

function ChangeColor(intSpanID)
{
	/*This function is called to color the selected name, 
		and to uncolor the last name that was selected
	
		intSpanID - the ID of the span to be colored
	*/
	
	if (intLastSelectedID > -1)
	{
		doc.spanItems[intLastSelectedID].className = "clsNodeName";
		doc.spanItems[intLastSelectedID].style.color = "";
	}
	
	intLastSelectedID = intSpanID;
	doc.spanItems[intSpanID].className = "clsSelectedNodeName";
	return;
}

function ChangeImage(blnOn)
{
	if (blnIsHome)
		return
	if(blnOn)
		doc.imgHome.src = 'oursite/images/logo_hover.gif'
	else
		doc.imgHome.src = 'oursite/images/logo.gif'
}

function reverseColor()
{

	source = event.srcElement;
	if (source.className.indexOf('Selected')<0)
	{
		if (source.style.color == '')
			source.style.color = '#ffcc33';
		else
			source.style.color = '';
	}
}

function SelectOther(strAction,intSpanID)
{
	/*
		intSpanID - the ID of the span that was selected
	*/
	blnIsHome = false
	ChangeImage(false)
	ChangeColor(intSpanID);
	if (strAction !=null)
	{
		var strLocation = strAction
		document.frames("ifrmContents").location = strLocation
	}
	return true;
}