//bios 2.0

var exec = new Array();
var lead = new Array();
var selectedExec = 0;
var selectedLead = 0;


function employee(first, last, type, order, titleText)
{
	this.first = first;
	this.last = last;
	var escapedName = first + "_" + last;
	var imagesPath = "images/"
	this.bw = imagesPath + "thumbs/bw_" + escapedName + ".jpg";
	this.color = imagesPath + "thumbs/" + escapedName + ".jpg";
	this.large = imagesPath + type + "_img/" + escapedName + ".jpg";
	this.title = "<h3>" + first + " " + last + "</h3>" + titleText;
	if(type == "exec")
	{
		exec[order] = this;
	}
	else
	{
		lead[order] = this;
	}
	var thumbNum = order+1;
	this.thumb = document.getElementById(type + 'Thumb' + thumbNum);
	this.bio = document.getElementById(last);
	if(order == 0)
	{
		this.thumb.src = this.color;//on default make the first thumb color
	}
	else
	{
		this.thumb.src = this.bw;
	}
}



//exec functions

function mouseOverExec(currentExec)
{
	exec[currentExec].thumb.src = exec[currentExec].color;
}

function mouseOutExec()
{
	for(i=0; i<exec.length; i++)
	{
		if(i != selectedExec)
		{
			exec[i].thumb.src = exec[i].bw;
		}
	}
}

function clickExec(currentExec)
{
	selectedExec = currentExec;
	exec[currentExec].thumb.src = exec[currentExec].color;
	execLarge.src = exec[currentExec].large;
	for(i=0; i<exec.length; i++)
	{
		if(i != currentExec)
		{
			exec[i].thumb.src = exec[i].bw;
			exec[i].bio.style.display = "none";
		}
	}
	exec[currentExec].bio.style.display = "block";
	execHeader.innerHTML = exec[currentExec].title;
}

//lead funks
function mouseOverLead(currentLead)
{
	lead[currentLead].thumb.src = lead[currentLead].color;
}

function mouseOutLead()
{
	
	for(i=0; i<lead.length; i++)
	{
		if(i != selectedLead)
		{
			lead[i].thumb.src = lead[i].bw;
		}
	}
}

function clickLead(currentLead)
{
	selectedLead = currentLead;
	lead[currentLead].thumb.src = lead[currentLead].color;
	leadLarge.src = lead[currentLead].large;
	for(i=0; i<lead.length; i++)
	{
		if(i != currentLead)
		{
			lead[i].thumb.src = lead[i].bw;
			lead[i].bio.style.display = "none";
		}
	}
	lead[currentLead].bio.style.display = "block";
	leadHeader.innerHTML = lead[currentLead].title;
}
