// JavaScript Document

// Senate is an array of arrays of the form:
	// [first name,last name,quad,email,senate status,RO status,UOC,GA,App,COC,bio]
	// Where the status for the senate/committees are C,V,R,M for Chair, Vice Chair, Ranking
	// Member (Parlimentarian), Member or Non-member. Quads are coded A,C,D,I,S,E,F,O,L for
	// Alumni, Colonial, Dutch, Indian, State, Empire, Freedom, Off-campus or At-Large.
	
	var senate=	[
				["Rebecca","Fioravanti","N","sa@albany.edu","A","N","N","N","N","A","No Biography on File"],
				["Whitney","Martinez","A","WM692265@albany.edu","M","M","N","N","N","N","No Biography On File"],
["John","Watts","A","jw683235@albany.edu","M","N","N","M","N","N","No Biography On File"],
["Irving","Burbano","L","ib982551@albany.edu","M","N","N","N","M","N","No Biography On File"],
["Akwasi","Danso","L","ad971123@albany.edu","M","C","N","N","N","M","No Biography On File"],
["Julie","Gondar","L","jg338961@albany.edu","M","N","N","N","R","N","No Biography On File"],
["Lisa","Grant","L","lg859189@albany.edu","M","N","M","N","N","N","No Biography On File"],
["Ben","Jacobs","L","ben.h.jacobs@gmail.com","M","N","N","M","N","N","No Biography On File"],
["Kelsey","Kyte","L","kk837238@albany.edu","M","N","N","N","M","N","No Biography On File"],
["Michelle","Mittler","L","mm475636@albany.edu","M","N","N","N","M","N","No Biography On File"],
["Katherine","Murtha","L","km243862@albany.edu","M","N","N","C","N","M","No Biography On File"],
["Erica","Torres","L","etorres95@yahoo.com","M","N","N","R","N","N","No Biography On File"],
["Paul","McCarthy","L","mccarthy1988@gmail.com","C","N","N","N","N","C","No Biography On File"],
["Michael","Blaustein","C","Blaustein22@gmail.com","M","V","N","N","N","N","No Biography On File"],
["Brooke","Kargman","C","BK285745@albany.edu","M","N","N","N","V","N","No Biography On File"],
["Matthew","Wimpelberg","C","mw398184@albany.edu","M","N","N","N","C","M","No Biography On File"],
["Colby","Creedon","D","CC824151@albany.edu","M","M","N","N","N","N","No Biography On File"],
["Andrew","Ziegelstein","D","az528527@albany.edu","M","N","R","N","N","N","No Biography On File"],
["Jaqi","Cohen","E","JC184984@albany.edu","M","N","M","N","N","N","No Biography On File"],
["Anna","Politano","E","ap562955@albany.edu","M","N","N","N","M","N","No Biography On File"],
["Stephen","Guarneri Jr","F","StephenGuarneri@hotmail.com","M","N","N","M","N","N","No Biography On File"],
["David","Forsythe","I","DF154576@albany.edu","M","N","N","V","N","N","No Biography On File"],
["Anthony","Menna","I","am198242@albany.edu","M","N","N","N","M","N","No Biography On File"],
["Salina","Rivera","I","sr224136@albany.edu","M","N","M","N","N","N","No Biography On File"],
["Joe","Bonilla","O","jb435417@albany.edu","M","N","C","N","N","M","No Biography On File"],
["Jesse","Crescent","O","Jp191233@albany.edu","M","N","M","N","N","N","No Biography On File"],
["Adam","Feisthamel","O","feisthamela@gmail.com","M","M","N","N","N","N","No Biography On File"],
["Keith","Gardell","O","kg344311@albany.edu","M","N","N","N","M","N","No Biography On File"],
["Brandon","Hall","O","bh267542@albany.edu","M","R","N","N","N","N","No Biography On File"],
["Alyssa","Lovelace","O","Alyssa.m.lovelace@gmail.com","M","M","N","N","N","N","No Biography On File"],
["Katelyn","Messina","O","km248311@albany.edu","M","N","M","N","N","N","No Biography On File"],
["Joe","Bassell","S","jb739643@albany.edu","M","N","V","N","N","N","No Biography On File"],
["Nikoleta","Papa","S","NP675931@albany.edu","M","M","N","N","N","N","No Biography On File"],
["Dan","Scott","S","Danieljayscott@yahoo.com","M","M","N","N","N","N","No Biography On File"]	];


function masterlist(quad)
{

for (var loop = 0; loop <senate.length; loop++)
{
	if (senate[loop][2]==quad)
	{
		document.write("<tr><td><a href=senator.shtml?senator=",senate[loop][1],">",senate[loop][0]," ",senate[loop][1],"</a></td></tr>");
	}
}
}

function committee(ref)
{
var count = 0;
for (var loop = 0; loop <senate.length; loop++)
{
	if (senate[loop][ref]=="C")
	{
		if (ref==8)
			{
		document.write("<tr><td><a href=senator.shtml?senator=",senate[loop][1],">",senate[loop][0]," ",senate[loop][1]," - Chair</a></td></tr>");
				count++;
	}
	else
	{
		document.write("<tr><td><a href=senator.shtml?senator=",senate[loop][1],">",senate[loop][0]," ",senate[loop][1]," - Chair</a></td></tr>");
				count++;
	}
	}
}
if (count==0){
document.write("<tr><td>Committee Chair has not been assigned yet.</td></tr>");
}

var count = 0;
	if (ref==9)
	count=-1;
for (var loop = 0; loop <senate.length; loop++)
{
	if (senate[loop][ref]=="R")
	{
		document.write("<tr><td><a href=senator.shtml?senator=",senate[loop][1],">",senate[loop][0]," ",senate[loop][1]," - Ranking Member</a></td></tr>");
				count++;

	}}
	
	
	if (count==0){
document.write("<tr><td>Ranking Member has not been assigned yet.</td></tr>");
}
	
	
	
	var count = 0;
	if (ref==9)
	count=-1;
	for (var loop = 0; loop <senate.length; loop++)
{
	if (senate[loop][ref]=="V")
	{
		document.write("<tr><td><a href=senator.shtml?senator=",senate[loop][1],">",senate[loop][0]," ",senate[loop][1]," - Vice Chair</a></td></tr>");
				count++;

	}}
	if (count==0){
document.write("<tr><td>Vice Chair has not been assigned yet.</td></tr>");
}
	
	
var count = 0;
for (var loop = 0; loop <senate.length; loop++)
{
	if (senate[loop][ref]=="M")
	{
		document.write("<tr><td><a href=senator.shtml?senator=",senate[loop][1],">",senate[loop][0]," ",senate[loop][1],"</a></td></tr>");
		count++;
		
	}
	
}

if (count==0){
document.write("<tr><td>Committee Members have not been assigned yet.</td></tr>");
}




}

function bio(senator)
{
// Find the Senator's array refrence
var ref=-1
for (var loop = 0; loop <senate.length; loop++)
{

	if (senate[loop][1]==senator)
	{
		ref=loop;
	}

}

if (ref<0){
	document.write("<h2>Error - Invalid Senator</h2>");
	return;
}

//Leg Aid
if (senate[ref][2]=="N")
{
	document.write("<h2>",senate[ref][0]," ",senate[ref][1],"</h2><p><a href=mailto:",senate[ref][3],">",senate[ref][3],"</a><br>");
	document.write("Chief Legislative Aid<br>");
	return;
}


// Header
document.write("<h2>Senator ",senate[ref][0]," ",senate[ref][1],"</h2><p><a href=mailto:",senate[ref][3],">",senate[ref][3],"</a><br>Representing ");

// Print area representing
if (senate[ref][2]=="I"){
	document.write("Indian Quad<br>");}
if (senate[ref][2]=="S"){
	document.write("State Quad<br>");}
if (senate[ref][2]=="D"){
	document.write("Dutch Quad<br>");}
if (senate[ref][2]=="C"){
	document.write("Colonial Quad<br>");}
if (senate[ref][2]=="E"){
	document.write("Empire Commons<br>");}
if (senate[ref][2]=="F"){
	document.write("Freedom Quad<br>");}
if (senate[ref][2]=="O"){
	document.write("Off-Campus Students<br>");}
if (senate[ref][2]=="A"){
	document.write("Alumni Quad<br>");}
if (senate[ref][2]=="L"){
	document.write("all students as an At-Large Senator<br>");}

// Check for Senate Officer Status
if (senate[ref][4]=="C"){
	document.write("Chair of the Student Association Senate<br>");}
if (senate[ref][4]=="V"){
	document.write("Vice-Chair of the Student Association Senate<br>");}
if (senate[ref][4]=="R"){
	document.write("Parlimentarian of the Student Association Senate<br>");}

// Check for RO Status
if (senate[ref][5]=="C"){
	document.write("Chair of the <a href=ro.shtml>Rules and Operations Committee</a><br>");}
if (senate[ref][5]=="V"){
	document.write("Vice-Chair of the <a href=ro.shtml>Rules and Operations Committee</a><br>");}
if (senate[ref][5]=="R"){
	document.write("Ranking Member of the <a href=ro.shtml>Rules and Operations Committee</a><br>");}
if (senate[ref][5]=="M"){
	document.write("Member of the <a href=ro.shtml>Rules and Operations Committee</a><br>");}

// Check for UOC Status
if (senate[ref][6]=="C"){
	document.write("Chair of the <a href=uo.shtml>Student Outreach and Rights Committee</a><br>");}
if (senate[ref][6]=="V"){
	document.write("Vice-Chair of the <a href=uo.shtml>Student Outreach and Rights Committee</a><br>");}
if (senate[ref][6]=="R"){
	document.write("Ranking Member of the <a href=uo.shtml>Student Outreach and Rights Committee</a><br>");}
if (senate[ref][6]=="M"){
	document.write("Member of the <a href=uo.shtml>Student Outreach and Rights Committee</a><br>");}

// Check for GA Status
if (senate[ref][7]=="C"){
	document.write("Chair of the <a href=ga.shtml>Governmental Affairs Committee</a><br>");}
if (senate[ref][7]=="V"){
	document.write("Vice-Chair of the <a href=ga.shtml>Governmental Affairs Committee</a><br>");}
if (senate[ref][7]=="R"){
	document.write("Ranking Member of the <a href=ga.shtml>Governmental Affairs Committee</a><br>");}
if (senate[ref][7]=="M"){
	document.write("Member of the <a href=ga.shtml>Governmental Affairs Committee</a><br>");}

// Check for AP Status
if (senate[ref][8]=="C"){
	document.write("Chair of the <a href=app.shtml>Appropriations Committee</a><br>");}
if (senate[ref][8]=="V"){
	document.write("Vice-Chair of the <a href=app.shtml>Appropriations Committee</a><br>");}
if (senate[ref][8]=="R"){
	document.write("Ranking Member of the <a href=app.shtml>Appropriations Committee</a><br>");}
if (senate[ref][8]=="M"){
	document.write("Member of the <a href=app.shtml>Appropriations Committee</a><br>");}

// Check for COC Status
if (senate[ref][9]=="C"){
	document.write("Chair of the <a href=coc.shtml>Committee of Chairmen</a><br>");}
if (senate[ref][9]=="M"){
	document.write("Member of the <a href=coc.shtml>Committee of Chairmen</a><br>");}


// Footer
document.write("</p>");
}





function newbio(senator)
{
// Find the Senator's array refrence
var ref=-1
for (var loop = 0; loop <senate.length; loop++)
{

	if (senate[loop][1]==senator)
	{
		ref=loop;
	}

}

if (ref<0){
	document.write("<h2>Error - Invalid Senator</h2>");
	return;
}

// Header
document.write("<h2>Senator ",senate[ref][0]," ",senate[ref][1],"</h2><p><img src=",senate[ref][1],".jpg class=senatorpic><br><a href=mailto:",senate[ref][3],">",senate[ref][3],"</a><br>Representing ");

// Print area representing
if (senate[ref][2]=="I"){
	document.write("Indian Quad<br>");}
if (senate[ref][2]=="S"){
	document.write("State Quad<br>");}
if (senate[ref][2]=="D"){
	document.write("Dutch Quad<br>");}
if (senate[ref][2]=="C"){
	document.write("Colonial Quad<br>");}
if (senate[ref][2]=="E"){
	document.write("Empire Commons<br>");}
if (senate[ref][2]=="F"){
	document.write("Freedom Quad<br>");}
if (senate[ref][2]=="O"){
	document.write("Off-Campus Students<br>");}
if (senate[ref][2]=="A"){
	document.write("Alumni Quad<br>");}
if (senate[ref][2]=="L"){
	document.write("all students as an At-Large Senator<br>");}

// Check for Senate Officer Status
if (senate[ref][4]=="C"){
	document.write("Chair of the Student Association Senate<br>");}
if (senate[ref][4]=="V"){
	document.write("Vice-Chair of the Student Association Senate<br>");}
if (senate[ref][4]=="R"){
	document.write("Parlimentarian of the Student Association Senate<br>");}

// Check for RO Status
if (senate[ref][5]=="C"){
	document.write("Chair of the <a href=ro.shtml>Rules and Operations Committee</a><br>");}
if (senate[ref][5]=="V"){
	document.write("Vice-Chair of the <a href=ro.shtml>Rules and Operations Committee</a><br>");}
if (senate[ref][5]=="R"){
	document.write("Ranking Member of the <a href=ro.shtml>Rules and Operations Committee</a><br>");}
if (senate[ref][5]=="M"){
	document.write("Member of the <a href=ro.shtml>Rules and Operations Committee</a><br>");}

// Check for UOC Status
if (senate[ref][6]=="C"){
	document.write("Chair of the <a href=uo.shtml>Student Outreach and Rights Committee</a><br>");}
if (senate[ref][6]=="V"){
	document.write("Vice-Chair of the <a href=uo.shtml>Student Outreach and Rights Committee</a><br>");}
if (senate[ref][6]=="R"){
	document.write("Ranking Member of the <a href=uo.shtml>Student Outreach and Rights Committee</a><br>");}
if (senate[ref][6]=="M"){
	document.write("Member of the <a href=uo.shtml>Student Outreach and Rights Committee</a><br>");}

// Check for GA Status
if (senate[ref][7]=="C"){
	document.write("Chair of the <a href=ga.shtml>Governmental Affairs Committee</a><br>");}
if (senate[ref][7]=="V"){
	document.write("Vice-Chair of the <a href=ga.shtml>Governmental Affairs Committee</a><br>");}
if (senate[ref][7]=="R"){
	document.write("Ranking Member of the <a href=ga.shtml>Governmental Affairs Committee</a><br>");}
if (senate[ref][7]=="M"){
	document.write("Member of the <a href=ga.shtml>Governmental Affairs Committee</a><br>");}

// Check for AP Status
if (senate[ref][8]=="C"){
	document.write("Chair of the <a href=app.shtml>Appropriations Committee</a><br>");}
if (senate[ref][8]=="V"){
	document.write("Vice-Chair of the <a href=app.shtml>Appropriations Committee</a><br>");}
if (senate[ref][8]=="R"){
	document.write("Ranking Member of the <a href=app.shtml>Appropriations Committee</a><br>");}
if (senate[ref][8]=="M"){
	document.write("Member of the <a href=app.shtml>Appropriations Committee</a><br>");}

// Footer
document.write("<br>",senate[ref][9],"</p>");
}







function coc()
{
	
var count = 0;
for (var loop = 0; loop <senate.length; loop++)
{
	if (senate[loop][9]=="C")
	{
		
		document.write("<tr><td><a href=senator.shtml?senator=",senate[loop][1],">",senate[loop][0]," ",senate[loop][1]," - Senate Chair</a></td></tr>");
				count++;
	}
	
}

if (count==0){
document.write("<tr><td>Senate Chair has not been elected yet.</td></tr>");
}


var count = 0;
for (var loop = 0; loop <senate.length; loop++)
{
	if (senate[loop][9]=="V")
	{
		
		document.write("<tr><td><a href=senator.shtml?senator=",senate[loop][1],">",senate[loop][0]," ",senate[loop][1]," - Senate Vice-Chair</a></td></tr>");
				count++;
	}
	
}

if (count==0){
document.write("<tr><td>Senate Vice-Chair has not been elected yet.</td></tr>");
}


	

	
var count = 0;
for (var loop = 0; loop <senate.length; loop++)
{
	if (senate[loop][9]=="M")
	{
		document.write("<tr><td><a href=senator.shtml?senator=",senate[loop][1],">",senate[loop][0]," ",senate[loop][1],"</a> - ");
		if (senate[loop][5]=="C"){
			document.write("Chair of the <a href=ro.shtml>Rules and Operations Committee</a><br>");}																									
		if (senate[loop][7]=="C"){
			document.write("Chair of the <a href=ga.shtml>Governmental Affairs Committee</a><br>");}
		if (senate[loop][8]=="C"){
			document.write("Chair of the <a href=app.shtml>Appropriations Committee</a><br>");}
		if (senate[loop][6]=="C"){
			document.write("Chair of the <a href=uo.shtml>Student Outreach and Rights Committee</a><br>");}
		document.write("</td></tr>");
		count++;
	}
	
}

if (count==0){
document.write("<tr><td>Committee Chairs have not been elected yet.</td></tr>");
}

var count = 0;
for (var loop = 0; loop <senate.length; loop++)
{
	if (senate[loop][9]=="A")
	{
		
		document.write("<tr><td><a href=senator.shtml?senator=",senate[loop][1],">",senate[loop][0]," ",senate[loop][1]," - Cheif Legislative Aid</a></td></tr>");
				count++;
	}
	
}

if (count==0){
document.write("<tr><td>Chief Legistlative Aid has not been selected yet.</td></tr>");
}



}
