var officer_cnt = 0;
var officer_name = new Array();
var officer_position = new Array();
var officer_picture = new Array();
var officer_about = new Array();
var officer_email = new Array();
var officer_year = new Array();
var officer_research = new Array();
var officer_major = new Array();


function OfficerInfo(info) {
 officer_name[officer_cnt] = info.name;
 officer_position[officer_cnt] = info.position;
 officer_about[officer_cnt] = info.about;
 officer_picture[officer_cnt] = info.picture || "images/nopicture.jpg";
 officer_email[officer_cnt] = info.email;
 officer_year[officer_cnt] = info.year;
 officer_research[officer_cnt] = info.research;
 officer_major[officer_cnt] = info.major;
 officer_cnt++;
}

function makeOfficers(parentElem){
	for(var x = 0; x < officer_cnt;x++){
		var table = $C("table");
		table.setAttribute("class","officer_table");
		table.setAttribute("className","officer_table");
		table.setAttribute("width",officer_box_width);
		table.setAttribute("border",1);
		var tbody = $C("tbody");

		//Row 1
		var tr = $C("tr");
		var td = $C("td");
		td.setAttribute("class","officer_picture");
		td.setAttribute("className","officer_picture");
		td.innerHTML = "<img src='"+officer_picture[x]+"'/>";
		
		var rowspan = 7;
		
		if(typeof officer_about[x] == 'undefined')
			rowspan--;
		
		td.setAttribute("rowSpan",rowspan);
		tr.appendChild(td);
		td = $C("td");
		td.innerHTML = officer_name[x];
		td.setAttribute("class","officer_name");
		td.setAttribute("className","officer_name");
		tr.appendChild(td);
		tbody.appendChild(tr);
		//Row 2
		tr = $C("tr");
		td = $C("td");
		td.setAttribute("class","officer_position");
		td.setAttribute("className","officer_position");
		td.innerHTML = "<span class='officerinfo_header'>Position</span>: "+officer_position[x];
		tr.appendChild(td);
		tbody.appendChild(tr);

		tr = $C("tr");
		td = $C("td");
		td.setAttribute("class","officer_major");
		td.setAttribute("className","officer_major");
		td.innerHTML = "<span class='officerinfo_header'>Major</span>: "+officer_major[x];
		tr.appendChild(td);
		tbody.appendChild(tr);
		
		tr = $C("tr");
		td = $C("td");
		td.setAttribute("class","officer_year");
		td.setAttribute("className","officer_year");
		td.innerHTML = "<span class='officerinfo_header'>Year</span>: "+officer_year[x];
		tr.appendChild(td);
		tbody.appendChild(tr);
		
		//Row 3
		tr = $C("tr");
		td = $C("td");
		td.setAttribute("class","officer_email");
		td.setAttribute("className","officer_email");
		td.innerHTML = "<a href='mailto:"+officer_email[x]+"'>"+officer_email[x]+"</a>";
		tr.appendChild(td);
		tbody.appendChild(tr);
		
		tr = $C("tr");
		td = $C("td");
		td.setAttribute("class","officer_research");
		td.setAttribute("className","officer_research");
		td.innerHTML = "<span class='officerinfo_header'>Research Connections</span>: "+officer_research[x];
		tr.appendChild(td);
		tbody.appendChild(tr);
		
		//Row 4
		if(typeof officer_about[x] != 'undefined'){
			tr = $C("tr");
			td = $C("td");
			td.setAttribute("class","officer_about");
			td.setAttribute("className","officer_about");
			td.innerHTML = "<span class='officerinfo_header'>About</span>: "+officer_about[x];
			tr.appendChild(td);
			tbody.appendChild(tr);
		}

		table.appendChild(tbody);
		$(parentElem).appendChild(table);
		$(parentElem).innerHTML += "<br><br>";
	}
}