﻿/***************************************************
	chaptertable.js 
	
****************************************************/
/**************************************************
 Javascript Code to create the chapter table on the fly
 This allows changes to be made in ONE place
****************************************************/
var ChapterArray  = new Array();
// Alphabetical list of the chapters and information
ChapterArray[0] = new ChapterRecord(
"Arizona Cavalry",     // chapter name
"2683",                // chapter number
"2009",                // charter year
"Mrs. Alberta Allsup", // chapter contact (president)
"jimallsup@vtc.net", // contact email
"Safford"              // chapter city
);
ChapterArray[1] = new ChapterRecord(
"Dixie",
"1679",
"2008",
"Mrs. Yolanda McDonald",
"yoandken@cox.net",
"Tempe"
);
ChapterArray[2] = new ChapterRecord(
"John R. Baylor",
"2298",
"1961",
"Mrs. Gretchen Brittain, Contact",
"gc-udc@cox.net",
"Tucson"
);
ChapterArray[3] = new ChapterRecord(
"Johnny Reb",
"2674",
"2009",
"Mrs. Lee Thomasson Nelson",
"redhatlee@northlink.com",
"Prescott"
);
ChapterArray[4] = new ChapterRecord(
"Thunderbird",
"2102",
"1939",
"Ms. Rose Martin",
"Rosemar1@cox.net",
"Phoenix"
);

/********  OLD chapter was removed
ChapterArray[5] = new ChapterRecord(
"Picacho Pass",
"9999",
);

****/
// Constructor for the Object to hold the information
function ChapterRecord(ChapterName, ChapterNumber, CharterYear, ChapterPresident, PresidentEmail, ChapterCity)
{
	this.name = ChapterName;
	this.number = ChapterNumber;
	this.year = CharterYear;
	this.president = ChapterPresident;
	this.email = PresidentEmail;
	this.city = ChapterCity;
}


// WARNING - changing this code might result in invalid HTML code being generated
// BE CAREFUL!!

// Build the HTML code to display the Top picture and the Menu Buttons
function CreateTableText()
{
	TableText = new String();
	// First add in the table header information
	TableText = 
	'<div>' +
		'<table width="100%">' +
		'<col width="30%" />' +
		'<col width="20%" />' +
		'<col width="30%" />' +
		'<col width="20%" />' +
		'	<thead>' +
		'		<tr>' +
		'			<td>Chapter </td> <td>Charter Year</td> <td>President</td> <td>City</td>' +
		'		</tr>' +
		'	</thead>' +
		'	<tbody>';

	
	
	// Now build each of the rows
	for(i=0; i<ChapterArray.length; i++)
	{
		// Build the table row for each chapter
		TableText = TableText + 
			'<tr>' + 
			'<td>' + ChapterArray[i].name + ' ' + ChapterArray[i].number + '</td>' +
			'<td>' + ChapterArray[i].year + '</td>' +
			'<td><a href="mailto:' + ChapterArray[i].email + '">' + ChapterArray[i].president + '</a></td>' +
			'<td>' + ChapterArray[i].city + '</td>' +
			'</tr>';
			
	} // end for		

	// Add in the DIV markers to mark the end of the Menu buttons
	// and the start of the Chapter buttons
	TableText = TableText + 
	'		</tbody>' +
	'	</table>' +
	'</div>';

	return TableText;
}

// Create a new HTML section to insert into the document
var TheTable = CreateTableText();
var OldDiv = document.getElementById("ChapterTable");
OldDiv.innerHTML = TheTable;

// document.write(TheTable);

