var locked = false;
var lockedOn = 0;
window.onload = init;
function init()
{
	// iterate over the bios and apply transformation classname
	var bios = document.getElementById('PeopleContainer');
	var pc = bios.getElementsByTagName('div');
	bios.className = "Transformed";
	for ( var i=0; i < pc.length; i++ )
	{
		if ( pc[i].className == 'PersonContainer' )
			pc[i].className = 'PersonContainerTransformed';
	}
	//iterate over the people menu, remove the anchor and add the handlers
	var menu = document.getElementById('PeopleMenu');
	var links = menu.getElementsByTagName('a');
	for ( var i=0; i < links.length; i++ )
	{
		id = links[i].href.substring( links[i].href.indexOf('#')+1, links[i].href.length);
		links[i].href='javascript:clicked('+id+')';
		eval("links[i].onmouseover = function(){mouseOver("+id+");}" );
		eval("links[i].onmouseout = function(){mouseOut("+id+");}" );
	}
	// add eventhandlers for Page Title easter egg
	var pt = document.getElementsByTagName('h1');
	for ( var i=0; i < pt.length; i++ )
	{
		if ( pt[i].className == "PageTitle" )
		{
			pt[i].onmouseover = showFunOne;
			pt[i].onmouseout = hideFunOne;
		}
	}
	//pull the curtain
	document.getElementById('Curtain').style.visibility = "hidden";
}

function mouseOver( id )
{
	if ( !locked )
		showInfo( id );
}

function mouseOut( id )
{
	if ( !locked )
		hideInfo( id );
}

function clicked( id )
{
	if ( locked && lockedOn == id )
	{
		locked = false;
		lockedOn = 0;
		document.getElementById('Link'+id).className = "";
		hideInfo( id );
	}
	else
	{
		if ( locked )
		{
			hideInfo( lockedOn );
			document.getElementById('Link'+lockedOn).className = "";
		}
		locked = true;
		lockedOn = id;
		showInfo( id );
		document.getElementById('Link'+id).className = "Locked";
	}
}

function showInfo( id )
{
	photo = document.getElementById('Photo'+id);
	bio = document.getElementById('PersonContainer'+id);

	photo.style.visibility = "visible";
	bio.style.visibility = "visible";
}
function hideInfo( id )
{
	photo = document.getElementById('Photo'+id);
	bio = document.getElementById('PersonContainer'+id);

	photo.style.visibility = "hidden";
	bio.style.visibility = "hidden";
}

function showFunOne(){document.getElementById('GroupPhotoFun').style.visibility = 'visible'; }
function hideFunOne(){document.getElementById('GroupPhotoFun').style.visibility = 'hidden'; }