// javascript for CFA entry page:

	var masterSurname = new Array ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "Y", "Z")
	var indexFile   = new Array ("a", "", "", "", "e", "f", "g", "", "i", "j", "k", "", "", "n", "o", "", "q", "", "", "t", "u", "v", "", "y", "z")
	var indexStatus = new Array ("+", "+", "-", "-", "+", "+", "+", "-", "+", "+", "+", "-", "-", "+", "+", "-", "+", "-", "-", "+", "+", "+", "-", "+", "+")
	var indexTemp = ""	
	var testChar = "?"
	var specialSurname = new Array ("Ba-Be", "Bf-Bre", "Brf-Bz", "Ca-Cn", "Co-Cz", "Carey, A-H", "Carey, I-Z", "Clark", "Cook", "Da-Dn", "Do-Dz", "Ha-He", "Hf-Hz", "Helton", "Langton", "Logan", "L - other", "Ma-Mb", "Mc-Me", "Mf-Mz", "Pa-Pi", "Pj-Pz", "Perry", "Plank", "Ra-Ri", "Rj-Rz", "Sa-Sp", "Sq-Sz", "Seward", "Smith", "Stewart", "Wa-Wh", "Wi-Wz", "Walker", "Winans, A", "Winans, B-C", "Winans, D-E", "Winans, F-I", "Winans, J", "Winans, K-L", "Winans, M", "Winans, N-R", "Winans, S", "Winans, T-Z", "Woolery")
	var specialFile = new Array ("b1", "b2", "b3", "cy", "cz", "c", "ca", "ci", "co", "d", "da", "hy", "hz", "h", "la", "lo", "l", "m1", "m2", "m3", "py", "pz", "p", "pi", "r", "ra", "sy", "sz", "s", "sh", "st", "wy", "wz", "w", "wf", "wg", "wh", "wi", "wj", "w1", "wk", "wl", "wm", "wn", "wo")
	var surnamesOpen = false
	var menuText = new Array ("HOME", "What's new?", "Table of contents", "Search", "Census central", "Geo-chronology", "Researchers", "Sources", "Technical stuff")
	var menuFile = new Array ('home', 'new', 'indexp', 'search', 'census/index', 'geochron/index', 'rsrchrs', 'sources', 'tech')
	var menuTitle = new Array ("Go to the entry page of the Carey Family Album.", "Take a look at what has been changed recently.", "Here are the subjects of the Carey Family Album pages.", "Search this site!", "See U. S. census records for our families.", "Travels in time and space...", "Our colleagues and collaborators in research.", "Check out some good sources of information on our families.", "Everything you really didnt want to know about web page design and family history.")

function doMenuTree()
	{
	// checkParams:
	surnamesOpen = false
	inParam = ""
  callxxx = "" + self.location
	testChar = "?"
  if (navigator.userAgent.indexOf('Opera 3') != -1)
	  {
		// Assume we're online:
	  docSource = "" + document.location
  	if (docSource.substring(0,5) != "http:")    // But maybe we're not...
			{
	    testChar = "&"
			}
		}
	qpos = callxxx.indexOf(testChar)
	if (qpos != -1)
	  {
		inParam = callxxx.substring(qpos+1, callxxx.length)
		zpos = inParam.indexOf("#")
		if (zpos != -1)
			{
			// This must be MIE or FF, since they consider "#xxx" to be a part
			// of self.location, while Opera doesn't:
			//
			inParam = inParam.substring(0, zpos)
			}
		if (inParam != "false")
			{
			surnamesOpen = true
			if (inParam == "true")
				{
				for (ii=0; ii<indexStatus.length; ii++)
					{
					indexStatus[ii] = "-"
					}
				}
			else
				{
				indexTemp = "" + inParam
				for (ii=0; ii<indexStatus.length; ii++)
					{
					indexStatus[ii] = indexTemp.substring(ii, ii+1)
					}
				}
			}
		}

	// doTop:
	for (iii=0; iii<menuText.length; iii++)
		{
		document.write("<A HREF='" + menuFile[iii] + ".htm' TITLE='" + menuTitle[iii] + "' TARGET='main'><img src='1vh.jpg'>" + menuText[iii] + "<\/A><br>")
		}

	// doSurnames:
	if (surnamesOpen == false)
		{
		document.write("<A HREF='left.htm" + testChar + "true#here' TITLE='Open the surname index to find specific individuals.' TARGET='toc'><img src='1plus.jpg'>SURNAMES<\/A><br>")
		}
	else
		{
		document.write("<A HREF='left.htm' TITLE='Close the surnames index.' TARGET='toc'><img src='1minus.jpg'>SURNAMES<\/A><br>")

		for (i=0; i<masterSurname.length; i++)
			{
			if (indexFile[i] != "")
				{
				// this isn't a "special surname"
				document.write("<A HREF='ix" + indexFile[i] + ".htm' TITLE='Go to surnames beginning with " + masterSurname[i] + "' TARGET='main'><img src='0.jpg'><img src='1")
				if (i == masterSurname.length-1)
					// This is the "Z" index (the last one!), which should have only one file:
					{
					document.write("ra")
					}
				else
					{
					document.write("vh")
					}
				document.write(".jpg'>" + masterSurname[i] + "<\/A><br>")
				}
			else
				{
				// it IS a "special surname", so add an anchor to the document, then see if it's open or closed:
				document.write("<a name='" + masterSurname[i] + "'><\/a>")
				if (indexStatus[i] == "+")
					{
					// it's open, so:
					document.write("<A HREF='javascript:closeLetter(" + i + ")' TITLE='Close the " + masterSurname[i] + " index.' TARGET='toc'><img src='0.jpg'><img src='1minus.jpg'>" + masterSurname[i] + "<\/A><br>")
					nx = 0
					for (ii=0; ii<specialSurname.length; ii++)
						// count the files for this letter:
						{
						if (masterSurname[i] == specialSurname[ii].substring(0, 1) )
							{
							nx++
							}
						}
					nxx = 0
					for (ii=0; ii<specialSurname.length; ii++)
						{
						if (masterSurname[i] == specialSurname[ii].substring(0, 1) )
							{
							nxx++
							document.write("<A HREF='ix" + specialFile[ii] + ".htm' TITLE='Go to " + specialSurname[ii] + " surnames.' TARGET='main'><img src='0.jpg'><img src='1v1.jpg'><img src='1")
							if (nxx == nx)
								{
								// This is last file for this letter:
								document.write("ra")
								}
							else
								{
								document.write("vh")
								}
							document.write(".jpg'>" + specialSurname[ii] + "<\/A><br>")
							}
						}
					}
				else
					{
					document.write("<A HREF='javascript:openLetter(" + i + ")' TITLE='Open the " + masterSurname[i] + " index.' TARGET='toc'><img src='0.jpg'><img src='1plus.jpg'>" + masterSurname[i] + "<\/a><br>")
					}
				}
			}
		}

	// do bottom:
	document.write("<a name='here'></a><p style='text-align: center;' ><a href='godbless.htm' target='main' title='God bless America!'><img src='godbless.jpg' width=77 height=125 title='God bless America!' alt=''><\/a><br><br clear=all><a href='http://validator.w3.org' target='_top' title='Valid HTML 4.01!'><img src='vh41.gif' width=88 height=31 title='All pages in the Carey Family Album meet the standards for &quot;Valid HTML 4.01&quot; and have been verified at validator.w3.org.' alt=''><\/a>")
	document.close() // all done!
	}
	
function openLetter(o)
	{
	indexStatus[o] = "+"
	indexTemp = ""
	for (ii=0; ii<indexStatus.length; ii++)
		{
		indexTemp = indexTemp + indexStatus[ii]
		}
	location.replace("left.htm" + testChar + indexTemp + "#" + masterSurname[o])
	}

function closeLetter(o)
	{
	indexStatus[o] = "-"
	indexTemp = ""
	for (ii=0; ii<indexStatus.length; ii++)
		{
		indexTemp = indexTemp + indexStatus[ii]
		}
	location.replace("left.htm" + testChar + indexTemp + "#" + masterSurname[o])
	}
// Last update = 30 Oct 2009.
