// JAVASCRIPT FOR THE OLYMPIC STAFF PAGE

// MOUSE OVER
function StaffSIndMOver(pThisSInd)
{
	StaffSIndHL(pThisSInd);
}

// MOUSE OUT
function StaffSIndMOut(pThisSInd)
{
	StaffSIndUHL(pThisSInd);
}

// MOUSE CLICK
function StaffSIndMClick(pThisSInd, pSIndsTable, pBIndTitles, pBIndOffice, pBIndPics, pBIndBios)
{
	var i;
	var vCmnNumId      = pThisSInd.id.match(/\d+/); // The Common Number in the id of the corresponding individual's pieces.
	var vCmnCharId     = 'Ind' + vCmnNumId;         // The Common Characters at the beginning in the id of the corresponding individual's pieces.	
		
	// VARIABLES - SMALL INDIVIDUALS
	var vSIndsTableId  = document.getElementById(pSIndsTable);     // The ID of the Tag that holders all the corresponding pieces
	var vSIndsTableTDs = vSIndsTableId.getElementsByTagName('td'); // HTML Tag that is holding all the corresponding pieces
	var vSIndTxt       = pThisSInd.getElementsByTagName('td')[0];
	
	for (i = 0; i < vSIndsTableTDs.length; i++)
	{
		if (vSIndsTableTDs[i].className == 'StaffSmallTitleTDSel')
		{
			vSIndsTableTDs[i].className = 'StaffSmallTitleTD';
			vSIndsTableTDs[i].style.color = '';
		}
	}
	vSIndTxt.className = 'StaffSmallTitleTDSel';
	vSIndTxt.style.color = '#ff0000';
	
	// VARIABLES - BIG IND PIECES
	var vBIndTitleId  = document.getElementById(vCmnCharId+'BTitle');
	var vBIndOfficeId = document.getElementById(vCmnCharId+'BOffice');
	var vBIndPicId    = document.getElementById(vCmnCharId+'BPic');
	var vBIndBioId    = document.getElementById(vCmnCharId+'BBio');
	var vBFDListId    = document.getElementById('Front Desk');
	var vBTAListId    = document.getElementById('Therapy Assistants');
		
	// BIG IND TITLES
	StaffIndPieceReveal(pBIndTitles, 'span', vBIndTitleId, 'StaffBigTitleTxtSel', 'StaffBigTitleTxt');
	
	// BIG IND OFFICE
	StaffIndPieceReveal(pBIndOffice, 'span', vBIndOfficeId, 'StaffBigOfficeTxtSel', 'StaffBigOfficeTxt');
	
	// BIG IND PICS
	StaffIndPieceReveal(pBIndPics, 'img', vBIndPicId, 'StaffBigImgSel', 'StaffBigImg');
	if (vBIndPicId.alt == "none") { vBIndPicId.className = 'StaffBigImg'; } // If there is no image, set the class name to StaffBigImg so nothing will show up.
	
	// BIG IND BIO'S
	StaffIndPieceReveal(pBIndBios, 'p', vBIndBioId, 'StaffBigBioTxtSel', 'StaffBigBioTxt');
	
	// FRONT DESK LIST APPEAR
	FDorTAReveal(pThisSInd, vCmnCharId, vBFDListId);
	
	// THERAPY ASSISTANTS LIST APPEAR
	FDorTAReveal(pThisSInd, vCmnCharId, vBTAListId);
}

/*------------------------------------------------------------------------
	Loop through the specified wrapper tag in the corresponding part
	and if any tags have the class name "Selected" change it to the
	"Not Selected" class name so that everything will disappear or 
	what ever action. Then after after the loop, set the corresponding
	tag's class name to the "Selected" class name so that it will appear.
--------------------------------------------------------------------------*/
function StaffIndPieceReveal(pIndWrapperId, pIndWrapperTag, pIndPieceId, pClassNameSel, pClassNameNotSel)
{
	var vIndWrapperId  = document.getElementById(pIndWrapperId);             // The ID of the Tag that holders all the corresponding pieces
	var vIndWrapperTag = vIndWrapperId.getElementsByTagName(pIndWrapperTag); // HTML Tag that is holding all the corresponding pieces
	
	for (i = 0; i < vIndWrapperTag.length; i++)
	{
		if (vIndWrapperTag[i].className == pClassNameSel)
		{
			vIndWrapperTag[i].className = pClassNameNotSel;
		}
	}
	pIndPieceId.className = pClassNameSel;
}

/*------------------------------------------------------------------------
	This is to make the Front Desk or Therapy Assistants appear.
--------------------------------------------------------------------------*/
function FDorTAReveal(pThisSInd, pCmnCharId, pFDorTAId)
{
	if (pThisSInd.id == (pCmnCharId+pFDorTAId.id))
	{
		pFDorTAId.className = 'StaffBigBioTxtSel';
	}	
}


// HIGHLIGHT CONTROLLER - SMALL INDIVIDUAL
function StaffSIndHLController(pThisSInd, pSIndTxtColor)
{
	var vSIndTxt = pThisSInd.getElementsByTagName('td')[0];
	
	if (vSIndTxt.className != 'StaffSmallTitleTDSel')
	{
		vSIndTxt.style.color = pSIndTxtColor;
	}	
}

// HIGHLIGHT - SMALL INDIVIDUAL
function StaffSIndHL(pThisSInd) {
	StaffSIndHLController(pThisSInd, '#0066ff');
}

// UNHIGHLIGHT - SMALL INDIVIDUAL
function StaffSIndUHL(pThisSInd) {
	StaffSIndHLController(pThisSInd, '');
}
















